From Wikipedia, the free encyclopedia

Jump to: navigation, search

In computing, booting (booting up) is a bootstrapping process that starts operating systems when the user turns on a computer system. A boot sequence is the initial set of operations that the computer performs when power is switched on. The bootloader typically loads the main operating system for the computer.


[edit] History

The computer word boot is short for 'bootstrap' (short for 'bootstrap load'). The term bootstrap began as a metaphor derived from pull straps sewed onto the backs of leather boots with which a person could pull on their boots without outside help. In computers in the 1950s, pressing a bootstrap button caused a hardwired program to read a bootstrap program from a punched card and then execute the loaded boot program which loaded a larger system of programs from punched cards into memory, without further help from the human operator. [1][2] In a computing context, that word has been used since at least 1958[3].

The GE 645 (c. 1965) had a 'BOOT' button[4] – it could be that the contraction started as a way to label the button with fewer letters than the full word.

The Multics operating system (c. 1967) had a boot command.[5][6] Multics documents also refer to 'boot tapes', but it is hard to determine exactly when that term was first used.

In the Unix operating system, the earliest reference for 'boot' is probably in The Unix Programmer's Manual, first edition 1971.11.03[7].

The bootstrap concept was used in the IBM 701 computer (1952-1956) which had a "load button" which initiated reading of the first 36-bit word from a punched card in a card reader, or from a magnetic tape unit, or drum unit (predecessor of the harddisk drive). The left 18-bit half-word was then executed as an instruction which read additional words into memory.[8]

[edit] Boot loader

A computer's central processor can only execute program code found in Read-Only Memory (ROM) and Random Access Memory (RAM). Modern operating systems and application program code and data are stored on nonvolatile data storage devices, such as hard disc drives, CD, DVD, USB flash drive, and floppy disk. When a computer is first powered on, it does not have an operating system in ROM or RAM. The computer must initially execute a small program stored in ROM along with the bare minimum of data needed to access the nonvolatile devices from which the operating system programs and data are loaded into RAM.

The small program that starts this sequence of loading into RAM, is known as a bootstrap loader, bootstrap or boot loader. This small boot loader program's only job is to load other data and programs which are then executed from RAM. Often, multiple-stage boot loaders are used, during which several programs of increasing complexity sequentially load one after the other in a process of chain loading.

Early computers (such as the PDP-1 through PDP-8 and early models of the PDP-11) had a row of toggle switches on the front panel to allow the operator to manually enter the binary boot instructions into memory before transferring control to the CPU. The boot loader would then read the second-stage boot loader (called Binary Loader of paper tape with checksum) or the operating system in from an outside storage medium such as paper tape, punched card, or a disk drive.

Pseudo-assembly code for the bootloader might be as simple as the following eight instructions:

0: set the P register to 8
1: check paper tape reader ready
2: if not ready, jump to 1
3: read a byte from paper tape reader to accumulator
4: if end of tape, jump to 8
5: store accumulator to address in P register
6: increment the P register
7: jump to 1

A related example is based on a loader for a 1970's Nicolet Instrument Corporation minicomputer. Note that the bytes of the second-stage loader are read from paper tape in reverse order.

0: set the P register to 106
1: check paper tape reader ready
2: if not ready, jump to 1
3: read a byte from paper tape reader to accumulator
4: store accumulator to address in P register
5: decrement the P register 
6: jump to 1

The length of the second stage loader is such that the final byte overwrites location 6. After the instruction in location 5 executes, location 6 starts the second stage loader executing. The second stage loader then waits for the much longer tape containing the operating system to be placed in the tape reader. The difference between the boot loader and second stage loader is the addition of checking code to trap paper tape read errors, a frequent occurrence with the hardware of the time, which in this case was an ASR-33 teletype.

Some computer systems, upon receiving a boot signal from a human operator or a peripheral device, may load a very small number of fixed instructions into memory at a specific location, initialize at least one CPU, and then point the CPU to the instructions and start their execution. These instructions typically start an input operation from some peripheral device (which may be switch-selectable by the operator). Other systems may send hardware commands directly to peripheral devices or I/O controllers that cause an extremely simple input operation (such as "read sector zero of the system device into memory starting at location 1000") to be carried out, effectively loading a small number of bootload instructions into memory; a completion signal from the I/O device may then be used to start execution of the instructions by the CPU.

