What is ‘bootstrapping’? The process of loading larger programs for execution than can fit within a single disk-sector.

Slides:



Advertisements
Similar presentations
The IDE/ATA Interface How can our mini-Operating System, executing in protected mode, access the hard disk?
Advertisements

Part IV: Memory Management
PC bootup Presented by: Rahul Garg (2003CS10183) Rajat Sahni (2003CS10184) Varun Gulshan(2003CS10191)
The ATA/IDE Interface Can we write a character-mode device driver for the hard disk?
Computer System Basics 2 Hard Drive Storage & File Partitions Computer Forensics BACS 371.
Linux Boot Loaders. ♦ Overview A boot loader is a small program that exists in the system and loads the operating system into the system’s memory at system.
Crafting a ‘boot time’ program How we can utilize some standard ‘real-mode’ routines that reside in the PC’s ROM-BIOS firmware.
Genesis: from raw hardware to processes System booting sequence: how does a machine come into life.
Linux+ Guide to Linux Certification Chapter Nine System Initialization.
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.
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 Installation LINUX INSTALLATION. Download LINUX Linux Installation To install Red Hat, you will need to download the ISO images (CD Images) of the.
The power supply performs a self-test. When all voltages and current levels are acceptable, the supply indicates that the power is stable and sends the.
ITEC 352 Lecture 27 Memory(4). Review Questions? Cache control –L1/L2  Main memory example –Formulas for hits.
What is ‘bootstrapping’? The process of loading larger programs for execution than can fit within a single disk-sector.
11/13/01CS-550 Presentation - Overview of Microsoft disk operating system. 1 An Overview of Microsoft Disk Operating System.
Lecture 10: The FAT, VFAT, and NTFS Filesystems 6/17/2003 CSCE 590 Summer 2003.
CS2422 Assembly Language & System Programming November 2, 2006.
What is ‘bootstrapping’? The process of loading larger programs for execution than can fit within a single disk-sector.
Memory Management Chapter 5.
Understanding POST and ROM-BIOS service functions Numerous low-level services are available to real-mode programs (include boot-loaders)
The IDE/ATA Interface How can our mini-Operating System, executing in protected mode, access the hard disk?
Operating Systems File systems
03/05/2008CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Files & Partitions BACS 371 Computer Forensics. Data Hierarchy Computer Hard Disk Drive Partition File Physical File Logical File Cluster Sector Word.
Tel : 同济大学软件学院 UEFI 与固件程序设计.
Chapter Sixteen Data Recovery and Fault Tolerance.
Linux Booting Procedure
Lecture 9: The FAT and VFAT Filesystems 6/16/2003 CSCE 590 Summer 2003.
Laface Operating System Design Booting a PC to run a kernel from Low memory VGA display.
Windows NTFS Introduction to Operating Systems: Module 15.
ENGI 3655 Lab Sessions 1Richard Khoury.  Linked Allocation ◦ Section Richard Khoury2.
1. Stage-1 Bootloader ENGI 3655 Lab Sessions Richard Khoury.
Chapter 3 Partitioning Drives using NTFS and FAT32 Prepared by: Khurram N. Shamsi.
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)
Chapter 4 Memory Management Virtual Memory.
Operating System Concepts and Techniques Lecture 18 Information management-2* FFS, UFS2, NTFS M. Naghibzadeh Reference M. Naghibzadeh, Operating System.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
Lecture 27. Extended Read Service used for extended read is int 13h/42h On Entry AH=42H DL=drive # DS:SI= far address of Disk address packet On Exit If.
GUID Partition Table Unified Extensible Firmware Interface (UEFI)
BOOT SECTOR, RDE AND FAT ANALYSIS AND STUDY. FLOPPY CONSTRUCTION 1.Write - Protect Notch. 2.Hub. 3.Shutter. 4.Outer Jacket. 5.Protective Woolen Film.
File system In computing, a file system is a method of storing and organizing computer files and the data they contain to make it easy to find and access.
Genesis: From Raw Hardware to Processes Andy Wang Operating Systems COP 4610 / CGS 5765.
Computer Forensics Hard Drive Format.
Copyright © Genetic Computer School 2008 Computer Systems Architecture SA 8- 0 Lesson 8 Secondary Management.
Digital Forensics Dr. Bhavani Thuraisingham The University of Texas at Dallas Lecture #8 File Systems September 22, 2008.
Memory Management Chapter 5 Advanced Operating System.
System initialization Unit objectives A.Outline steps necessary to boot a Linux system, configure LILO and GRUB boot loaders, and dual boot Linux with.
OS Boot Sequence and File System (implication to “Boot Sector Viruses”) Department of Computer Science Southern Illinois University Edwardsville Spring,
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Boot Engineering Extension Record (B.E.E.R.) By Curtis E. Stevens.
Chapter 9: Memory Management
GUID Partition Table Unified Extensible Firmware Interface (UEFI)
System Programming and administration
GUID Partition Table Unified Extensible Firmware Interface (UEFI)
Windows XP File Systems
Computer System Structures
CS-401 Computer Architecture Assembly Language Programming
Booting Up 15-Nov-18 boot.ppt.
Genesis: From Raw Hardware to Processes
Computer Architecture
So far… Text RO …. printf() RW link printf Linking, loading
Main Memory Background Swapping Contiguous Allocation Paging
Computer Architecture and the Fetch-Execute Cycle
Chapter 8: Memory management
GUID Partition Table Unified Extensible Firmware Interface (UEFI)
GUID Partition Table Unified Extensible Firmware Interface (UEFI)
Presentation transcript:

