Sie sind auf Seite 1von 31

Booting

booting (booting up) is a bootstrapping process that starts

operating systems when the user turns on a computer system.


Boot sequence: The initial set of operations that the computer

performs when power is switched on .


Bootloader: typically loads the main operating system for the

computer.

Boot Sequence
Power is turned ON (It takes some time until it generates reliable

power after that it sends Power Good signal to processor) Processor always look to BIOS at the same place in the system BIOS ROM for the start of the BIOS boot program. This is normally location FFFF0h, right at the end of the system memory. BIOS performs POST BIOS looks for vide card etc for their built in BIOS program and runs it to initialize devices BIOS displays its start up screen BIOS performs some tests for RAM count and to check what kind of hardware is in the system. BIOS will also check logical devices such as LPT & COM If the BIOS supports the Plug and Play standard, it will detect and configure Plug and Play devices at this time and display a message on the screen for each one it finds. contd.

The BIOS will display a summary screen about your system's configuration. The BIOS begins the search for a drive to boot from.

If the first device that the system tries (floppy, hard disk, etc.) is not found, the BIOS will then try the next device in the boot sequence, and continue until it finds a bootable device. If it finds what it is looking for, the BIOS looks for boot information to start the operating system boot process. If it is searching a hard disk, it looks for a master boot record at cylinder 0, head 0, sector 1 (the first sector on the disk). The BIOS starts the process of booting the operating system, using the information in the boot sector. If no boot device at all can be found, the system will normally display an error message and then freeze up the system. This process is called a "cold boot" (since the machine was off, or cold, when it started). A "warm boot" is the same thing except it occurs when the machine is rebooted using {Ctrl}+{Alt}+{Delete} or similar. In this case the POST is skipped Rest of the process in O.S. dependent

CPU can only execute program code found in Read-Only


Memory (ROM) and Random Access Memory (RAM).
Modern operating systems and application program code

Bootloader:

and data are stored on nonvolatile data storage devices, such as hard disk drives.
When a computer is first powered on, it does not have an

operating system in ROM or RAM.


The computer must initially execute a small program stored

in ROM along with the bare minimum of data needed to access the nonvolatile devices from which the operating system programs and data are loaded into RAM .

Bootloader:

The small program that starts this sequence of loading into RAM,
is known as a bootstrap loader, bootstrap or boot loader

Boot loader program's only job is to load other data and programs
which are then executed from RAM .

The small program is most often not itself an operating system, but
only a second-stage boot loader, such as GRUB, BOOTMGR, LILO or NTLDR.

Bootloader:

It will then be able to load the operating system properly, and


finally transfer execution to it.

The Operating system will initialize itself, and may load device
drivers and other programs that are needed for the normal operation of the OS.

Many boot loaders (like GRUB, BOOTMGR, LILO, and NTLDR)


can be configured to give the user multiple booting choices.

These choices can include different operating systems (for dual or


multi-booting from different partitions or drives).

Salient features of GRUB


LILO does not understand file systems whereas GRUB

understands. The currently supported filesystem types are BSD FFS, DOS FAT16 and FAT32, Minix fs, Linux ext2fs, ReiserFS, JFS, XFS etc. GRUB supports both direct loading and chain loading, allowing you to use almost any operating system, most popular file systems, and almost any hard disk your BIOS recognize. GRUBs configuration file is read from the disk every time the system boots preventing you from having to write over the MBR every time you change the boot options. GRUB provides a true command based pre-OS environment on x86 m/c to provide maximum flexiblity GRUB supports logical block addressing mode, needed to access many IDE and all SCSI hard disks. Support automatic decompression . Can decompress files which were compressed by gzip. Support n/w booting, logical block address mode, remote terminals.

Anatomy of MBR (Master Boot Record)

Top view of Booting Linux

Booting sequence of linux


The kernel when it is loaded, finds init in sbin and executes it. When init starts it becomes the parent or grand parent of all the

processes that startup automatically on your linux system.


Init reads an initialization configuration script for the environment

which sets the path, start swapping, checks the file system, setting the clock, initializing serial port and so on and so on.
After deciding the default run level (run level 1 is single user

mode, run level 2 is multi user run level and so on) for your system init starts all of the background processes necessary for the system to run by looking in the appropriate rc directory for that run level.
After that it runs all kill scripts and then start scriptsso that all

services and applications are started correctly

Booting XP using NTLDR


NTLDR is located at the Boot Sector (The first sector of the

active partition). That is where NTLDR is located NTLDR will allow memory addressing, initiate the file system, read boot.ini and load the boot menu. NTLDR has to be in root of the active partition as do NTDETECT.COM, BOOT.INI, BOOTSECT.DOS (for multi OS booting) and NTBOOTD.SYS (if u have SCSI adopter) Once XP is selected from the boot menu, NTLDR will run NTDETECT.COM, BOOT.INI and BOOTSECT.DOS to get proper OS selected and loaded The system starts in 16 bit real mode and then moves to 32-bit protected mode. NTLDR will then load NTOSKRNL.EXE and HAL.DLL (effectively these 2 files are windows XP) NTLDR reads the registry, chooses a h/w profile and authorizes device drivers. At this point NTOSKRNL.EXE takes over. It starts WINLOGON.EXE that in turn starts LSASS.EXE.

