Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Booting
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== BIOS ==== Once the [[BIOS]] has found a bootable device it loads the boot sector to linear address {{Mono|7C00h}} (usually [[X86 memory segmentation|segment]]:[[Offset (computer science)|offset]] {{Mono|0000h}}:{{Mono|7C00h}},<ref name="Paul_1997_OD-A3"/><ref name="BBS_101" />{{rp|29}} but some BIOSes erroneously use {{Mono|07C0h}}:{{Mono|0000h}}{{citation needed|date=August 2012|reason=Some Compaq BIOSes are known to jump to 07C0h:0000h instead of the correct and official 0000h:7C00h address. This breaks any boot sector/MBR code not written to be relocatible or assuming certain register values on startup.}}) and transfers execution to the boot code. In the case of a hard disk, this is referred to as the [[Master Boot Record]] (MBR). The conventional MBR code checks the MBR's partition table for a partition set as ''bootable''<ref group=nb>The [[active partition]] may contain a [[Second-stage boot loader]], e.g., OS/2 Boot Manager, rather than an OS.</ref> (the one with ''active'' flag set).<!-- <ref>Per MBR specifications{{Citation needed|date=May 2023}} the [[active partition]] is not required to be [[primary partition]], however the [[boot sector]] code may require it to be in order to work properly.{{Citation needed |date=May 2023}}</ref> --> If an [[active partition]] is found, the MBR code loads the [[boot sector]] code from that partition, known as [[Volume Boot Record]] (VBR), and executes it. The MBR boot code is often operating-system specific. A bootable MBR device is defined as one that can be read from, and where the last two bytes of the first sector contain the [[little-endian]] [[Word (data type)|word]] {{Mono|AA55h}},<ref group="nb" name="NB_Magic_AA55"/> found as byte sequence {{Mono|55h}}, {{Mono|AAh}} on disk (also known as the [[MBR boot signature]]), or where it is otherwise established that the code inside the sector is executable on x86 PCs.<!-- since not all BIOSes actually check for the signature --> The boot sector code is the first-stage boot loader. It is located on [[fixed disk]]s and [[removable drive]]s, and must fit into the first 446<!-- 512-4*16-2 --> [[bytes]] of the [[Master Boot Record]] in order to leave room for the default 64-byte<!-- 4*16 --> [[partition table]] with four partition entries and the two-byte [[MBR boot signature|boot signature]], which the BIOS requires for a proper boot loader — or even less, when additional features like more than four partition entries (up to 16 with 16 bytes each), a [[MBR disk signature|disk signature]] (6 bytes), a [[MBR disk timestamp|disk timestamp]] (6 bytes), an [[Advanced Active Partition]] (18 bytes) or special [[multi-boot]] loaders<!-- like LOADER --> have to be supported as well in some environments. In [[floppy]] and [[superfloppy]] [[Volume Boot Record]]s, up to 59<!-- 51+8 (ignoring the 3-byte-jump which can be counted as code) --> bytes are occupied for the [[Extended BIOS Parameter Block]] on [[FAT12]] and [[FAT16]] volumes since DOS 4.0, whereas the [[FAT32]] EBPB introduced with DOS 7.1 requires even 87<!-- 79+8 --> bytes, leaving only 423<!-- 512-87-2 (ignoring the 3-byte-jump which can be counted as code) --> bytes for the boot loader when assuming a sector size of 512 bytes. Microsoft boot sectors therefore traditionally imposed certain restrictions on the boot process, for example, the boot file had to be located at a fixed position in the root directory of the file system and stored as consecutive sectors,<ref name="Duncan_1988_MS-DOS_Encyclopedia"/><ref name="Chappell_1994_DOS-Internals"/> conditions taken care of by the <code>[[SYS (DOS command)|SYS]]</code> command and slightly relaxed in later versions of DOS.<ref name="Chappell_1994_DOS-Internals"/><ref group="nb" name="NB_PC_DOS_Contiguous_files"/> The boot loader was then able to load the first three sectors of the file into memory, which happened to contain another embedded boot loader able to load the remainder of the file into memory.<ref name="Chappell_1994_DOS-Internals"/> When Microsoft added [[Logical block addressing|LBA]] and FAT32 support, they even switched to a boot loader reaching over ''two'' physical sectors and using 386 instructions for size reasons. At the same time other vendors managed to squeeze much more functionality into a single boot sector without relaxing the original constraints on only minimal available memory (32 KB) and processor support ({{not a typo|8088/8086}}).<ref group="nb" name="NB_DR-DOS_707"/> For example, DR-DOS boot sectors are able to locate the boot file in the FAT12, FAT16<!-- since DR DOS 3.31 --> and FAT32<!-- DR-DOS 7.07 --> file system, and load it into memory as a whole via [[cylinder-head-sector|CHS]] or LBA, even if the file is not stored in a fixed location and in consecutive sectors.<ref name="Rosch_1991_SYS"/><ref name="Paul_1997_OD-A3"/><ref name="Paul_2001"/><ref name="Paul_2002"/><ref name="Paul_2017"/><ref group="nb" name="NB_DR-DOS_File-size"/><ref group="nb" name="NB_DR-DOS_707"/> The VBR is often OS-specific; however, its main function is to load and execute the operating system boot loader file (such as <code>bootmgr</code> or <code>ntldr</code>), which is the second-stage boot loader, from an active partition. Then the boot loader loads the [[OS kernel]] from the storage device. 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. In some cases, the MBR may also attempt to load secondary boot loaders before trying to boot the active partition. If all else fails, it should issue an [[INT (x86 instruction)|INT]] 18h<ref name="BBS_101"/><ref name="Paul_1997_OD-A3"/> [[BIOS interrupt call]] (followed by an INT 19h just in case INT 18h would return) in order to give back control to the BIOS, which would then attempt to boot off other devices, attempt a [[network booting|remote boot]] via network.<ref name="Paul_1997_OD-A3"/>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Booting
(section)
Add topic