Re: How does linux boot
hi ya ritesh
On Fri, 22 Oct 2004, Ritesh Raj Sarraf wrote:
> This is the way I understand.
> The computer is on. The BIOS loads the boot-loader. The boot-loader loads the
> kernel image. If the kernel image has modules, initrd also gets loaded so
> that appropriate modules can be loaded for the kernel to identify the
> hardware, filesystems etc etc...
not quite... close ...
> OS installation is done.. The kernel image, the initrd image etc are all
> stored on the disk.
easier concept is assume you boot from floppy.... lot easier to understand
> Now the boot loader loads and then loads the kernel image along with the
> initrd image.
initrd is NOT needed if the required drivers is built into the
kernel, ignore the initrd to avoid confusion too
> So, Is the boot-loader so smart and powerful
no ... boot-loader is the dumbest/simplest thing there is
the boot loader is usually 2 pieces ... ( 2.5 pieces if you use grub )
the boot loader is 512 bytes TOTAL
and of that 64bytes is used for the 4 primary partition
and 2 more bytes for "boot flag"
so your total size of your boot loader is 512 - 64 -2 (446bytes)
( that is simple, small and "dumb" or "super smart" )
- its job is to figure out where to jump to that has
the boot kernel ( usually stage 2 boot loader )
grub plays silly and wants stage1.5 to know if its
ext2 or ext3 or jfs, or xfs or reiserfs or foo-fs
- usually the stage1 boot loader says where to jump to
find the "main boot loader"
> (much more that the kernel) that
> it reads data from the disk without knowing the type of disk and the
> filesystem type ?
grub will try that ... to read the disk
lilo/other boot loaders all know how to read track 0 which
has all the info needed to boot
> I mean the kernel requires modules to be loaded to detect
> the type of disk (scsi or ide) ,
no ... the kernel does NOT need modules if the kernel was built
with the drivers compiled into it
> type of filesystem etc..
grub wants to know the filesystem on the disk ...
> The boot-loader
> doesn't require anything ? Amazing.
yeah... the "main" bootloader is small, simple, amazing, trivial
> If yes, the boot-loader is smart enough.
its NOT smart ... it's dumb .... it just does one thing,
where to find its next half (stage2) of the bootloader
> Why not use it's master-piece code into the kernel ? :-)
it IS already in the kernel
> If no, What have I missed to RTFM ? Any good docs ?
http://linux-boot.net/Boot.Sequence/
c ya
alvin
Reply to:
- References:
- How does linux boot
- From: Ritesh Raj Sarraf <riteshsarraf@users.sourceforge.net>(by way of Ritesh Raj Sarraf <riteshsarraf@users.sourceforge.net>)