Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

After you switch on?

How Linux boots?

After you switch on?

by  krischrist  Posted    (Edited  )
I came to know this from the How-To's in www.justlinux.com.
The following a short sumamry of what happens when you boot up Linux.

1.After you switch on.
When the computer is switched on it test's itself if everything is working properly.This is called "Power self test".Then a program which is located in the ROM BIOS of your computer called the bootstrap loader looks for a boot sector.A boot sector is the first sector of a disk and has a small program that can load an operating system.Boot sectors are marked with a magic number eg.
OxAA55=43603 at byte Ox1FE.This is how the hardware can tell whether the sector is a boot sector or not.

3.Places to look for bootstrap loader.
The bootstrap loader looks at a list of places to look foir the boot sector.Older machines looks in the primary floppy drive, then the primary hardrive, nowdays newer machines also accesses the CD-ROM drive.
4.After that.
Once a boot sector is found it loads it into the memory and passes control to the program that loads the operating system.In Linux this program will be LILO's first stage boot loader.
Its job is to only load and run the "second stage boot loader".This stage loader gives a prompt and loads the operating system you choose.
The LILO is actually a map installer, this reads the configuration file /etc/lilo.conf and writes the boot loaders and information about the operating system it can load to the hard disk.
After this init is loaded.

5. Init
Linux systems mostly use "System V" style of init.The init loads everything. It checks that the file systems are ok mounts them.It starts up daemons ,do networking , serve webpages and also starts the getty processes.
Init reads a file /etc/inittab, which tells it what to do.The first thing it does is to run the initialization script.Bash is the program that executes this script. On Redhat Linux this script is /etc/rc.d/rc.sysinit and in Debian systems it is /etc/init.d/rcS. The file systems are checked, partitions are mounted etc.

After this another script is executed which takes us into the default run-level.The subsystems are started in this run-level.There is a set of directories /etc/rc.d/rc0.d, /etc/rc.d/rc1.d,... in Redhat Linux and /etc/rc0.d,/etc/rc1.d,.. etc in Debian, which corresponds to different run-levels. If the run-level 3 starts up in Debian then all the scripts in /etc/rc3.d that start with 'S' are executed.These scripts are links to scripts in a directory called init.d.
When a run-level script is called by init ,it then looks in a directory for scripts starting with 'S'.For eg. S10syslog runs first since there are no scripts starting with S00.S01 etc.

Thats it.
More topics to come...
Krischrist
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top