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

Slides:



Advertisements
Similar presentations
Crafting a ‘boot time’ program How we can utilize some standard ‘real-mode’ routines that reside in the PC’s ROM-BIOS firmware.
Advertisements

Genesis: from raw hardware to processes System booting sequence: how does a machine come into life.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
Computer System Overview
Linux Booting Procedure
Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
Booting the Linux Kernel Dr. Michael L. Collard 1.
Hard-Disk Partitions Ref: Wikipedia. What and Why Disk partitioning –The creation of logical divisions upon a hard disk that allows one to apply operating.
Linux+ Guide to Linux Certification, Second Edition
BIOS (Basic Input Output Service) Contains system data used by the ROM BIOS service routines. Serves as a standardized communication interface between.
Startup. Major phases  BIOS  MBR program  Boot loader (Partition boot program )  OS’s kernel Loader  CPU always starts running at x’FFFF0’=1,048,560.
BACS 371 Computer Forensics
CS318 Project #2 Bootup Mechanism.
11/13/01CS-550 Presentation - Overview of Microsoft disk operating system. 1 An Overview of Microsoft Disk Operating System.
Linux+ Guide to Linux Certification, Second Edition Chapter 3 Linux Installation and Usage.
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
CS2422 Assembly Language & System Programming November 2, 2006.
1 Web Server Administration Chapter 3 Installing the Server.
System initialisation
The Boot process. Booting on a PC POST –Hardware test – may not run CPU ie fan not working CPU start-up –Jumps to fixed location to execute BIOS code.
OS Spring’03 Introduction Operating Systems Spring 2003.
OS Spring’04 Introduction Operating Systems Spring 2004.
Administrative Overview 6 Projects Design Review: Monday before 6:30pm Lab Friend Center 010 (“Fishbowl”)
Files & Partitions BACS 371 Computer Forensics. Data Hierarchy Computer Hard Disk Drive Partition File Physical File Logical File Cluster Sector Word.
Tel : 同济大学软件学院 UEFI 与固件程序设计.
hardware and operating systems basics.
Linux Booting Procedure
From UEFI Shell to Linux - UEFI Linux BootLoader Zhang Rui Software Engineer Sep 28 th 2011.
Linux Kernel 101 Sriram Sundararajan. Linux : /lee'nuhks/ or /li'nuks/, not /li:'nuhks/ n. /lee'nuhks/ or /li'nuks/, not /li:'nuhks/ n. The free Unix.
Laface Operating System Design Booting a PC to run a kernel from Low memory VGA display.
Guide to Linux Installation and Administration, 2e1 Chapter 2 Planning Your System.
Hardware Boot Sequence. Vocabulary BIOS = Basic Input Output System UEFI = Unified Extensible Firmware Interface POST= Power On Self Test BR = Boot Record.
Making MINT64OS Chan Seok Kang 2013/01/21. 2Computer Systems and Platforms Lab Content Introduction My Approach Encountered Problem Conclusion & Future.
Virtual Memory Review Goal: give illusion of a large memory Allow many processes to share single memory Strategy Break physical memory up into blocks (pages)
2003 Dominic Swayne1 Microsoft Disk Operating System and PC DOS CS-550-1: Operating Systems Fall 2003 Dominic Swayne.
SAPC Hardware Pentium CPU (or 486) 4M usable memory no hard disk; boot from floppy no keyboard or monitor or mouse COM2 serial port: used for console i/o.
Bootstrapping Steve Muckle Dave Eckhardt. Carnegie Mellon University1 Synchronization Project 3 checkpoint 1 Bboard post, web page Paging, COW optional.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
Chapter 8: Installing Linux The Complete Guide To Linux System Administration.
Genesis: From Raw Hardware to Processes Andy Wang Operating Systems COP 4610 / CGS 5765.
Linux Kernel Programming (LKP). LKP New sub-course New sub-course We will learn together We will learn together Evaluation of this part of course will.
Copyright © Genetic Computer School 2008 Computer Systems Architecture SA 8- 0 Lesson 8 Secondary Management.
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
Linux Boot Process on the Raspberry Pi 2 1 David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis,
File System Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki CS 314.
OS Boot Sequence and File System (implication to “Boot Sector Viruses”) Department of Computer Science Southern Illinois University Edwardsville Spring,
Chap. 4 ARM Boot Loader Internals. 2 S3C2500 ARM940T Core module ARM9TDMI CoreIC.
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
Overview A) Power on or reset B) 1st stage boot loader C) 2nd stage boot loader D) Operate system.
Introduction to Operating Systems Concepts
Introduction to Kernel
ES C263 Microprocessor Programming and Interfacing
GUID Partition Table Unified Extensible Firmware Interface (UEFI)
Chapter 12: File System Implementation
Anton Burtsev February, 2017
GUID Partition Table Unified Extensible Firmware Interface (UEFI)
Booting Up 15-Nov-18 boot.ppt.
SAPC Hardware Pentium CPU (or 486) 4M usable memory
Genesis: From Raw Hardware to Processes
SUSE Linux Enterprise Desktop Administration
Lecture Topics: 11/1 General Operating System Concepts Processes
Modern PC operating systems
Boot Process Mark Stanovich COP 5641 / CIS 4930.
GUID Partition Table Unified Extensible Firmware Interface (UEFI)
GUID Partition Table Unified Extensible Firmware Interface (UEFI)
Department of Computer Science
OS Boot Sequence and File System
OS Boot Sequence and File System
Interrupts and System Calls
Lecture 10 review Booting sequence in Brief
Presentation transcript:

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 MAPPED TO ROM FREE SPACE 0xA0000 0x100000

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 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 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… 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 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 BIOS DATA BOOT SECTOR BIOS ROM VGA 0x0000 0x (1MB) 0xA0000 (640KB) 0x7C00 FREE SPACE

Structure of MBR MBR: 512 bytes 0-62 bytes : BIOS Parameter Block (BPB) bytes: Bootsect.S bytes: Partition table bytes: Boot signature 0xaa55

Flow Diagram BIOS Bootsect.S Stage 1 Stage 2 Setup.S Head.S Jumps to init Booting with bootloader Part of Kernel image

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 0x (1 MB) Jumps to setup.S

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 0x (1 MB)

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 Bios Data Bootsect.S 0x7c00 Bootsect.S 0x90000 setup.S 1 MB Compressed kernel image Head.S Uncompressed Kernel image

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 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…..

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 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 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 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 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 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 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 Abstracts out hardware for OS loaders

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 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 EFI initializes system directly in protected mode Kernel loaded using EFI calls ExitBootServices() to transfer control to kernel EFI EFI Boot Mgr ELILOLoad Kernel Collect Boot Params Start_kernel Jump to kernel init

References Linux HOWTOs ( Grub documentation and source code EFI Specification