pc bootup l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
PC bootup PowerPoint Presentation
Download Presentation
PC bootup

Loading in 2 Seconds...

play fullscreen
1 / 30

PC bootup - PowerPoint PPT Presentation


  • 300 Views
  • Uploaded on

PC bootup. Presented by: Rahul Garg (2003CS10183) Rajat Sahni (2003CS10184) Varun Gulshan(2003CS10191). From power on to Kernel load. PC firmware or BIOS. bootSect.S / Bootloader. Boot loader to kernel. Memory Map at Power up. FREE SPACE. 0x100000. MAPPED TO ROM. 0xA0000.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'PC bootup' - Olivia


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
pc bootup

PC bootup

Presented by: Rahul Garg (2003CS10183) Rajat Sahni (2003CS10184) Varun Gulshan(2003CS10191)

from power on to kernel load
From power on to Kernel load
  • PC firmware or BIOS.
  • bootSect.S / Bootloader.
  • Boot loader to kernel.
memory map at power up
Memory Map at Power up

FREE SPACE

0x100000

MAPPED TO

ROM

0xA0000

FREE SPACE

rom shadowing
ROM shadowing
  • The address space occupied by BIOS Roms is not available as useful RAM.
  • BIOS can make use of this RAM to shadow its ROM.
  • Write protects this shadowed RAM, disables ROM.
start up sequence
Start up Sequence
  • CS:IP = 0xf000:fff0.
  • Starts in real mode.
    • 16 bit mode.
    • IP = 16 bit offset
    • CS = Segment offset in 16 byte units.
    • i.e PC = 16*CS+IP
    • Max: 1MB of address space.
    • A20 pain from the past.
start up sequence6
Start up Sequence
  • POST(Power on self test)
  • Looks for video card and executes its BIOS.
  • Looks for other option ROMS e.g IDE disk.
  • Does more system inventory e.g COM ports, setting hard disk params.
  • Plug and play support.
  • Sets up IDT and the interrupt service routines.
bios contd
BIOS contd…
  • Looks for bootable media.
  • Loads Boot sector(512 bytes) of the media at 0x7c00 .
  • Jumps to CS:IP = 0000:7c00 with DL=drive id of bootable drive.
  • BIOS data area from 0x0000 to 0x7c00. (Contains IDT,ISR’s and data).
bios system calls
BIOS system calls
  • BIOS provides low level I/O routines through interrupts.
  • Main services are:
    • INT 15h: Get memory map.
    • INT 13h: Disk I/O interrupts.
    • INT 19h: Bootstrap loader.
memory map at this stage
Memory Map at this stage

0x00100000 (1MB)

BIOS ROM

VGA

0xA0000 (640KB)

FREE

SPACE

BOOT

SECTOR

0x7C00

BIOS DATA

0x0000

structure of mbr
Structure of MBR
  • MBR: 512 bytes
    • 0-62 bytes : BIOS Parameter Block (BPB)
    • 63-445 bytes: Bootsect.S
    • 446-510 bytes: Partition table
    • 511-512 bytes: Boot signature 0xaa55
flow diagram
Flow Diagram

BIOS

Booting with

bootloader

Stage 1

Bootsect.S

Stage 2

Setup.S

Part of

Kernel

image

Head.S

Jumps to init

role of bootsect s
Role of Bootsect.S
  • Moves itself to 0x90000
  • Get disk parameters (passed by BIOS) and sets up stack
  • Loads setup.S right after itself (0x90200)
  • Loads compressed kernel image at 0x100000 (1 MB)
  • Jumps to setup.S
how kernel starts
How ‘kernel’ starts?
  • Control starts in setup.S in real mode
  • Copies system data (Memory maps, drive information, hardware support, APM support) into appropriate memory locations through BIOS calls
  • Switches to protected mode
  • Jumps to head.S at 0x100000 (1 MB)
how head s calls init
How head.S calls init?
  • Gunzips kernel image
  • Enables paging, check CPU type.
  • Get kernel params from memory
  • Start_kernel() finally which calls init !
