Pick a Free OS

User login


For Kernel_Newbies By a Kernel_Newbie

segment 0x7C0 (divide by 16). The bootsect.S moves itself out of the way to

0x90000, (copies itself from the 0x7C00 to 0x90000). It sets up the

disk_parameter table of the BIOS to increase the maximum sector read count to

36, and then starts reading sector 2 (setup.S -> 4 sectors-

>arch/i386/boot/setup.S to 0x90200 (skip 512 bytes). It also makes room for

the stack by the amount of bootsect (1 sector) + 4 sectors of setup.S plus room

for stack. Then the system ( composed of (DIR =

arch/i386/boot/compressed)/head.S,$DIR/misc.c,compressed_vmlinux (checkout

Makefile in the $DIR which makes a compressed vmlinux object from vmlinux by

using gzip,and using a linker (ld) script generated on the fly to define the

compressed layout of the image,using the ld script, SECTIONS { .data : {

*(.data) ; } } interspersed with location counters specified by using the DOT

character. (Read ld script tutorials from GNU for further details,as its

imperative to know it if you want to hack the kernel.) ) ) is moved to 0x10000 (

2**16= 2**10 * 2 ** 6 = 64K) The max size of the system is 508 K. It should be

noted here that the total Binary right from bootsect.S is comprised of the

following. (built running $DIR/tools/build.c: ) $DIR/../bootsect.S,

$DIR/../setup.S,(compressed_vmlinux_image = $DIR/head.S + $DIR/misc.c +

vmlinux(compressed). vmlinux(compressed) = $DIR/head.S + $DIR/misc.c +

compressed_vmlinux. compressed_vmlinux = ( KDIR = $DIR/../../kernel =

arch/i386/kernel)/head.S (which is an entry point for the Kernel Code

(uncompressed: _stext-> check out the Makefile in arch/i386/kernel ) The jump

to the C function start_kernel (init/main.c) for BP (Boot Processor) and all

other AP (Application Processors) call initialize_secondary) happens in

$KDIR/head.S, which kick starts the whole stuff by creating the init

kernel_thread and trying to execute the init program.


The above was a view from 30,000 feet of the Linux Kernel on its

WAY_TO_WORK.Let us come down a bit,and start taking a macro view on the things

explained above,before moving onto other things.

Booting Specifics :

The BIOS after doing the POST (Power on Self Test), checks for the booting

device. If its a boot through a floppy, then arch/i386/boot/bootsect.S gets the

cake, but for boots from hard_disks,its handled a bit differently. For