What is ‘bootstrapping’? The process of loading larger programs for execution than can fit within a single disk-sector

Serious Pentium explorations Experimenting with most Pentium features will require us to write larger-size demos than can fit in one disk-sector (512 bytes) So we need a way to load such programs into memory when no OS is yet running And we need a convenient way to place such programs onto a persistent storage medium so they can easily be accessed

Our classroom setup Our workstations’ hard disks have been ‘partitioned’ in way that provides a large unused storage-area for us to use freely But other portions of these hard disks are dedicated to supporting vital courseware for students who are taking other classes We have to understand how to access our ‘free’ area without disrupting anyone else

Fixed-Size ‘blocks’ All data-transfers to and from the hard disk are comprised of fixed-size blocks called ‘sectors’ (whose size equals 512 bytes) On modern hard disks, these sectors are identified by sector-numbers starting at 0 This scheme for addressing disk sectors is known as Logical Block Addressing (LBA) So the hard disk is just an array of sectors

Visualizing the hard disk ….. A large array of 512-byte disk sectors Disk storage-capacity (in bytes) = (total number of sectors) x (512 bytes/sector) Example: If disk-capacity is 160 GigaBytes, then the total number of disk-sectors can be found by division: ( bytes) / (512 bytes-per-sector) assuming that you have a pocket-calculator capable of displaying enough digits!

Disk Partitions The total storage-area of the hard disk is usually subdivided into non-overlapping regions called ‘disk partitions’ Partition #1Partition #2Partition #3 unused

Master Boot Record A small area at the beginning of the disk is dedicated to ‘managing’ the disk partitions In particular, sector number 0 is known as the Master Boot Record (very important!) MBR … partition #1

Format of the MBR The MBR is subdivided into three areas: –The boot loader program (e.g., GRUB) –The ‘partition table’ data-structure –The MBR signature (i.e., 0x55, 0xAA) signature (2 bytes) Partition Table (64 bytes) Boot Loader (446 bytes) 512 bytes

‘Reading’ the MBR To see the hard disk’s Partition Table, we must ‘read’ the entire Master Boot Record (We ignore the boot-loader and signature) But we will need to understand the format of the data stored in that Partition Table We first need to know how to devise code that can transfer the MBR (sector 0) from the hard-disk into a suitable memory-area

Partition Table Entries The MBR is an array containing four data- structures (called ‘partition table entries’): Starting sector ID-number Partition length (in sectors) STATUSSTATUS TYPETYPE 16 bytes Some fields contain ‘obsolete’ information

TYPE-ID Each partition-table entry has a TYPE-ID –TYPE-ID is 0x07 for a ‘Windows’ partition –TYPE-ID is 0x83 for our ‘Linux’ partition –TYPE-ID is 0x00 when the entry is ‘unused’ You can find a list of TYPE-ID numbers posted on the internet (see our website) Our disks have an extra ‘Linux’ partition that nobody else is using this semester

BIOS Disk Drive Services An assortment of disk-access functions is available under software Interrupt 0x13 Originally there were just six functions (to support IBM-PC floppy diskette systems) More functions were added when PC/XTs introduced the use of small Hard Disks Now, with huge hard disk capacities, there is a set of “Enhanced Disk Drive” services

Phoenix Technologies Ltd You can find online documentation for the BIOS EDD specification 3.0 (see website) We’ll use function 0x42 to read the MBR It requires initializing some fields in a small data-structure (the “Disk-Address Packet”) Then we load parameters in four registers (DS:SI = address of the DAP, DL = disk-ID and AH = 0x42) and execute ‘int $0x13’

EDD Disk-Address Packet reserved (=0x00) sector count reserved (=0x00) packet length segment-address of transfer-area offset-address of transfer area Logical Block Address of disk-sector (64-bits) Physical-address of memory transfer-area (64-bits) (in case segment:offset above is 0xFFFF:FFFF)

The MBR parameters # packet:.byte16, 0# packet-size = 16 bytes.byte1, 0# sector-count = 1 sector.word0x0200, 0x07C0# transfer-area’s address.quad0# MBR’s Logical Block Address # Here are assembly language statements that you could use to create a Disk Address Packet for reading the hard-disk’s Master Boot Record into the memory-area immediately following the 512-byte BOOT_LOCN area Our demo-program (named ‘finalpte.s’) uses statements similar to these.

How we search the Partition Table Our demo-program locates the final valid entry in the MBR’s Partition Table (and displays its contents in hexadecimal form) To do its search, it simply scans the table entries in backward order looking for the first entry that has a nonzero ‘type’ code

The instructions we can use mov$0x03FE, %si# point DS:SI to signature-word mov$4, %cx# setup count of table’s entries nxpte: sub$16, %si# back up to the previous entry cmpb$0x00, 4(%si)# entry’s type-code is defined? loopenxpte# no, examine the next entry jcxznopte# search fails if CX reached 0 # If we get here, then DS:SI is pointing to the final valid PT-entry jmpfound nopte:# We should never arrive here -- unless no valid partitions exist

In-class exercise Design a Disk-Address Packet that would allow you to read the contents of a single disk-sector which immediately follows the starting-sector of ‘/dev/sda4’ into the area of memory at physical address 0x10000 Install our test-program ‘greeting.b’ in that disk sector, by using the ‘dd’ command: $ dd if=greeting.b of=/dev/sda4 seek=1 Can you verify that this succeeded?