14

I am preparing a document in detail showing light on the boot sequence of Linux right from pressing of Power-on button the host to the login prompt appearance.

It would be great if we could combine and collate that right answers here into a single place of reference. Please include any details worth possible to note during the startup. Once the document gets complete from all the points, I will post the document details here as well and update the link in the question.

Please consider all possible scenarios like booting from disk, booting from usb, booting from network on a disk-less client where the rootfs(/) is on network.

8
  • 3
    Judging from this (including references) and this, you propose quite a huge project...
    – sr_
    Dec 17, 2011 at 10:36
  • 4
    Does this feel like a homework/thesis question to anyone else?
    – Shadur
    Dec 17, 2011 at 14:26
  • 1
    Shouldn't it then be flagged as community-wiki? Dec 17, 2011 at 20:05
  • 4
    I think this is far too broad for a question on SE, there are huge variations between distributions and configurations. Dec 17, 2011 at 22:46
  • 1
    can you please post the document prepared by you
    – Abhishek
    Jan 21, 2012 at 2:43

2 Answers 2

7

You want booting sequence of Linux or just PC booting sequence ... because there is no difference between booting Linux from usb/cdrom/hdd ... Linux is always booting from MBR where the bootloader is ...

Linux boot process:

  1. As power comes up the BIOS is given control
  2. BIOS runs self tests, usually including cursory memory tests.
  3. The BIOS then loads the first sector of the disk to be used for booting and transfers control to it.
  4. The MBR code varies. One version will chain to the code in the first sector of the boot partition (Windows), another will load a bootloader. Windows boot proceeds from code and information in the boot partition.
  5. bootloader chooses kernel location and version
  6. bootloader prepares kernel and initrd image in memory, transfers control to kernel
  7. loading kernel modules
  8. discovering hardware and load additional kernel modules to support it
  9. looking for disks
  10. R/O mount of / partition so that it can potentially be checked and repaired
  11. init process spawn
  12. /etc/inittab read and executing
  13. mounting all FSes from /etc/fstab
  14. runlevels running (based on default runlevel in /etc/inittab) or another init method such as systemd or upstart
  15. rc.local
  16. login prompt
4
  • Thanks @Sebastian, that was a good list. I am looking for detailed steps for example 1: what loads mbr info, before that how is post and bios instructions are flowing; 2. why r/o mount of / partition and then again read/write mount / partition .. what is process 0 in this whole process.. but thanks for the answer. Dec 17, 2011 at 17:40
  • @Nikhil regarding process 0 ... there is no such process, after kernel load You have process 1, which is init process. Regarding rest of points: 1. check ibm.com/developerworks/library/l-linuxboot/index.html 2. because first it needs to be checked files, then You can start write on it ... it's rather for security reasons ... Dec 17, 2011 at 23:36
  • There is no MBR on floppies or cdroms. The boot process for cdroms involves a catalog file that describes one or more multi sector images that the bios can choose to load and execute.
    – psusi
    May 22, 2012 at 13:49
  • What if the kernel modules are on a ext3 file system and the ext3 kernel module is not loaded yet? What's more, what if the kernel itself is on a file system that bootloader doesn't recognize? How is the following things loaded in sequence, loading kernel, loading bootloader, mounting /boot directory, reading /etc/fstab file, etc.
    – yegle
    Feb 10, 2014 at 7:17
3

Try installing and using bootchart.

2
  • 1
    thanks for the pointer, am actually looking to present a visualizing flow document of what happens during boot and what kind of decision making is involved in. Dec 17, 2011 at 16:10
  • 1
    thanks @Alexander I installed it on my fedora and it provides very detailed png
    – Abhishek
    Jan 21, 2012 at 3:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .