SlideShare a Scribd company logo
Linux Booting Steps Presented By- Anando Kumar Paul
Introduction Overview System startup  Stage 1 boot loader  Stage 2 boot loader  Kernel  Init
Overview Processor executes code at a well known location i.e. Basic Input / Output System (BIOS). BIOS stored in Flash memory on the mother board. CPU invokes the reset vector to start a program at a known address in flash/ROM. BIOS determines candidates for boot. First Stage Boot Loader is loaded into RAM and executed when a boot device is found. Continue…
Overview First stage Boot Loader is less than 512 bytes in length (single sector), and loads the second-stage boot loader. A splash screen is commonly displayed at the time of when the second-stage boot loader is in RAM.  Linux and initial RAM disk (temporary file system) are loaded into memory. After completing image loading, the second-stage boot loader passes control to the kernel image. Now kernel is decompressed and initialized. Continue…
Overview After initialization second-stage boot loader  checks the system hardware enumerates the attached hardware devices Then mounts the root device loads the necessary kernel modules When complete, the first user-space program (init) starts, and high level system initialization is performed.
System Startup Depends on the Linux hardware. A bootstrap environment is used when the system is powered on or reset. e.g. U-Boot, RedBoot and MicroMonitor from Lucent. Embedded platforms are commonly shipped with a boot monitor, which resides in special region on flash memory on the target hardware. Download Linux kernel image into flash memory and subsequently execute it. Have the ability to store and boot a Linux image and cover both the first and second stage boot loader.
System Startup Linux booting begins in the BIOS at address 0xFFFF0. STEP 1 :  Power-on self test (POST). To perform a check of the hardware. STEP 2 :  Local device enumeration and initialization. Uses of BIOS functions : First parts: POST code Second part Runtime services After completion of POST, it is flushed from memory but the BIOS runtime services remain and are available to the target operation system.
System Startup BIOS runtime searches for devices that are both active and bootable in the order of preference defined by the complementary metal ozide semiconductore (CMOS) settings. Boot devices Floppy Disk CD-ROM A partition on a Hard disk A device on the network USB flash memory stick Linux is booted using boot loader which resides in Master Boot Record (MBR), located in the first sector on the disk (sector 1 of cylinder 0 head 0)‏ After MBR loaded into RAM, BIOS yields control to it.
Stage – 1 Boot Loader The primary boot loader which resides in MBR. 512-byte image containing both program code and small partition table.
First 446 bytes are the primary boot loader contains both executable code and error message text. Next 64 bytes are the partition table contains a record for each of four partitions (1b bytes each). MBR ends with 2 bytes that are defined as magic number (0xAA55). Magic number serves as a validation check of MBR. Uses : Find and load the secondary boot loader (stage 2). It does this by looking through the partition table for an active partition.  It scans remaining partitions to ensure that they are all inactive when it finds an active operation. The active partition’s boot record is read from the device into RAM and executed, when this is verified. Stage – 1 Boot Loader
Stage 2 Boot Loader Also known as kernel loader. To load the Linux kernel and optional initial RAM disk. The first stage and second stage boot loaders combined are called LInux Loader (LILO) or Grand Unified Bootloader (GRUB). LILO has some disadvantages that were corrected in GRUB. GRUB features Linux file system knowledge. Can load a Linux kernel from an ext2 or ext3 file system instead of using raw sectors on the disk as LILO. Converts two stage boot loader to three stage boot loader. Stage 1 : (MBR) boots a stage 1.5 boot loader that understands the particular file system containing the Linux kernel image.
Stage 2 Boot Loader GRUB features Converts two stage boot loader to three stage boot loader. Stage 1 :  (MBR) boots a stage 1.5 boot loader that understands the particular file system containing the Linux kernel image. “ Reiserfs_stagel_5” to load from reiser journaling file system or “e2fs_stagel_5” to load from an ext2 or ext3 file system. When the stage 1.5 boot loader is loaded and running then the stage 2 boot loader can be loaded. Stage 2 :  GRUB can display a list of available kernels( defined in /etc/grub.conf. wit the soft links from /etc/grub/menu.lst and /etc/grub.cons). Can select a kernel and amend it with additional kernel parameters. Can use command line shell for greater manual control over the boot process.  This stage can consult with the file system and the default kernel image and initrd image are loaded into memory. With this images ready boot loader invokes the kernel image.
Kernel Kernel stage begins with the kernel image in the memory and control given from stage 2 boot loader. It’s a compressed kernel image. E.g. zImage (<512KB), bzImage(>512KB). A routine does some minimal amount of hardware setup and then decompresses the kernel contained within the kernel image and place it into high memory. The routine moves it into memory and notes for later use if an initial RAM disk is present. Calls the kernel and the kernel boot begins. bzImage is invoked and begin at ./arch/i386/boot/head.S in the start assembly routine. Does hardware support and invokes the startup_32 routine in ./arch/i386/boot/compressed/head.S. This routine sets up a basic environment (stack, etc.) and clears the Block Started by Symbol (BSS). Kernel then decompressed through a call to a C function called decompressed_kernel ( located in ./arch/i386/boot/compresed/misc.c ). Another startup_32 function is called which is in ./arch/i386/kernel/head.S.
Startup_32 function (also called the swapper or process 0), the page tables are initialized and memory paging is enabled. CPU type is detected along with optional floating-point unit (FPU) and stored away for later use. start_kernel function invoked (init/main.c), which takes to the non-architecture specific Linux kernel.  start_kernel, in essence, the main function for the Linux kernel. Kernel
Kernel Program flow
Kernel “ start_kernel” function List of initialization functions are called to set up interrupts Performs further memory configuration. Load the initial RAM disk. “ kernel_thread” function (in arch/i386/kernel/process.c)‏ Start init function, which is the first user space process. Finally, the idle task is started and the scheduler can now take control(after the call to cpu_idle). The pre-emptive scheduler periodically takes control to provide multitasking with interrupts enabled.
Kernel Kernel booting The initial RAM disk (initrd) is copied into RAM and mounted. Initrd serves as a temporary root file system in RAM and allows the kernel to fully boot without having to mount any physical disks. Necessary modules can be part of the initrd. Kernel can be very small, but still support a large number of possible hardware configurations. After the kernel is booted, the root file system is pivoted (via pivot_root). Then the initrd root file system is unmounted and the real root file system is mounted.
Kernel Initrd function allows to create a small Linux kernel drivers compiled as loadable modules. These loadable modules allows kernel To access disks and the file system To access the drivers Root file system is a file system on a disk. Initrd function provides bootstrapping to gain access to the disk and mount the real root file system. If we target without a hard disk, the initrd can be the final root file system, or the final root file system can be mounted via the Network File System (NFS).
Init  After the kernel is booted and initialized, the kernel starts the first user space application. Init is the first program invoked that is compiled with the standard C library. Before this stage, no standard C application have been executed. In a desktop Linux system, the first application started is commonly /sbin/init. But it need not be. Sometimes embedded systems require the extensive initialization provided by init (as configured through /etc/inittab). We can invoke simple shell script that starts the necessary embedded applications.
Lower level booting steps The Motherboard BIOS Triggers the Video Display Card BIOS Initialization Motherboard BIOS Initializes Itself SCSI Controller BIOS Initializes Hardware Summary OS/2 BootManager Menu Lilo is started The Linux Kernel Initializes Processor, Console, and Memory Initialization PCI Bus Initialization Network Initialization The Kernel Idle Thread (Process 0) is Started Device Driver Initialization Generic Parallel Port Initialization Character Device Initializations Block Device Initializations SCSI Bus Initialization Initialization of Kernel Support for Point-to-Point Protocol Examination of Fixed Disk Arrangement Init Program (Process 1) Startup The Bash Shell is Started
Summary  Linux boot process is highly flexible Supports a huge number of processors and hardware platforms. Before, the loadlin (Linux boot loader that runs under DOS or Microsoft Windows) provided a simple way to boot Linux without any frills. The LILO boot loader expanded the boot capabilities, but lacked any file system awareness. The latest generation boot loader ( GRUB) permits Linux to boot from a range of file systems.

