Sie sind auf Seite 1von 4

------------------------Booting and Shutting Down

------------------------Topics:
======
* Booting process
* Bootstrap loaders
* Rule levels
* Startup scripts
* Shutdown and reboot
Concepts:
=========
* Understanding and learning what can go wrong
* Be aware of hardware / config issues
Note: It is possible there exists inherent problems w/ OS or HW
Subsystems Involved in Booting
==============================
* ROM Boot Codes (BIOS)
- Basic Input Output System
- Smallest piece of program that runs
- Read Only Memory
- Runs first
- Content in the ROM is the called the BIOS
* Master Boot Record (MBR)-Knows where Bootloader is located
* Bootloader Knows where the Kernel is located
* Kernel
- Linux, NT, XNU, Darwin, etc.
* Hardware detection and configuration
* Creation of system processes
* Multiuser
Boot Sequence (see slide 5)
=============
* CPU in Real Mode
- BIOS Initialization
- MBR
- Boot Loader
- Early Kernel Initialization
* CPU in Protected Mode
- Full Kernel Initialization
- First User-mode process
BIOS Initialization
===================
* Load CMOS Settings
- Date/time, capabilities, power settings, etc. Once
Loaded BIOS knows HW config, register, ect..
* Initialize registers and power management
* Power On Self Test (POST)
- Proper functioning
* Display system settings (on key press)
* Activate other BIOSes
- Disk Interface

- Graphics cards
- NIC (Network Interface Cards)
* Find boot device
* Load and run MBR
MBR Structure (See slide 7)
=============
* BIOS has stopped running at this point
* CHS = Cylinder/Head/Sector addresses
* LBA = Logical Block Address for newer disk drives ie SSD
* Sector 0 is where MBR lives on hard disk
* Fits within 512 byte disk sector size
===
* 4 primary partitions
Bootloader: GRUB (Purpose: Get Kernel Loaded)
================
* Stage 1 (stored in MBR or boot sector)
- Initialize the system briefly
- Detect the geometry and the accessing mode of the loading drive
- Load the first sector of Stage 2
- Jump to the starting address of the Stage 2
* Stage 1.5 (stored in sectors of MBR track)
- One version for each filesystem
- Loads stage 2 from filesystem
* Stage 2 (stored in filesystem)
- Display menu of OS choices
- Boot splash screen
- Loads selected OS kernel
GRUB Installation
=================
* At OS Install Time
- Most install GRUB
- LILO, syslinux, etc
* Linux install
- grub-install /dev/hda
* Native install
- Boot with CD and run grub
- root (hd0,0)
- setup (hd0)
- quit
Grub Boot
=========
* Automatically boots default OS after timeout
* Key sequences bring up
- Menu of boot options (described in menu.lst)
- Edit kernel options (runlevel, others)
- GRUB command shell
* A boot prompt password may be required before edit/shell access granted
NOTE: Can bypass OS security by specifying kernel options or accessing files
from GRUB shell
Booting with GRUB
=================
* Direct Boot
- Specify OS kernel image to load

* Chainloading
- Specify another booloader to load
- Chainload NTLDR for windows
GRUB Naming Conventions
=======================
* GRUB uses BIOS hard disk numbers
- OS may not be the same
Kernel
======
1. GRUB loads kernel file into memory
- /boot/vmlinux-VERSION
2. Kernel Uncompresses self and begins running
3. Sets up interrupts and virtual memory
4. Loads initial RAMdisk into memory
- /boot/initrd.img-VERSION
5. Kernel uncompresses initrd and mounts as /sysroot
6. Kernel Loads drivers and modules from /sysroot
- SCSI and RAID, ext4 filesystem modules, etc.
7. Switches from real mode to protected mode
8. Creates kernel threads (ksoftirq, khelper, kblockd)
9. Starts init or systemd process Arguments
=========
* Numeric arguments
- Specify runlevel (0-6)
- single also specifies single user mode
* Root device options
- root= specifies root device
- ro, rw specify access type
* Console options
- console=ttyS1,9600 will use serial console (at 9600 baud)
* Hardware options
- Enable, disable specific hardware devices/features
Run Levels
==========
0 - Shutdown
1 - Single user
2 - Multi-user, no networking
3 - Multi-user, with networking
4 - Unused
5 - Multi-user, networking, and GUI
6 - Reboot rc
==
* Executed by init with runlevel as argument
* Starts and stops services for each runlevel
* /etc/rc#.d scripts
- Symlinks to actual scripts in /etc/init.d
- Stops services beginning with K*
- Starts services beginning with S*
- Run in numeric order
Single User Mode
================
* Kernel boots (with arg 1 or "single")
* System asks for root password

* Root shell starts


- No system processes
- No networking
* Only root filesystem mounted (read-only)
- Remount for RW* Why?
- Fix without user interference
- For example: disks, backups, security
RC
-

ASCII order to determine order of operation when running scripts

Useful Terms
============
* ROM, EPROM, PROM
* Real Mode vs CPU Protected Mode
- Real = full access to harware
- Protected Mode = Kernel handles access
* /etc/inittab

Das könnte Ihnen auch gefallen