[TriLUG] HDD Bootability, WAS OT: Looking slightly used Notebook HDD

Steve Litt slitt at troubleshooters.com
Fri Feb 6 13:01:38 EST 2009


On Friday 06 February 2009 12:45:19 pm Tim Jowers wrote:
> Maybe someone else knows for sure.
>
> I think the PC BIOS reads the first little bit of the disk so that
> must be good for the PC BIOS to load the next place to jump and start
> running the BIOS instructions saved on the disk (after running the
> bios flash/eeprom). 

Yes. The ROM BIOS on an IBM AT compatible computer (otherwise known as an X86) 
is programmed to look at each possible boot device, in order, and read its 
first 512 byte sector (boot sector). The cylinder/sector/head location of the 
next code to run is also on the boot sector. About half of that boot sector 
is a partition table, and the other half is code to be executed, and a little 
bit (the fifth quarter :-)) is unused.

That code pulled off the first sector is executed if possible. If it's 
executable, that code's first job is to load a specific "file" from elsewhere 
on the device, or even on another device in the case of a boot loader. I use 
the word "file" in quotes because at this low level, some boot code can't 
even do file systems, it can only find code via cylinder/sector/head 
geometry. One of the big differences between LILO and Grub is after loading 
stage1, Grub understands Linux filesystems and can load files as files. LILO 
on the other hand is ignorant of filesystems so that when you do run your 
lilo command, it looks at lilo.conf, figures the cylinder/sector/head that 
starts the code to load, and puts that address in the first sector, and 
that's how LILO finds that "file" on subsequent reboots.

The "file's" code typically runs the operating system, but sometimes it jumps 
yet again to other code, as in Grub where it goes:

boot sector->stage1->stage2->kernel and init

So with Grub, stage1 loads the ability to read a Linux filesystem, after which 
the grub configuration file can be read right off the disk.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US




More information about the TriLUG mailing list