More Related Content

What's hot (20)

PPT
linux device driver
Rahul Batra
 
PPTX
Linux Initialization Process (1)
shimosawa
 
PDF
Booting Android: bootloaders, fastboot and boot images
Chris Simmonds
 
PDF
I2c drivers
pradeep_tewani
 
PDF
Kernel init
gowell
 
PPTX
Linux Kernel MMC Storage driver Overview
RajKumar Rampelli
 
PDF
Uboot startup sequence
Houcheng Lin
 
PDF
Embedded Linux BSP Training (Intro)
RuggedBoardGroup
 
PPTX
Linux device drivers
Abhishek Sagar
 
PDF
Embedded Linux Kernel - Build your custom kernel
Emertxe Information Technologies Pvt Ltd
 
PPTX
Linux I2C
KaidenYu
 
PPT
U boot porting guide for SoC
Macpaul Lin
 
PDF
Spi drivers
pradeep_tewani
 
PDF
Linux dma engine
pradeep_tewani
 
PDF
Kernel Module Programming
Saurabh Bangad
 
PDF
Bootloaders
Anil Kumar Pugalia
 
PPTX
Linux Kernel Booting Process (2) - For NLKB
shimosawa
 
PDF
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Adrian Huang
 
PDF
USB Drivers
Anil Kumar Pugalia
 