Smaller computers often use less flexible but more automatic bootload mechanisms to ensure that the computer starts quickly and with a predetermined software configuration. In many desktop computers, for example, the bootstrapping process begins with the CPU executing software contained in ROM (for example, the BIOS of an IBM PC) at a predefined address (some CPUs, including the Intel x86 series are designed to execute this software after reset without outside help). This software contains rudimentary functionality to search for devices eligible to participate in booting, and load a small program from a special section (most commonly the boot sector) of the most promising device.

Boot loaders may face peculiar constraints, especially in size; for instance, on the IBM PC and compatibles, the first stage of boot loaders located on hard drives must fit into the first 446 bytes of the Master Boot Record, in order to leave room for the 64-byte partition table and the 2-byte 0xAA55 'signature', which the BIOS requires for a proper boot loader.

Some operating systems, most notably pre-1995 Macintosh systems from Apple, are so closely interwoven with their hardware that it is impossible to natively boot an operating system other than the standard one. This is the opposite extreme of the bootload using switches mentioned above; it is highly inflexible but relatively error-proof and foolproof as long as all hardware is working normally. A common solution in such situations is to design a bootloader that works as a program belonging to the standard OS that hijacks the system and loads the alternative OS. This technique was used by Apple for its A/UX Unix implementation and copied by various freeware operating systems and BeOS Personal Edition 5.

[edit] Second-stage boot loader

GNU GRUB, a bootloader

The small program is most often not itself an operating system, but only a second-stage boot loader, such as GRUB, BOOTMGR, LILO or NTLDR. It will then be able to load the operating system properly, and finally transfer execution to it. The system will initialize itself, and may load device drivers and other programs that are needed for the normal operation of the OS.

Many bootloaders (like GRUB, BOOTMGR, LILO, and NTLDR) can be configured to give the user multiple booting choices. These choices can include different operating systems (for dual or multi-booting from different partitions or drives), different kernel versions of the same operating system (in case a new version has unexpected problems), different kernel options (e.g., booting into a rescue or safe mode) or some standalone program that can function without an operating system, such as memory testers (e.g., memtest86+) or even games.[9] Usually a default choice is preselected with a time delay during which you can press a key to change the choice, after which the default choice is automatically run, so normal booting can occur without interaction.

The boot process is considered complete when the computer is ready to interact with the user, or the operating system is capable of running ordinary applications. Typical modern PCs boot in about one minute (of which about 15 seconds are taken by a power-on self test (POST) and a preliminary boot loader, and the rest by loading the operating system, pre-OS time can be considerably shortened by bringing the system with all cores at once, as with coreboot[10]); whereas, large servers may take several minutes to boot and start all their services.

Many embedded systems must boot immediately. For example, waiting a minute for a digital television or sat-nav to start is generally unacceptable. Therefore such devices have their complete operating system in ROM or flash memory so the device can begin functioning immediately. For these types of embedded system little or no loading is necessary, since the loading can be precomputed and stored on the ROM when the device is made.

Large and complex systems may have boot procedures that proceed in multiple phases, each phase loading a more complex version of itself, until finally the actual operating system is loaded and ready to execute. Because most operating systems are designed as if they never start or stop, bootload processes sometimes construct a near-snapshot of a running operating system, configure themselves as a mere process within that operating system, and then irrevocably transfer control into the operating system; the bootload process then terminates normally as any other process would, and the operating system need not have any awareness of the bootload.

[edit] Network booting

Most computers are also capable of booting over a computer network. In this scenario, the operating system is stored on the disk of a server, and certain parts of it are transferred to the client using a simple protocol such as the Trivial File Transfer Protocol. After these parts have been transferred, the operating system then takes over control of the booting process.

[edit] Boot devices

The boot device is the device from which the operating system is loaded. A modern PC BIOS supports booting from various devices, typically a local hard disk drive (or one of several partitions on such a disk), an optical disc drive, a USB device (flash drive, hard disk drive, optical disc drive, etc.), or a network interface card (using PXE). Older, less common bootable devices include floppy disk drives, SCSI devices, Zip drives, and LS-120 drives.

Typically, the BIOS will allow the user to configure a boot order. If the boot order is set to "firstly, the DVD drive; secondly, the hard disk drive", then the BIOS will try to boot from the DVD drive, and if this fails (e.g. because there is no DVD in the drive), it will try to boot from the local hard drive.

For example, on a PC with Windows XP installed on the hard drive, the user could set the boot order to that given above, and then insert a Knoppix Live CD in order to try out Linux without having to install an operating system onto their hard drive. This is an example of dual booting - the user choosing which operating system to start after the computer has performed its Power On Self Test. In this example of dual booting, the user chooses by inserting or removing the CD from the computer, but it is more common to choose which operating system to boot by selecting from a menu using the computer keyboard. (Typically F11 or ESC)

[edit] Boot sequence on standard PC (IBM-PC compatible)

Upon starting, a personal computer's x86 CPU runs the instruction located at the memory location CS:IP FFFF:0000 of the BIOS, which is located at the 0xFFFF0 address. This memory location is close to the end of the 1MB of system memory accessible in real mode. It typically contains a jump instruction that transfers execution to the location of the BIOS start-up program. This program runs a power-on self test (POST) to check and initialize required devices. The BIOS goes through a pre-configured list of non-volatile storage devices ("boot device sequence") until it finds one that is bootable. A bootable device is defined as one that can be read from, and the last two bytes of the first sector contain the word 0xAA55 (also known as the boot signature).

A hex dump of FreeBSD's boot0 MBR

Once the BIOS has found a bootable device it loads the boot sector to hexadecimal Segment:Offset address 0000:7C00 or 07C0:0000 (maps to the same ultimate address) and transfers execution to the boot code. In the case of a hard disk, this is referred to as the master boot record (MBR) and is often not operating system specific. The conventional MBR code checks the MBR's partition table for a partition set as bootable (the one with active flag set)[11]. If an active partition is found, the MBR code loads the boot sector code from that partition and executes it. The boot sector is often operating system specific, however in most operating systems its main function is to load and execute the operating system kernel, which continues startup. If there is no active partition, or the active partition's boot sector is invalid, the MBR may load a secondary boot loader which will select a partition (often via user input) and load its boot sector, which usually loads the corresponding operating system kernel.

Some systems (particularly newer Macintoshes) use Intel's proprietary EFI. Also coreboot allows a computer to boot without having a overly-complicated firmware/BIOS constantly running in system management mode. The legacy 16-bit BIOS interfaces are required by certain x86 operating systems, such as Windows XP, Vista, and 7. However most boot loaders have 16-bit support for these legacy BIOS systems.[12][13][14]

[edit] Other kinds of boot sequence

Some other processors have other kinds of boot modes. Most digital signal processors have the following boot modes:

  • Serial mode boot
  • Parallel mode boot, such as the host port interface (HPI boot)

Many FPGA chips load their configuration from an external serial EEPROM ("configuration ROM") on power-up.

[edit] Initial Program Load

In IBM mainframe systems, the boot process is known as IPL (Initial Program Load). The term was coined by IBM for the design of the System/360 and continues to be used in those environments today[15]. In systems that share the System/360 heritage—and in some that have been inspired by it, including smaller systems such as the IBM 1130—IPL is a hardware function, not a program run on the system itself. In its basic form, an IPL is initiated by the computer operator by selecting the (three digit) device address using rotary switches on the computer console, followed by pressing the 'IPL' button. This starts a tiny (typically 24 byte) program entirely implemented in hardware, consisting merely of a few channel command words initiating a read operation from the designated device. Usually this is a disk drive, but exactly the same procedure is also used to boot from other devices, such as tape drives, or even card readers, in a device-independent manner, allowing e.g. the installation of an operating system on a pristine computer from a magnetic distribution tape. Of course, the disk, tape or card deck must contain a special program to load the actual operating system into memory, a multi-stage procedure similar to most booting procedures (see elsewhere in this article).

The System/360 IPL function reads 24 bytes from an operator-specified or pre-configured device into memory starting at location zero. The second and third groups of eight bytes are treated as Channel Command Words (CCWs) to continue loading the startup program. When the I/O channel commands are complete, the first group of eight bytes is then loaded into the Program Status Word (PSW) register and the startup program begins execution at the designated location.[15]

