Linux Booting - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Linux Booting

Description:

... performs various diagnostic tests to check memory and devices for their presence ... the booting procedure begins to run kernel code to initialize the ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 24
Provided by: itha9
Learn more at: http://www.ithaca.edu
Category:
Tags: booting | linux

less

Transcript and Presenter's Notes

Title: Linux Booting


1
Linux Booting
  • The booting procedure.
  • Logging in to the machine.
  • Control flow in the machine.

2
Linux Booting
  • The booting procedure.
  • Logging in to the machine.
  • Control flow in the machine.

3
The booting procedure.
  • Every computer has sequence of instructions that
    are executed when computer is powered up.
  • determined by the hardware designers
  • Every OS has a sequence of instructions that it
    executes prior to normal operation.

4
The booting procedure.
  • i386 machines incorporate the Basic Input/Output
    System (BIOS)
  • stored at a prespecified location in system ROM.
  • when computer started, begins executing BIOS code
  • BIOS code executes the Power-On Self Test (POST)
  • POST performs various diagnostic tests to check
    memory and devices for their presence and correct
    operation.
  • when POST is completed, machine ready to load and
    start OS.

5
The booting procedure.
  • The boot sector.
  • OS loaded from the systems boot disk.
  • i386 treats A as default disk if it contains a
    diskette.
  • Otherwise depends on how youve set the BIOS.

6
The booting procedure.
  • The boot disk
  • must contain a boot record at the disks first
    logical sector.
  • The boot record fits onto a single 512-byte disk
    sector (called the boot sector)
  • 0x000 0x002 lta jump instr to 0x0XXgt
  • 0x003 . Disk parameters (used by BIOS) program
  • 0x0XX 0x1fd Bootstrap program
  • 0x1fe 0x1ff 0xaa55 (the magic number for BIOS)

7
The booting procedure.
  • After POST BIOS copies the boot record from disk
    into memory
  • Bios then reads boot record parameters
  • Boot record contains parameters that describe
    disks physical layout
  • Parameters are stored in well-know locations in
    boot record
  • Parameters include number of tracks and number of
    sectors per track.

8
The booting procedure.
  • After parameters read BIOS branches to the first
    location in program
  • then immediately branches to location 0x0XX
  • the value XX for Linux is 3e
  • the value XX for MS-DOS is 1e
  • The small program at address 0x0XX loads a more
    sophisticated loader from other sectors on the
    disk
  • The sophisticated loader loads the OS

9
The booting procedure.
  • Disk partitioning
  • can have up to 4 primary partitions on one
    physical disk
  • each primary disk can have logical sub-partitions
  • each partition treated like a physical disk below
    the abstract machine that accesses the physical
    disk (eg, BIOS in MS-DOS)
  • if partition is bootable then its logical sector
    number 0 will be a boot sector.

10
The booting procedure.
  • Disk partitioning
  • when hardware is powered up goes to head 0, track
    0, sector 1 and begins executing code.
  • an unpartitioned disk has a jump instruction at
    head 0, track 0, sector 1 which jumps to location
    0x0XX and starts the execution of the boot
    program
  • in a partitioned disk, physical head 0, track 0,
    sector 1 (first logical disk sector) describes
    how hard disk is partitioned into logical disks.

11
The booting procedure.
  • A partitioned disk has a 446-byte bootstrap
    program starting at first byte in the sector.
  • next is a 65-byte partition table for the disk
  • Table contains the 4 partition entries, each of
    which describes the portion of the physical disk
    that is used for its partition (starting sector
    of the partition, ending sector, number of
    sectors, etc.)
  • last 2 bytes of partition sector contain a magic
    number, 0xaa55 to identify the partition sector.

12
Partitioned Disk
446-byte bootstrap program
4 partition entries, each describes the portion
of the physical disk used for its partition
65-byte partition table
2 bytes magic number, 0xaa55 for MS-DOS
13
The booting procedure.
  • Partitioning with different OSs
  • i386 can be booted with Linux from boot floppy.
  • contains a Linux boot program.
  • Can have different OS in different partitions
  • Windows handles by designating one partition as
    an active partition. System always boots from
    this partition.

14
The booting procedure.
  • Partitioning with different OSs
  • can have a special program, Linux Loader (LILO)
    in system boot record.
  • program allows user to choose at boot time which
    partition is to be the active partition.
  • LILO is loaded in the boot record so that BIOS
    runs it after the POST.

15
Starting the Kernel
  • machine is powered up
  • hardware fetch-decode-execute cycle begins.
  • called the hardware process
  • this is not a Linux process Linux has not yet
    started.
  • POST is completed
  • boot record read
  • loader places OS into primary memory
  • the booting procedure begins to run kernel code
    to initialize the computers hardware.

16
Starting the Kernel
  • Computer then starts kernel by setting supervisor
    mode and branching to main entry point in kernel.
  • main entry point is not a C program.
  • kernel initializes
  • trap table
  • interrupt handler
  • scheduler
  • clock
  • modules
  • etc.

17
Starting the Kernel
  • near end of kernel initialization start process
    manager
  • now ready for normal process abstraction
  • PM starts the initial process
  • initial process is first entry in kernels
    process descriptor table
  • referred to as process 0, task0, or INIT_TASK
  • initial process then creates first useful Linux
    process to run the init program
  • after init runs it executes an idle loop
  • only other duties of init is to use idle CPU
    time.runs when no other process wants CPU.

18
Starting the Kernel
  • init process initializes system
  • starts daemons
  • starts file manager
  • creates system console
  • runs other init programs from /etc, /bin and/or
    /sbin, and runs /etc/rc

19
Logging in to the machine
  • during initialization kernel creates one process
    on each communication port that can be used to
    support user logins
  • uses the getty program
  • getty
  • waits for a user to begin using the port
  • then runs login program
  • login expects user id on first line, passwd on
    next
  • login verifies user by looking in /etc/passwd
    file

20
Logging in to the machine
  • getty
  • /etc/passwd file. Each entry separated by colon
  • jbarreNcrYpt123334835John
    Barr/home/barr/bin/bash
  • jbarr account name
  • eNcrYpt123 encrypted password
  • 3348 and 35 user ID and group ID
  • John Barr real name
  • /home/barr users home directory
  • /bin/bash path to shell command preferred by
    user

21
Logging in to the machine
  • getty
  • once login verifies it changes current directory
    to users home directory
  • and executes the specified shell program
  • now user interacts directly with login process
    via shell.
  • user who logs in is using a process that was
    created when the machine was started
  • starting shell is complicated data and stack
    segments created etc.
  • data includes users environmental variables (eg,
    PATH)
  • when user logs off, return from shell call to the
    login process

22
Logging in to the machine
6
Serial Port A
Serial Port B
getty
Serial Port C
Serial Port Z
/etc/passwd
23
Control Flow
hardware process starts
Idle Proc
kernel
ISRs
Proc i
Proc j
program
hardware process
context switch
Write a Comment
User Comments (0)
About PowerShow.com