linux device driver
Rahul Batra
 
Linux Initialization Process (1)
shimosawa
 
Booting Android: bootloaders, fastboot and boot images
Chris Simmonds
 
I2c drivers
pradeep_tewani
 
Kernel init
gowell
 
Linux Kernel MMC Storage driver Overview
RajKumar Rampelli
 
Uboot startup sequence
Houcheng Lin
 
Embedded Linux BSP Training (Intro)
RuggedBoardGroup
 
Linux device drivers
Abhishek Sagar
 
Embedded Linux Kernel - Build your custom kernel
Emertxe Information Technologies Pvt Ltd
 
Linux I2C
KaidenYu
 
U boot porting guide for SoC
Macpaul Lin
 
Spi drivers
pradeep_tewani
 
Linux dma engine
pradeep_tewani
 
Kernel Module Programming
Saurabh Bangad
 
Bootloaders
Anil Kumar Pugalia
 
Linux Kernel Booting Process (2) - For NLKB
shimosawa
 
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Adrian Huang
 
USB Drivers
Anil Kumar Pugalia
 

Viewers also liked (20)

PPTX
Linux booting process!!
sourav verma
 
PPTX
Linux booting process
Prashant Hegde
 
PPTX
Linux booting Process
Gaurav Sharma
 
PPT
Linux booting procedure
Dhaval Kaneria
 
PPTX
booting steps of a computer
Anusha Babooa
 
PPT
Linux installation and booting process
Siddharth Jain
 
ODP
Comparison between grub-legacy ,lilo and grub -2
iamumr
 
PPTX
file system in operating system
tittuajay
 
PPT
File system
Harleen Johal
 
PDF
Understanding The Boot Process
Dom Cimafranca
 
PDF
Top 100 Linux Interview Questions and Answers 2014
iimjobs and hirist
 
PPTX
An Insight into the Linux Booting Process
Hardeep Bhurji
 
PPTX
Git and GitFlow branching model
Pavlo Hodysh
 
PDF
Introduction to the Linux ecosystem
Thibauld Favre
 
PPT
Unix nim-presentation
Rajeev Ghosh
 
PPTX
Git and Gerrit Code Review - Tech Talk - 2010_09_23
msohn
 
PDF
021413 aix trends_jay_kruemcke
Jay Kruemcke
 
PPTX
Grub의 이해
Chulgyu Shin
 
PPTX
Linux startup
Amin Hashemi
 
DOCX
6 stages of linux boot process
Teja Bheemanapally
 
