Previous Page | Next Page

  1. Introduction
  2. Boot Process
  3. Init and System Initialization
  4. rc.sysinit script
  5. rc script
  6. functions script
  7. Services
  8. apm daemon
  9. network startup
  10. The network script file
  11. The network-functions file
  12. Portmap startup
  13. Random initialization
  14. Syslog initialization
  15. Gated
  16. Atd
  17. cron initialization
  18. pcmcia
  19. inetd daemon
  20. named daemon
  21. lpd daemon
  22. mars-nwe
  23. netfs startup
  24. dhcpd daemon
  25. autofs daemon
  26. keytable daemon
  27. sendmail daemon
  28. gpm daemon
  29. httpd daemon
  30. xfs startup
  31. smb startup
  32. innd startup
  33. linuxconf startup
  34. rc.local script
  35. Init, Getty, Login
  36. The shell
  37. Shutting down
  38. X
  39. Conclusions
  40. App A. rc.sysinit listing
  41. App B. functions listing
  42. App C. rc listing
  43. Credits

Linux Boot Process

When a PC is booted it starts running the BIOS program. This is a memory resident program usually residing on an EEPROM integrated circuit. Usually the user is allowed to set up the boot process with the BIOS firmware. For example boot priorities might be set to attempt boot first on Drive A (floppy) then Drive C (hard disk) then CDROM. The first sector on the booting media is then read by the bios program. The boot sector contains a small program which is run at this time. This program has the task of reading the operating system from the disk and running it. LILO is the program that Linux systems typically use to allow users to have a choice of operating systems to boot from. It is usually installed in the boot sector (also called the master boot record). If the user chooses to boot Linux, LILO will load the Linux kernel into memory and roughly the following happens:

  • LILO will read the file "/etc/lilo.conf". LILO will give the user a choice of booting from any label included in this file. If booting into Linux, there should be a line like "root=/dev/hda5" indicating what device will be mounted as root. There will also be a line like "image=/boot/vmlinuz-2.2.5-15", telling what kernel image to load.
  • The Linux kernel is installed compressed, so it will first uncompress itself. The beginning of the kernel image contains a small program that does this.
  • If you have a super-VGA card that Linux recognizes and that has some special text modes (such as 100 columns by 40 rows), Linux asks you which mode you want to use. During the kernel compilation, it is possible to preset a video mode, so that this is never asked. This can also be done with LILO or rdev.
  • After this, the kernel checks what other hardware there is (hard disks, floppies, network adapters, etc), and configures some of its device drivers appropriately; while it does this, it outputs messages about its findings. For example, when I boot, I it looks like this:
    	LILO boot:
    	Loading linux.
    	Console: colour VGA+ 80x25, 6 virtual consoles
    	Calibrating delay loop... 166.71 BogoMIPS
    	Memory: 62720k/65536k available (1008k kernel code, 412k reserved, 1052k data, 64K init)
    	Checking if this processor honors the WP bit even in supervisor mode... OK.
    	Buffer-cache hash table entries: 65536 (order: 9, 2097152 bytes)
    	Page-cache hash table entries: 16384 (order: 4, 65536 bytes)
    	VFS: Diskquotas version dquot_6.4.0 initialized
    	CPU: Cyrix 6x86MX 2.5 Core/Bus Clock stepping 06
    	Checking 386/387 coupling... OK, FPU using exception 16 error reporting
    	Checking 'htl' instruction... OK.
    	POSIX conformance testing by UNIFIX
    	mtrr: v1.35a (19990819) Richard Gooch (
    	PCI: PCI BIOS revision 2.10 entry at 0xbf0a0
    	PCI: Using configuration type 1
    	PCI: Probing PCI hardware
    	Linux NET4.0 for Linux 2.2
    	Based upon Swansea University Computer Society NET3.039
    	NET4: Unix domain sockets 1.0 for Linux NET4.0
    	NET4: Linux TCP/IP 1.0 for NET4.0
    	IP Protocols: ICMP, UDP, TCP, IGMP
    	TCP: Hash tables configured (ehash 65536 bhash 65536)
    	Initializing RT netlink socket
    	Starting Kswapd v 1.5
    	Detected PS/2 Mouse Port.
    	Serial driver version 4.27 with MANY_PORTS MULTIPORT SHARE_IRQ enabled
    	ttyS00 at 0x03f8 (irq = 4) is a 16550A
    	ttyS01 at 0x02f8 (irq = 3) is a 16550A
    	pty: 256 Unix98 ptys configured
    	apm: BIOS version 1.2 Flags 0x07 (Driver version 1.9)
    	Real Time Clock Driver v1.09
    	RAM disk driver initialized: 16 RAM disks of 4096K size
    	PIIX4: IDE controller on PCI bus 00 dev 39
    	PIIX4: not 100%native mode: will probe irqs later
    	    ide0: BM-DMA at 0xf000-0xf007, BIOS settings: hda:pio, hdb:pio
    	    ide1: BM-DMA at 0xf008-0xf00f, BIOS settings: hdc:pio, hdd:pio
    	hda: ST36422A, ATA DISK drive
    	hdb: ST36422A, ATA DISK drive
    	hdd: FX240S, ATAPI CDROM drive
    	ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
    	ide1 at 0x170-0x177,0x376 on irq 15
    	hda: ST36422A, 6103MB w/256kB Cache, CHS=778/255/63
    	hdb: ST36422A, 6103MB w/256kB Cache, CHS=778/255/63
    	hdd: ATAPI 24X CD-ROM drive, 256kB Cache
    	Uniform CDROM driver Revision: 2.56
    	Floppy drive(s): fd0 is 1.44M
    	FDC 0 is a post-1991 82077
    	md driver 0.90 MAX_MD_DEVS=256, MAX_REAL=12
    	raid5: measuring checksumming speed
    	raid5: MMX detected, trying high speed MMX checksum routines
    	   pII_MMX    :    252.222 MB/sec
    	   p5_MMX     :    291.084 MB/sec
    	   8regs      :    176.403 MB/sec
    	   32regs     :    116.967 MB/sec
    	using fastest function: p5_mmx (291.084 MB/sec)
    	scsi : 0 hosts.
    	scsi : detected total
    	md.c sizeof(mdp_super_t) = 4096
    	Pattition check:
    	 hda: hda1 hda2 hda3 hda4
    	 hdb: hdb1
    	RAMDISK: Compressed image found at block )
    	autodetecting RAID arrays
    	autorun ...
    	... autorun DONE.
    	VFS: Mounted root (ext2 filesystem) readonly.
    	change_root: old root has d_count=1
    	Trying to unmount old root ... okay
    	Freeing unused kernel memory: 64k freed
    	Adding Swap: 128516k swap-space (priority -1)
    	3c59x.c:v0.99H 11/17/98 Donald Becker
    	eth0: 3Com 3c905B Cyclone 100baseTx at 0x6800,  00:10:4b:ca:db:a1, IRQ 10
    	  8K byte-wide RAM 5:3 Rx:Tx split, autoselect/Autonegotiate interface.
    	  MII transceiver found at address 24, status 786d.
    	  MII transceiver found at address 0, status 786d.
    	  Enabling bus-master transmits and whole-frame receives.
    	eth1: 3Com 3c905B Cyclone 100baseTx at 0x6c00,  00:10:4b:ca:db:b5, IRQ 11
    	  8K byte-wide RAM 5:3 Rx:Tx split, autoselect/Autonegotiate interface.
    	  MII transceiver found at address 24, status 7849.
    	  MII transceiver found at address 0, status 7849.
    	  Enabling bus-master transmits and whole-frame receives.
    	Installing knfsd (copyright (C) 1996
    	nfsd_fh_init : initialized fhcache, entries=1024
    	NET4: Linux IPX 0.38 for NET4.0
    	IPX Portions Copyright (c) 1995 Caldera, Inc.

The exact texts are different on different systems, depending on the hardware, the version of Linux being used, and how it has been configured.

  • Then the kernel will try to mount the root filesystem. The place is configurable at compilation time, or any time with rdev or LILO. The filesystem type is detected automatically. If the mounting of the root filesystem fails, for example because you didn't remember to include the corresponding filesystem driver in the kernel, the kernel panics and halts the system (there isn't much it can do, anyway). The root filesystem is usually mounted read-only (this can be set in the same way as the place). This makes it possible to check the filesystem while it is mounted; it is not a good idea to check a filesystem that is mounted read-write.
  • After this the kernel starts the program "init" (located in /sbin/init) in the background (This will always become process number 1). Init will start the services setup in the system. This document is written to explicitly analyze the methods used for init to bring system services up. This should enable the reader to better understand how the system is set up and operates.