A Modern Computer System

Computer-System Operation
I/O devices and the CPU can execute concurrently Each device controller is in charge of a particular device

type
Each device controller has a local buffer CPU moves data from/to main memory to/from local

buffers
I/O is from the device to local buffer of controller Device controller informs CPU that it has finished its

operation by causing an interrupt

Traps and Interrupts


Interrupts

An interrupt is a signal sent to the CPU, either from

Hardware or software.
Hardware may trigger an interrupt at any time by sending a

signal to CPU and S/W may trigger an interrupt by executing a special operations called System calls.
An Interrupt Service routine is provided for dealing with the

interrupt.

Common Functions of Interrupts


Interrupt transfers control to the interrupt service routine

generally, through the interrupt vector, which contains the addresses of all the service routines
Interrupt architecture must save the address of the interrupted

instruction
Incoming interrupts are disabled while another interrupt is

being processed to prevent a lost interrupt


An operating system is interrupt driven

Traps and Interrupts


Interrupts

When the CPU is interrupted it stops what it is doing and

immediately transfers execution to fixed location.


The fixed location usually contains the starting address

where the service routine for interrupt is located.


The interrupt service routine executes; on completion, CPU

resumes the interrupted computation.

Traps and Interrupts


Traps
Abnormal Condition detected by the CPU that usually is

indicative of an error. For example


Dividing by zero

Accessing memory that does not exist or for which the program has not access to.
Executing an instruction with an undefined opcode or trying to access a non existent I/O device.

Direct Memory Access Controller


Used for high-speed I/O devices able to transmit

information at close to memory speeds


Device controller transfers blocks of data from buffer

storage directly intervention

to

main

memory

without

CPU

While the DMA controller is busy in data transfer the CPU

is busy to perform other task.


Only one interrupt is generated per block, rather than the

one interrupt per byte

Storage Structure
Main memory only large storage media that the CPU can

access directly
Secondary storage extension of main memory that

provides large nonvolatile storage capacity e.g. magnetic disks.


Magnetic disks rigid metal or glass platters covered with

magnetic recording material


Disk surface is logically divided into tracks, which are

subdivided into sectors


The disk controller determines the logical interaction

between the device and the computer

Hardware Protection
Dual-Mode Operation I/O Protection Memory Protection CPU Protection

Dual-Mode Operation
Sharing system resources requires operating system to ensure

that an incorrect program or poorly behaving human cannot cause other programs to execute incorrectly

OS must provide hardware support to differentiate between

at least two modes of operations


1. User mode execution done on behalf of a user 2. Monitor mode (also kernel mode or system mode) execution done on behalf of operating system

Dual-Mode Operation (Cont.)


Mode bit added to computer hardware to indicate the current

mode: monitor (0) or user (1)


When an interrupt or fault occurs hardware switches to

monitor mode
Interrupt/fault

monitor set user mode

user

I/O Protection
To prevent users from performing illegal I/O, all I/O

instructions are defined to be privileged instructions.


Thus users can not issue I/O instruction directly, they must

do it through the OS.


Must ensure that a user program could never gain control of

the computer in monitor mode (I.e., a user program that, as part of its execution, stores a new address in the interrupt vector)

Use of A System Call to Perform I/O

Memory Protection
Must provide memory protection at least for the interrupt

vector and the interrupt service routines


In order to have memory protection, at a minimum add two

registers that determine the range of legal addresses a program may access:
Base register holds the smallest legal physical

memory address
Limit register contains the size of the range
Memory outside the defined range is protected

Use of A Base and Limit Register

Hardware Address Protection

Hardware Protection
When executing in monitor mode, the operating

system has unrestricted access to both monitor and users memory


The load instructions for the base and limit registers

are privileged instructions

CPU Protection
Timer interrupts computer after specified period to ensure

operating system maintains control


Timer is decremented every clock tick
When timer reaches the value 0, an interrupt occurs
Timer commonly used to implement time sharing Timer also used to compute the current time

Some GRUB commands


Geometry Root Boot Kernel Initrd Rootnoverify

Chainloader
Find Setup lock

Naming convention
(hd0,1) Here, `hd' means it is a hard disk drive. The first integer

`0' indicates the drive number, that is, the first hard disk, while the second integer, `1', indicates the partition number .
fd (floo[pydisk) cd (cd rom) fd0-> first floppy disk
(hd0,0)/vmlinuzThis specifies the file named `vmlinuz', found on

the first partition of the first hard disk

Das könnte Ihnen auch gefallen