Linux booting process!!
sourav verma
 
Linux booting process
Prashant Hegde
 
Linux booting Process
Gaurav Sharma
 
Linux booting procedure
Dhaval Kaneria
 
booting steps of a computer
Anusha Babooa
 
Linux installation and booting process
Siddharth Jain
 
Comparison between grub-legacy ,lilo and grub -2
iamumr
 
file system in operating system
tittuajay
 
File system
Harleen Johal
 
Understanding The Boot Process
Dom Cimafranca
 
Top 100 Linux Interview Questions and Answers 2014
iimjobs and hirist
 
An Insight into the Linux Booting Process
Hardeep Bhurji
 
Git and GitFlow branching model
Pavlo Hodysh
 
Introduction to the Linux ecosystem
Thibauld Favre
 
Unix nim-presentation
Rajeev Ghosh
 
Git and Gerrit Code Review - Tech Talk - 2010_09_23
msohn
 
021413 aix trends_jay_kruemcke
Jay Kruemcke
 
Grub의 이해
Chulgyu Shin
 
Linux startup
Amin Hashemi
 
6 stages of linux boot process
Teja Bheemanapally
 
Ad

Similar to Linux Booting Steps (20)

PPTX
Bootloader and bootloading
Arpita Gupta
 
PDF
Grub2 Booting Process
Mike Wang
 
PPTX
Linux booting sequence
kuldeep singh shishodia
 
ODP
Linux boot process
brusnigin
 
PPT
Linux Booting Process
Rishabh5121993
 
PPT
Linux Booting Procedure system and networking.ppt
ubaidullah75790
 
PPTX
Linux boot process
Chandrashekar B S
 
PPTX
introduction to computer Linux essential.pptx
musomicatherine
 
PPT
101 1.2 boot the system
Acácio Oliveira
 
PPTX
Order of boot process in Linux
Siddhesh Palkar
 
PPTX
Linux booting process - Linux System Administration
Sreenatha Reddy K R
 
PPT
How to build and load linux to embedded system
Игорь Медведев
 
PPT
Ch04 system administration
Raja Waseem Akhtar
 
PPTX
Boot process
Salman Memon
 
DOCX
6 stages of linux boot process
Hari Shankar
 
DOC
6 stages of linux boot process
sagarpdalvi
 
PDF
Linux boot process – explained
LinuxConcept
 
PPTX
System Booting Process overview
RajKumar Rampelli
 
PPTX
linux boot process ,kernal and file system
pethkarakash3898
 
Bootloader and bootloading
Arpita Gupta
 
Grub2 Booting Process
Mike Wang
 
Linux booting sequence
kuldeep singh shishodia
 
Linux boot process
brusnigin
 
Linux Booting Process
Rishabh5121993
 
Linux Booting Procedure system and networking.ppt
ubaidullah75790
 
Linux boot process
Chandrashekar B S
 
introduction to computer Linux essential.pptx
musomicatherine
 
101 1.2 boot the system
Acácio Oliveira
 
Order of boot process in Linux
Siddhesh Palkar
 
Linux booting process - Linux System Administration
Sreenatha Reddy K R
 
How to build and load linux to embedded system
Игорь Медведев
 
Ch04 system administration
Raja Waseem Akhtar
 
Boot process
Salman Memon
 
6 stages of linux boot process
Hari Shankar
 
6 stages of linux boot process
sagarpdalvi
 
Linux boot process – explained
LinuxConcept
 
System Booting Process overview
RajKumar Rampelli
 
linux boot process ,kernal and file system
pethkarakash3898
 
Ad