memory map during booting procedure
Memory Map during booting procedure

Uncompressed

Kernel

image

Compressed kernel image

Head.S

1 MB

setup.S

Bootsect.S

0x90000

Bootsect.S

0x7c00

Bios Data

booting linux kernel using bootloader
Booting linux kernel using bootloader
  • Bootloader resides in the MBR instead of bootsect.s
  • Arranges memory layout same as bootsect.S (in case of linux kernel)
  • Loads kernel from filesystem
  • Pass appropiate parameters (e.g. ramdisk_image, cmd_line_ptr) to the kernel
  • Jumps to setup.S (with state same as achieved via bootsect.S)
biblical version grub
Biblical version : Grub

In the beginning, there was GRUB

And GRUB loaded the kernel

And kernel begat init

And init begat rc

And rc begat network and httpd and getty, And getty begat login, and login begat shell and then there was light…..

slide18
GRUB
  • GRUB: multistage bootloader due to large size
    • Stage 1 (Loaded from MBR)
    • Stage 1.5 (Optional, gets stage 2 from file system)
    • Stage 2
  • BIOS passes the drive ID to bootloader through DL register.
  • Stage 1 loads and jumps to start.S of stage 1.5/2 at address 0x8000.
grub stage 2
GRUB stage 2
  • Start.S loads stage2 at address 0x8200
  • Start.S then jumps to asm.S
  • asm.S jumps to the C file stage2.c and also provides helper functions to get system information from bios.
  • Many switches from real mode to protected mode and back are required to accomplish all this.
multiboot
Multiboot
  • GRUB can also boot multiboot conforming kernels (e.g. GNU Mach, oskit) .
  • Multiboot Specification : Interface between bootloader and kernel image so that any compliant loader can load any compliant kernel.
  • Three main aspects:
    • OS image format
    • Machine state
    • Boot Information Format
os image format
OS Image format
  • Ordinary 32 bit executable, but may be loaded at non default load address.
  • Contains multiboot header
    • load address
    • Entry point
    • Parameters requested
    • Preferred graphics mode
machine state
Machine State
  • Particular values are required to be loaded into the registers like
    • Pointer to boot info structure (EBX)
    • Other register values
      • EAX: contains multiboot Magic Value
      • Enable A20 Gate
      • Set EFLAGS, segment register
    • OS image must define the undefined registers
      • ESP, GDTR, IDTR
boot information structure
Boot Information Structure
  • Contains the parameters that kernel requested through the header.
  • Available Memory and memory map
  • Boot Device
  • Cmdline Parameters passed to kernel
  • Other important info (apparently not so important that we list them out!)
booting a messy procedure
Booting: A messy procedure !
  • Booting in real mode to maintain backward compatibility.
  • Frequent switches between real mode and protected mode
  • Bootloader code becomes messy and involves a lot of hackwork
  • BIOS : 25 yrs old
  • Solution : Extensible Firmware Interface
efi concept
EFI : Concept

EFI Abstracts out hardware for OS loaders

efi overview
EFI : Overview
  • EFI specification defines a set of API’s and data structures
    • EFI device drivers
    • EFI diagnostics and system utilities
    • EFI shell
    • OS loaders
    • OS
booting in efi environment
Booting in EFI Environment

OS Loader is a special ELF binary which calls ExitBootServices()

which transfers control to the OS. Elilo is an example of an EFI

Compliant boot loader which can load linux kernel.

loading linux kernel using elilo
Loading Linux Kernel using ELILO

EFI

  • EFI initializes system directly in protected mode
  • Kernel loaded using EFI calls
  • ExitBootServices() to transfer control to kernel

EFI Boot Mgr

ELILO

Load Kernel

Collect Boot

Params

Jump to

kernel

Start_kernel

init

references
References
  • Linux HOWTOs (www.tldp.org)
  • Grub documentation and source code
  • www.bioscentral.com
  • www.linuxjournal.com
  • www.kernelthread.com
  • www.intel.com/technology/efi
  • EFI Specification