#### "The Linux Gazette...making Linux just a little more fun!"

# The Answer Guy

#### By James T. Dennis, linux-questions-only@ssc.com
LinuxCare, http://www.linuxcare.com/

### General HD Info and Boot Code

From Erik Bryer on Sun, 02 May 1999

Hi,

Got your email address from:
  http://www.linuxvalley.com/mirror/lg/issue36/tag/79.html

> Wow! Someone who actually tells me where their they found me! I've always thought that any e-mail to someone you've never met should include some passing reference of this sort.

> Of course, there are cases where it might be superfluous. If you were to e-mail Linux Torvalds he'd have a pretty good idea where you got his address; it's in the `/usr/src/linux` tree on millions of computers.

> Anyway, linuxvalley.com looks like an interesting site --- if you read Italian. I've seen quotes of myself translated into Italian, Portugese and a couple of other languages --- it's amusing. (I just feel sorry for the interpreters --- any of you out there? I owe you each a beer!).

Do you know of any websites with general hard drive info. More specifically, and I'm quite happy just with a web page reference if you like, I wonder if, like dos, unix requires executable code in the boot sector, if it even has a boot sector. I've tried alta vista, but found mostly junk. Thanks.

Erik Bryer Calgary

> Well I don't know about general hard drive info. Many of the hard drive manufacturers put technical information about their drives up on the web. Of course you usually have to hunt through quite alot of marketing fluff that clogs many corporate sites to get to the good stuff.

> However, I can answer the question regarding boot code.

> The PC BIOS requires that your OS, any OS be loaded from somewhere. Your mainstream choices are: hard drive, floppy, network and (most recently) CD-ROM. There are some devices which emulate drives (sold under names like "ROMDisk" et al.).

> When loading from a hard drive the BIOS loads the first sector (512 bytes) on track zero. This is called the MBR. It contains two parts: some boot loader code and a partition table. The partition table is in the last 66 bytes of the MBR. Actually there are 4 primary partition entries of 16 bytes each, and there's a pair of "signature" bytes which indicate whether or not the drive has ever been initialized. The other 446 bytes of the MBR contains the primary bootloader code.

> As you mentioned, MS-DOS provides its own bootloader. That just looks for the active partition and loads a secondary bootloader from the first sector of that partition.

> OS/2, NT, and the various PC implementations of UNIX each provide their own bootloaders. These load code from a "boot manager" (usually a one track partition somewhere on the primary drive).

> Linux offers a number of alternatives for loading the kernel. The most common is to use the LILO package. This consists of a program, `/sbin/lilo`, that reads a configuration file (`/etc/lilo.conf`, by default), and builds a set of primary and secondary boot blocks, and a set of "maps" and writes the primary boot code and the pointers to the secondary blocks and maps into the MBR. LILO is a very flexible utility. You can store information on up to 16 different boot images, you can pass parameters to the Linux kernel (which can set various boot time options in the kernel, or be passed along to init, and thence to the master environment and to the rc startup scripts). You can password restrict some or all of your LILO boot stanzas, define messages to be displayed at boot time, issue a command that sets an automatic "one time" set of boot parameters (`/sbin/lilo` -R), etc.

> Another option is GRUB, the GNU "grand unified bootloader." This is slated to be the bootloader for the GNU HURD (a free microkernel based operating system which has been under development since before Linus started on the Linux kernel). I've heard that GRUB can be be used now with the HURD betas and with Linux.

> One thing that's interesting about Linux, in contrast to other operating systems, is that you can load it in alternative ways. So you can load the PC Linux kernel using LOADLIN.EXE (an MS-DOS program) or directly from Win '9x using the updated LinLoad '95 (??? derived from LOADLIN?). So you can have copies of your kernel in any MS-DOS directory and "run them" from MS-DOS. You can put a Linux kernel straight on a floppy (starting at the first block thereon) and it will be directly loaded.

> You can also use SYSLINUX to put a Linux kernel on an MS-DOS formatted floppy and load it from there. (If you mount up a Red Hat installation floppy you'll see a copy of the SYSLINUX.CFG file that the SYSLINUX boot loader reads).

> It's also possible to load Linux over a network (given a suitable bootp PROM, installed in a NIC, for example). There is nothing to prevent a computer manufacturer from installing a Linux kernel in their own ROMs --- loading it with initrd (initialization RAM disk) support. There are some people doing this for "embedded" systems already (seems to be primarily in specialized systems, not in commodity PCs).

> Igel has been making Linux based Xterminal/etherterminal systems using "Disk on a Chip" drivers for years. (http://www.igelusa.com)

> As for finding "mostly junk" .... Yeah! I get that, too. However, a big part of "The Answer Guy's" success is that I sift through enough of that junk to (usually) come up with what I'm looking for. (Sometimes it's even what my correspondents were asking about!)

> I hope that helps.

##### Copyright © 1999, James T. Dennis
Published in The Linux Gazette Issue 42 June 1999

###### HTML transformation by Heather Stern of Starshine Techinical Services, http://www.starshine.org/

| 1 | 2 | 3 | 4 | 5 | 6
7 | 8 | 9 | 10 | 11 | 12
13 | 14 | 15 | 16 | 17 | 18
19 | 20 | 21 | 22 | 23 | 24