Linux Booting Steps

  • 1. Linux Booting Steps Presented By- Anando Kumar Paul
  • 2. Introduction Overview System startup Stage 1 boot loader Stage 2 boot loader Kernel Init
  • 3. Overview Processor executes code at a well known location i.e. Basic Input / Output System (BIOS). BIOS stored in Flash memory on the mother board. CPU invokes the reset vector to start a program at a known address in flash/ROM. BIOS determines candidates for boot. First Stage Boot Loader is loaded into RAM and executed when a boot device is found. Continue…
  • 4. Overview First stage Boot Loader is less than 512 bytes in length (single sector), and loads the second-stage boot loader. A splash screen is commonly displayed at the time of when the second-stage boot loader is in RAM. Linux and initial RAM disk (temporary file system) are loaded into memory. After completing image loading, the second-stage boot loader passes control to the kernel image. Now kernel is decompressed and initialized. Continue…
  • 5. Overview After initialization second-stage boot loader checks the system hardware enumerates the attached hardware devices Then mounts the root device loads the necessary kernel modules When complete, the first user-space program (init) starts, and high level system initialization is performed.
  • 6. System Startup Depends on the Linux hardware. A bootstrap environment is used when the system is powered on or reset. e.g. U-Boot, RedBoot and MicroMonitor from Lucent. Embedded platforms are commonly shipped with a boot monitor, which resides in special region on flash memory on the target hardware. Download Linux kernel image into flash memory and subsequently execute it. Have the ability to store and boot a Linux image and cover both the first and second stage boot loader.
  • 7. System Startup Linux booting begins in the BIOS at address 0xFFFF0. STEP 1 : Power-on self test (POST). To perform a check of the hardware. STEP 2 : Local device enumeration and initialization. Uses of BIOS functions : First parts: POST code Second part Runtime services After completion of POST, it is flushed from memory but the BIOS runtime services remain and are available to the target operation system.
  • 8. System Startup BIOS runtime searches for devices that are both active and bootable in the order of preference defined by the complementary metal ozide semiconductore (CMOS) settings. Boot devices Floppy Disk CD-ROM A partition on a Hard disk A device on the network USB flash memory stick Linux is booted using boot loader which resides in Master Boot Record (MBR), located in the first sector on the disk (sector 1 of cylinder 0 head 0)‏ After MBR loaded into RAM, BIOS yields control to it.
  • 9. Stage – 1 Boot Loader The primary boot loader which resides in MBR. 512-byte image containing both program code and small partition table.
  • 10. First 446 bytes are the primary boot loader contains both executable code and error message text. Next 64 bytes are the partition table contains a record for each of four partitions (1b bytes each). MBR ends with 2 bytes that are defined as magic number (0xAA55). Magic number serves as a validation check of MBR. Uses : Find and load the secondary boot loader (stage 2). It does this by looking through the partition table for an active partition. It scans remaining partitions to ensure that they are all inactive when it finds an active operation. The active partition’s boot record is read from the device into RAM and executed, when this is verified. Stage – 1 Boot Loader
  • 11. Stage 2 Boot Loader Also known as kernel loader. To load the Linux kernel and optional initial RAM disk. The first stage and second stage boot loaders combined are called LInux Loader (LILO) or Grand Unified Bootloader (GRUB). LILO has some disadvantages that were corrected in GRUB. GRUB features Linux file system knowledge. Can load a Linux kernel from an ext2 or ext3 file system instead of using raw sectors on the disk as LILO. Converts two stage boot loader to three stage boot loader. Stage 1 : (MBR) boots a stage 1.5 boot loader that understands the particular file system containing the Linux kernel image.
  • 12. Stage 2 Boot Loader GRUB features Converts two stage boot loader to three stage boot loader. Stage 1 : (MBR) boots a stage 1.5 boot loader that understands the particular file system containing the Linux kernel image. “ Reiserfs_stagel_5” to load from reiser journaling file system or “e2fs_stagel_5” to load from an ext2 or ext3 file system. When the stage 1.5 boot loader is loaded and running then the stage 2 boot loader can be loaded. Stage 2 : GRUB can display a list of available kernels( defined in /etc/grub.conf. wit the soft links from /etc/grub/menu.lst and /etc/grub.cons). Can select a kernel and amend it with additional kernel parameters. Can use command line shell for greater manual control over the boot process. This stage can consult with the file system and the default kernel image and initrd image are loaded into memory. With this images ready boot loader invokes the kernel image.
  • 13. Kernel Kernel stage begins with the kernel image in the memory and control given from stage 2 boot loader. It’s a compressed kernel image. E.g. zImage (<512KB), bzImage(>512KB). A routine does some minimal amount of hardware setup and then decompresses the kernel contained within the kernel image and place it into high memory. The routine moves it into memory and notes for later use if an initial RAM disk is present. Calls the kernel and the kernel boot begins. bzImage is invoked and begin at ./arch/i386/boot/head.S in the start assembly routine. Does hardware support and invokes the startup_32 routine in ./arch/i386/boot/compressed/head.S. This routine sets up a basic environment (stack, etc.) and clears the Block Started by Symbol (BSS). Kernel then decompressed through a call to a C function called decompressed_kernel ( located in ./arch/i386/boot/compresed/misc.c ). Another startup_32 function is called which is in ./arch/i386/kernel/head.S.
  • 14. Startup_32 function (also called the swapper or process 0), the page tables are initialized and memory paging is enabled. CPU type is detected along with optional floating-point unit (FPU) and stored away for later use. start_kernel function invoked (init/main.c), which takes to the non-architecture specific Linux kernel. start_kernel, in essence, the main function for the Linux kernel. Kernel
  • 16. Kernel “ start_kernel” function List of initialization functions are called to set up interrupts Performs further memory configuration. Load the initial RAM disk. “ kernel_thread” function (in arch/i386/kernel/process.c)‏ Start init function, which is the first user space process. Finally, the idle task is started and the scheduler can now take control(after the call to cpu_idle). The pre-emptive scheduler periodically takes control to provide multitasking with interrupts enabled.
  • 17. Kernel Kernel booting The initial RAM disk (initrd) is copied into RAM and mounted. Initrd serves as a temporary root file system in RAM and allows the kernel to fully boot without having to mount any physical disks. Necessary modules can be part of the initrd. Kernel can be very small, but still support a large number of possible hardware configurations. After the kernel is booted, the root file system is pivoted (via pivot_root). Then the initrd root file system is unmounted and the real root file system is mounted.
  • 18. Kernel Initrd function allows to create a small Linux kernel drivers compiled as loadable modules. These loadable modules allows kernel To access disks and the file system To access the drivers Root file system is a file system on a disk. Initrd function provides bootstrapping to gain access to the disk and mount the real root file system. If we target without a hard disk, the initrd can be the final root file system, or the final root file system can be mounted via the Network File System (NFS).
  • 19. Init After the kernel is booted and initialized, the kernel starts the first user space application. Init is the first program invoked that is compiled with the standard C library. Before this stage, no standard C application have been executed. In a desktop Linux system, the first application started is commonly /sbin/init. But it need not be. Sometimes embedded systems require the extensive initialization provided by init (as configured through /etc/inittab). We can invoke simple shell script that starts the necessary embedded applications.
  • 20. Lower level booting steps The Motherboard BIOS Triggers the Video Display Card BIOS Initialization Motherboard BIOS Initializes Itself SCSI Controller BIOS Initializes Hardware Summary OS/2 BootManager Menu Lilo is started The Linux Kernel Initializes Processor, Console, and Memory Initialization PCI Bus Initialization Network Initialization The Kernel Idle Thread (Process 0) is Started Device Driver Initialization Generic Parallel Port Initialization Character Device Initializations Block Device Initializations SCSI Bus Initialization Initialization of Kernel Support for Point-to-Point Protocol Examination of Fixed Disk Arrangement Init Program (Process 1) Startup The Bash Shell is Started
  • 21. Summary Linux boot process is highly flexible Supports a huge number of processors and hardware platforms. Before, the loadlin (Linux boot loader that runs under DOS or Microsoft Windows) provided a simple way to boot Linux without any frills. The LILO boot loader expanded the boot capabilities, but lacked any file system awareness. The latest generation boot loader ( GRUB) permits Linux to boot from a range of file systems.