1*1ab5fc23Sjmc.\" $OpenBSD: biosboot.8,v 1.29 2022/06/27 16:39:34 jmc Exp $ 2df1f5d3aSweingart.\" 391a78840Stom.\" Copyright (c) 2003 Tom Cosgrove <tom.cosgrove@arches-consulting.com> 4897f5cfcSmickey.\" Copyright (c) 1997 Michael Shalayeff 5897f5cfcSmickey.\" All rights reserved. 6df1f5d3aSweingart.\" 7df1f5d3aSweingart.\" Redistribution and use in source and binary forms, with or without 8df1f5d3aSweingart.\" modification, are permitted provided that the following conditions 9df1f5d3aSweingart.\" are met: 10df1f5d3aSweingart.\" 1. Redistributions of source code must retain the above copyright 11df1f5d3aSweingart.\" notice, this list of conditions and the following disclaimer. 12df1f5d3aSweingart.\" 2. Redistributions in binary form must reproduce the above copyright 13df1f5d3aSweingart.\" notice, this list of conditions and the following disclaimer in the 14df1f5d3aSweingart.\" documentation and/or other materials provided with the distribution. 15df1f5d3aSweingart.\" 16897f5cfcSmickey.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17897f5cfcSmickey.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18897f5cfcSmickey.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19df1f5d3aSweingart.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20df1f5d3aSweingart.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21df1f5d3aSweingart.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 228855a495Smickey.\" OR SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23df1f5d3aSweingart.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24df1f5d3aSweingart.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25df1f5d3aSweingart.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26df1f5d3aSweingart.\" SUCH DAMAGE. 27df1f5d3aSweingart.\" 2851249ee3Sderaadt.Dd $Mdocdate: June 27 2022 $ 29897f5cfcSmickey.Dt BIOSBOOT 8 i386 30fc8533a3Saaron.Os 31df1f5d3aSweingart.Sh NAME 32897f5cfcSmickey.Nm biosboot 33e34c0550Sschwarze.Nd i386-specific first-stage system bootstrap 34df1f5d3aSweingart.Sh DESCRIPTION 351d7096c9SmickeyThis small program (roughly 512 bytes of code) is responsible for 3691a78840Stomloading the second-stage 37897f5cfcSmickey.Xr boot 8 3891a78840Stomprogram (typically /boot), which in turn will load the kernel. 39df1f5d3aSweingart.Pp 40e20327dbSflipk.Nm 4191a78840Stommust be installed by 4291a78840Stom.Xr installboot 8 . 4391a78840StomAs part of the installation, 4491a78840Stom.Xr installboot 8 4591a78840Stompatches 46e20327dbSflipk.Nm 4791a78840Stomwith information about the location of 4897ce4b56Sweingart.Xr boot 8 4991a78840Stomon disk. 5091a78840StomSpecifically, it writes the filesystem block number of 51bf1c21e6Sschwarze.Xr boot 8 Ns 's 5291a78840Stominode, 5391a78840Stomthe offset within this block of the inode, 5491a78840Stomand various filesystem parameters (taken from the superblock) 5591a78840Stomrequired to convert filesystem blocks to disk sectors. 564225e8e5SstspUsually, 574225e8e5Sstsp.Xr boot 8 584225e8e5Sstspis loaded from the root filesystem of the boot disk. 594225e8e5SstspIf the boot disk is a 604225e8e5Sstsp.Xr softraid 4 614225e8e5Sstspvolume, 624225e8e5Sstsp.Xr installboot 8 634225e8e5Sstsparranges for a copy of 644225e8e5Sstsp.Xr boot 8 654225e8e5Sstspto be loaded from a dedicated single-inode filesystem located within 664225e8e5Sstspthe volume's meta data area. 6791a78840Stom.Pp 6891a78840StomYou must re-run 6991a78840Stom.Xr installboot 8 7091a78840Stomwhenever 7191a78840Stom.Xr boot 8 7291a78840Stomis changed, as its inode may change. 7391a78840StomWhile it should not be necessary, 7491a78840Stomit may also be advisable to re-run 7591a78840Stom.Xr installboot 8 7691a78840Stomif you move your disk between machines and/or controllers. 7797ce4b56Sweingart.Pp 7897ce4b56SweingartWhen 7997ce4b56Sweingart.Nm 8091a78840Stomreceives control from either the BIOS or the 8141ce3b17Snaddymaster boot record (MBR), it will print the message: 82df1f5d3aSweingart.Pp 8391a78840Stom.Dl Loading 84df1f5d3aSweingart.Pp 8591a78840Stomfollowed by a dot for every filesystem block it attempts to load. 8691a78840StomIf /boot is loaded successfully, 8791a78840Stom.Nm 8891a78840Stomwill put the cursor on the next line just before 8991a78840Stomtransferring control to the newly-loaded program. 9091a78840Stom.Pp 9191a78840StomIf possible, 9291a78840Stom.Nm 9391a78840Stomwill read disk sectors using calls detailed in the Phoenix 9491a78840StomEnhanced Disk Drive Specification (EDD, sometimes known as LBA, reads). 9591a78840StomIt will fall back to CHS reads only if EDD calls are not available. 9697ce4b56Sweingart.Pp 9791a78840Stom.Nm 9891a78840Stomprints a 9991a78840Stom.Sq ;\& 10091a78840Stomafter the 10191a78840Stom.Dq Loading 10291a78840Stommessage if it is going to use CHS reads for any reason. 10391a78840StomFor example, when booting from floppy or CD-ROM. 10491a78840Stom.Pp 10591a78840Stom.Nm 10691a78840Stommay fail with any of the following error messages: 10791a78840Stom.Bl -tag -width ERR_X__ 10891a78840Stom.It Er ERR I 10991a78840StomToo many indirect blocks. 11091a78840Stom.Nm 11191a78840Stomis capable of reading the direct blocks in 112bf1c21e6Sschwarze.Xr boot 8 Ns 's 11391a78840Stominode (the location of which is patched into 11491a78840Stom.Nm 11591a78840Stomby 11691a78840Stom.Xr installboot 8 ) 11791a78840Stomand the first indirect block, 11891a78840Stombut it is not capable of reading further indirect blocks. 11991a78840StomThis error indicates that further such indirect blocks were found. 12091a78840StomThe system will not be able to boot. 12191a78840Stom.Pp 12291a78840StomThis is unlikely to ever happen in practice, as 12391a78840Stom.Xr boot 8 12491a78840Stomhas to be quite large for this to be an issue. 12591a78840StomThe smallest possible filesystem block size is 512 bytes 12691a78840Stom(one sector per filesystem block). 12791a78840StomOn such a system, there are 140 filesystem blocks that 12891a78840Stom.Nm 12991a78840Stomcan read, so 13091a78840Stom.Xr boot 8 13191a78840Stomcan be up to 70 KB. 13291a78840Stom.Pp 13391a78840StomHowever, even on floppy disks the filesystem block size is 1024 bytes. 13491a78840StomThis allows 13591a78840Stom.Xr boot 8 13691a78840Stomto occupy up to 268 disk blocks, 13791a78840Stomi.e. to be 268 KB. 13891a78840StomOn hard disks (default filesystem block size 16 KB) 13991a78840Stom4,108 disk blocks are available, to allow 14091a78840Stom.Xr boot 8 14191a78840Stomto be over 64 MB in size! 14291a78840Stom(Only direct blocks are required for 143bf1c21e6Sschwarze.Xr boot 8 Ns s 14491a78840Stomof up to 192 KB.) 14591a78840Stom.It Er ERR M 14691a78840StomBad magic. 14791a78840StomThe ELF 14891a78840Stom.Dq magic number 14991a78840Stom\e7fELF in 150bf1c21e6Sschwarze.Xr boot 8 Ns 's 15191a78840Stomheader was not found. 15291a78840StomThis indicates that the first block of 15391a78840Stom.Xr boot 8 15491a78840Stomwas not read correctly. 15591a78840StomThis could be due to disk corruption, 15691a78840Stomfailing to run 15791a78840Stom.Xr installboot 8 , 15891a78840Stomgiving an invalid 15991a78840Stom.Xr boot 8 16091a78840Stomprogram as the 16191a78840Stom.Ar boot 16291a78840Stomargument to 16391a78840Stom.Xr installboot 8 , 16491a78840Stomor 16591a78840Stomincorrect geometry translation. 16691a78840Stom.It Er ERR R 16791a78840StomRead error. 16891a78840StomThe BIOS returned an error indication when 16991a78840Stom.Nm 17091a78840Stomattempted to read a disk sector. 17191a78840StomThis might be any media error, including bad sectors (common on floppy disks), 17291a78840Stomand invalid sectors (can occur with bad geometry translations). 17391a78840Stom.It Er ERR X 17491a78840StomCan't boot. 17591a78840StomIssued when trying to read sectors in CHS mode, 17691a78840Stombut the BIOS call 17791a78840Stom.Em get\ drive\ parameters 17891a78840Stomfailed or gave a value of 0 for the number of sectors per track. 17991a78840StomIn either case, it is not possible for 18091a78840Stom.Nm 18191a78840Stomto calculate the (cylinder, head, sector) values required to 18291a78840Stomread any sectors. 183dcb23958Sjmc.El 18497ce4b56Sweingart.Sh NOTES 18591a78840StomUsing 18697ce4b56Sweingart.Nm 18791a78840Stomas the MBR, 18891a78840Stomas has been done in the past, 18991a78840Stomis not recommended, and is not supported. 19091a78840StomInstead, create a single 19191a78840Stom.Xr fdisk 8 19291a78840Stompartition that spans the entire disk. 19391a78840Stom.Pp 19491a78840StomDespite the support for 19591a78840Stom.Xr boot 8 19691a78840Stomover the 8 GB boundary, 19791a78840Stomgood 19891a78840Stom.Xr disklabel 8 19991a78840Stompartitioning practices should still be followed. 200df1f5d3aSweingart.Sh FILES 201897f5cfcSmickey.Bl -tag -width /usr/mdec/biosbootxx -compact 202897f5cfcSmickey.It Pa /usr/mdec/mbr 203897f5cfcSmickeyMaster Boot Record block 204897f5cfcSmickey.It Pa /usr/mdec/biosboot 205897f5cfcSmickeyprimary bootstrap 206df1f5d3aSweingart.It Pa /boot 20797ce4b56Sweingartsecondary bootstrap 2086a103917Sjmc.It Pa /usr/mdec/pxeboot 2096a103917SjmcPXE bootstrap 210df1f5d3aSweingart.It Pa /bsd 21191a78840Stom.Ox 21291a78840Stomkernel 21356eb586fSsobrado.It Pa /bsd.sp 21456eb586fSsobrado.Ox 21556eb586fSsobradokernel for single processor machines 21615b05658Sjmc.It Pa /bsd.mp 21715b05658Sjmc.Ox 21856eb586fSsobradokernel for multiprocessor machines 21915b05658Sjmc.It Pa /bsd.rd 22015b05658Sjmc.Ox 22115b05658Sjmckernel for installation/recovery 222df1f5d3aSweingart.El 223df1f5d3aSweingart.Sh SEE ALSO 2244225e8e5Sstsp.Xr softraid 4 , 225350bb3b8Salex.Xr boot 8 , 226897f5cfcSmickey.Xr boot_i386 8 , 22791a78840Stom.Xr disklabel 8 , 228897f5cfcSmickey.Xr fdisk 8 , 2296a103917Sjmc.Xr installboot 8 , 2306a103917Sjmc.Xr pxeboot 8 231371254b6Sjmc.Sh HISTORY 23291a78840Stom.Nm 23391a78840Stomwas originally written by Michael Shalayeff for 234371254b6Sjmc.Ox 2.1 . 23591a78840StomHowever it was based on bootstrap code from older versions of this 236371254b6Sjmcoperating system, other operating systems, other programs, and 237371254b6Sjmcother people's work. 23891a78840Stom.Pp 23991a78840StomIt was significantly revised in December 2003 by Tom Cosgrove, 24091a78840Stomin order to support LBA disk access (via the Phoenix Enhanced Disk 24191a78840StomDrive Specification API). 24291a78840StomAt that time the internal table of disk blocks was removed, and 24391a78840Stom.Nm 24491a78840Stommodified to read filesystem block numbers from the inode. 245df1f5d3aSweingart.Sh BUGS 24691a78840Stom.Nm 24791a78840Stomshould perform and verify a checksum across the entire loaded 24891a78840Stom.Xr boot 8 24991a78840Stomimage, 25091a78840Stomrather than just checking the magic number in the first block. 251897f5cfcSmickey.Pp 25297ce4b56SweingartThere is no BIOS error number reported nor is the location of the error 25397ce4b56Sweingartreported. 254897f5cfcSmickey.Pp 255897f5cfcSmickeyYou can pick your motherboard, and you can pick your BIOS, 256897f5cfcSmickeybut you can't pick your motherboard's BIOS. 257