Introduction

As I was trying to hack through the Linux source code, I found that there was not enough material explaining the way the source code is structured. I tried to understand the code sequence by tracing my way through the boot sequence, part of it has been reproduced here for those who are interested. It is no way complete (for I have not yet made my way through the entire code sequence) and neither is it guaranteed to be correct as I may be mistaken at some places in my understanding of the code. Send in your comments to kvs@csa.iisc.ernet.in, especially if you do notice any goof ups.

A few things are in order before I start:

Boot up part done by a PC.

On powering on the processor tests itself and proceeds to perform what is known as POST(Power On Self Test). It sets up some interrupt routines into the BIOS, and then tries to read sector 0 of either the floppy drive (if there is one) or the hard disk. It loads sector 0 into a fixed location in memory and passes control to this code. Sector 0 or the bootsector contains the code that is used to bootstrap the kernel.

Linux Boot Sequence

linux/drivers/block/ll_rw_blk.c:blk_dev_init linux/drivers/block/cdu31a.c:cdu31a_init linux/drivers/block/cdu31a.c:get_drive_configuration
  • linux/drivers/block/cdu31a.c:do_sony_cd_cmd
  • linux/drivers/block/cdu31a.c:get_drive_configuration
  • linux/drivers/block/cdu31a.c:cdu31a_init
  • linux/drivers/block/ll_rw_blk.c:blk_dev_init
  • linux/drivers/block/floppy.c:new_floppy_init
  • linux/drivers/block/ll_rw_blk.c:blk_dev_init
  • linux/drivers/block/ramdisk.c:rd_init
  • linux/drivers/block/ll_rw_blk.c:blk_dev_init
  • linux/init/main.c:start_kernel
  • call scsi_dev_init if configured to recognize scsi drivers.
  • linux/drivers/scsi/scsi.c:scsi_dev_init
  • linux/init/main.c:start_kernel
  • linux/fs/inode.c:inode_init
  • linux/init/main.c:start_kernel
  • linux/fs/file_table.c:file_table_init
  • linux/init/main.c:start_kernel
  • linux/fs/dcache.c:name_cache_init
  • linux/init/main.c:start_kernel
  • linux/fs/buffer.c:buffer_init
  • linux/fs/buffer.c:grow_buffers
  • linux/fs/buffer.c:buffer_init
  • linux/init/main.c:start_kernel
  • linux/net/socket.c:sock_init
  • linux/net/socket.c:proto_init
  • linux/net/unix/sock.c:unix_proto_init
  • unix_proto_ops defines the protocol operations for the unix protocol family. Call sock_register to register the protocol operations of this family with the socket layer.
  • For each socket in unix_datas set the refcnt field of the socket to 0.
  • linux/net/socket.c:proto_init
  • linux/net/inet/af_inet.c:inet_proto_inet
  • linux/net/inet/arp.c:arp_init
  • linux/net/inet/af_inet.c:inet_proto_init
  • linux/net/socket.c:sock_init
  • linux/net/inet/dev.c:dev_init
  • linux/drivers/net/loopback.c
  • linux/net/inet/dev.c:dev_init
  • linux/drivers/net/Space.c:ethif_probe
  • linux/drivers/net/ne.c:ne_probe
  • linux/drivers/net/ne.c:ne_probe1
  • linux/drivers/net/8390.c:ethdev_init
  • linux/drivers/net/net_init.c:ether_setup
  • linux/drivers/net/ne.c:ne_probe1
  • NS8390_init
  • linux/net/socket.c:sock_init
  • linux/init/main.c:start_kernel
  • linux/ipc/util.c:ipc_init
  • linux/ipc/sem.c:sem_init,linux/ipc/msg.c:msg_init,linux/ipc/shm.c:shm_init INCOMPLETE. Have to finish this sometime