A noteworthy variation of this is found on the Burroughs B1700 where there is neither a bootstrap ROM nor a hardwired IPL operation. Instead, after the system is reset it reads and executes opcodes sequentially from a tape drive mounted on the front panel, this sets up a boot loader in RAM which is then executed. However, since this makes few assumptions about the system it can equally well be used to load diagnostic (Maintenance Test Routine) tapes which display an intelligible code on the front panel even in cases of gross CPU failure.

[edit] Rebooting

[edit] Hard reboot

A hard reboot (also known as a cold reboot, cold boot or cold start) is when power to a computer is cycled (turned off and then on) or a special reset signal to the processor is triggered. This restarts the computer without first performing any shut-down procedure. (With many operating systems, especially those using disk caches, after a hard reboot the filesystem may be in an "unclean" state, and an automatic scan of on-disk filesystem structures will be done before normal operation can begin.) It may be caused by power failure, be done by accident, or be done deliberately as a last resort to forcibly retrieve the system from instances such as a critical error or virus-inflicted DoS attack. It can also be used by intruders to access cryptographic keys from RAM, in which case it's called cold boot attack.

[edit] Soft reboot

A soft reboot (also known as a warm reboot) is restarting a computer under software control, without removing power or (directly) triggering a reset line. It usually, though not always, refers to an orderly shutdown and restarting of the machine.

The Control-Alt-Delete key combination on the original IBM PC was designed to allow a soft reboot for a quicker and more convenient (and, some argue, less stressful on system components) restart than powering the computer completely down then back up.[citation needed]

The Linux kernel has optional support for the kexec system call, which transfers execution to a new kernel and skips hardware or firmware reboot. The entire process is done independent of the system firmware. Note that the kernel being executed does not have to be a Linux kernel.

[edit] Random reboot

Random reboot is a non-technical term referring to an unintended (and often undesired) reboot for which the cause is not immediately evident to the user. Such reboots may occur due to a multitude of software and hardware problems, such as triple faults.

As Windows XP/Vista has an option to skip its Blue Screen of Death (Blue Screens of Death in Windows XP/Vista offer no option of pressing any key and seeing if the computer continues functioning) and immediately restarts the computer in the event of a fatal error, users can be mistaken in thinking a Windows XP/Vista computer suffers from random rebooting.

[edit] Errors

In Windows, when an error occurs in the boot process, a Blue Screen of Death or a Black Screen of Death may occur. On Unix and Unix-like operating systems, such as Linux, a fatal error in the boot process may cause a kernel panic.

[edit] Quick boot

Several devices are available that enable the user to "quick-boot" to a usually Linux-powered OS for various simple tasks such as Internet access (Splashtop, Latitude ON etc.).[16][17][18][19][20][21][22][23][24]

[edit] See also

[edit] References

  1. ^ bootstrap,
  2. ^ bootstrap, The free
  3. ^ Oxford English Dictionary. Oxford University. 
  4. ^ Van Vleck, Tom. "Glossary of Multics acronyms and terms". Retrieved on 2008-01-07. 
  5. ^ Bensoussan, A. (1967-06-30). "BC.4.01 System Initialization and Bootload". Multics System Programmer's Manual. 
  6. ^ Dunten, S. D.; T. H. Van Vleck (1968-05-03). "BV.1.01 BOS Bootload: boot". Multics System Programmer's Manual. 
  7. ^ Thompson, Ken; Dennis Ritchie (1971-11-03). The Unix Programmer's Manual (1st edition ed.). Retrieved on 2008-01-07. 
  8. ^ From Gutenberg to the Internet, Jeremy M. Norman, 2005, page 436, ISBN 0-930405-87-0
  9. ^
  10. ^ google tech talks - coreboot (aka LinuxBIOS): The Free/Open-Source x86 Firmware
  11. ^ Note that per MBR specifications the active partition is not required to be primary, however the boot sector code may require it to be in order to work properly.
  12. ^ "Intel Platform Innovation Framework for EFI". Intel. Retrieved on 2008-01-07. 
  13. ^ Intel Macintosh computers all have firmware with compatibility mode for legacy BIOS operations
  14. ^
  15. ^ a b (PDF)z/Architecture Principles of Operation. IBM. September 2005. Chapter 17. Retrieved on 2007-04-14. 
  16. ^
  17. ^
  18. ^
  19. ^
  20. ^
  21. ^
  22. ^
  23. ^
  24. ^

[edit] Further reading

Personal tools