Class Note: - PowerPoint PPT Presentation

1 / 36
About This Presentation
Title:

Class Note:

Description:

http://www.wildbill.org/rose/spring07.cgi ... 1: Conversion to/preparation for single user mode. 2: Non-networked multiuser mode ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 37
Provided by: Yui7
Category:
Tags: class | note | red | rose | single

less

Transcript and Presenter's Notes

Title: Class Note:


1
Class Note
  • The Syllabus is available on-line at
    http//www.wildbill.org/rose

2
System Profiles
3
System Profiles
  • When a user logs in a system profile is
    established
  • Sets environment variables
  • I.e. PATH/bin/usr/bin
  • Sets aliass
  • I.e. alias rm rm i
  • alias cp cp I
  • alias cls clear

4
System Profiles
  • Various system-wide profiles
  • /etc/profile (bourne shell)
  • /etc/bashrc (bash shell)
  • /etc/tcshrc (c-shell)
  • User specific profiles (located in home dir)
  • /.profile
  • /.bashrc
  • /.tcshrc

5
Shell Scripts
  • A shell script is a group of commands, functions,
    variables, etc., that can be run from the shell
    prompt (command line)
  • Chapter 12 gives an overview of how shell scripts
    work and can be used
  • Automate system chores
  • Application startup
  • Even generate web pages
  • http//www.wildbill.org/rose/spring07.cgi
  • Those who attend Intro to UNIX should have a
    reasonable understanding of shell scripts.

6
Shell Scripts (/etc/init.d/)
  • Many of the startup scripts are located in the
    /etc/init.d directory
  • Know and understand symbolic links
  • A symbolic Link is where a file has one main
    name, but there's an extra entry in the file name
    table that refers any accesses back to the main
    name

7
Symbolic Links
  • Symbolic links are set up using the ln command
    with the -s option - so for exampleln -s
    filename1.txt filename2.txt

8
System Initialization
9
Overview
  • Sequence of booting Linux
  • Component description
  • Sequence of shutting down Linux
  • Conclusion

10
Booting Sequence
11
POST
  • The principal duties of the main BIOS during POST
    are as follows
  • verify the integrity of the BIOS code itself
  • determine the reason POST is being executed
  • find, size, and verify system main memory
  • discover, initialize, and catalog all system
    buses and devices
  • pass control to other specialized BIOSes (if and
    when required)
  • provide a user interface for systems
    configuration
  • identify, organize, and select which devices are
    available for booting
  • construct whatever system environment that is
    required by the target OS

12
Bootstrap loader
13
Bootstrap loader
  • In computing, booting is a bootstrapping process
    that starts operating systems when the user turns
    on a computer system.
  • A boot sequence is the set of operations the
    computer performs when it is switched on that
    load an operating system.
  • Locate and start boot loader program
  • ROM BIOS
  • Look for a boot sector
  • Boot sector
  • First sector of the disk
  • 0xAA55 at byte 0x1FE (510)
  • byte 510 (last two bytes of the sector)
  • Load boot sector into memory

14
Boot loader program
15
Boot loader
  • Load the operating system into its computer
    memory from its hard disk
  • Master Boot Record
  • Special reserved area
  • Beginning of the system disk
  • First stage boot loader
  • Load and run second stage boot loader
  • Second stage boot loader
  • Prompt to choose OS
  • Loads the kernel of the chosen OS

16
Boot loader
  • Two primary Boot loader programs for Linux
  • LILO (Linux Loader)
  • GRUB (Grand Unified Boot loader)

17
LILO
  • /etc/lilo.conf
  • Location of kernel
  • Disk partition to mount as root file system
  • Map installer
  • Read configuration file
  • Write boot loaders, OS info to hard disk

18
GRUB
  • Boot time shell
  • GRUB interactive command prompt
  • Run new configuration on the fly
  • Dynamic default configuration
  • Can use to boot other OS

19
GRUB
  • /boot/grub/grub.conf
  • general section
  • splashimage (hd0,0)/grub/splash.xpm.gz
  • default 0
  • timeout 30
  • password -md5 encoded-password
  • title Linux
  • root (hd0,0) kernel /vmlinuz ro root/dev/hda2

20
Compare LILO and GRUB
  • LILO
  • Traditional
  • Need to be reinstalled in the master boot record
    after replacing the kernel or changing the boot
    configuration
  • GRUB
  • Newer
  • Flexible
  • Interactive command prompt

21
Kernel Initialization
22
Kernel initialization
  • Checks system hardware
  • Identifies devices
  • Kernel
  • Makes hardware do what the programs want

23
Kernel Initialization
  • Probe essential devices
  • CPU, Console, Memory
  • Probe other hardware Subsystem
  • I/O buses, Network interfaces, Hard disks, CD-ROM
    drives, Floppy drives, Storage devices

24
Kernel Initialization
  • File System initialization
  • Logical volume manager subsystem
  • RAID
  • SCSI Devices
  • Hard disk partitions
  • Change configuration of kernel
  • /usr/src/linux/make menuconfig or xconfig
  • rdev
  • Boot loader parameter

25
Init program
26
Init
  • Location /sbin/init
  • Uses functions from libraries written in C
  • Checks and mounts file system
  • Starts up daemons to log system messages
  • Starts the getty processes that put the login
    prompts on your virtual terminals
  • Networking
  • Serves web page
  • Listen to the mouse

27
Inittab file
  • Location /etc/inittab
  • xxlevelsactionprocess
  • Xx
  • Label for the entry
  • Levels
  • Specific system operating mode
  • Predefined set of system processes

28
Run levels in init
  • 0 Halted system (ready for powering off)
  • 1 Conversion to/preparation for single user mode
  • 2 Non-networked multiuser mode
  • 3 Networked multiuser mode
  • 4 Networked multiuser mode with graphical login
  • 6 Reboot mode

29
Run levels in init
  • S,s Single user mode
  • U,u Init process re-execution (pseudo run level)
  • Q,q Force reread of configuration file (pseudo
    run level)
  • a,b,c On-demand process initialization pseudo
    run levels

30
Inittab file
  • Actions
  • wait Start the process and wait for it to finish
    before going onto the next entry.
  • once Start the process only if it is not already
    running (don't wait).
  • respawn Start the process (don't wait) and
    automatically re-start it if the process later
    dies.

31
Inittab file
  • bootwait Execute the process only at boot time,
    waiting for it to finish.
  • initdefault Specifies default run level.
  • ctrlaltdel Execute the action when the
    Ctrl-Alt-Del key sequence is detected.
  • power Several keywords are defined for various
    power failure-related events (see examples below)

32
Inittab
  • Program to interpret the initialization script
    bash
  • Script link to other scripts
  • Several scripts
  • Initialization script
  • Run-level script

33
Initialization script
  • Initialization script
  • (Red hat) /etc/rc.d/rc.sysinit
  • File system get checked and mounted
  • /etc/fstab
  • Clock set
  • Swap space enabled
  • Hostname

34
Shutting down sequence
  • shutdown -h/r (warning message)
  • Logins are blocked
  • All process are notified that the system is going
    down by signal SIGTERM
  • Process to exit cleanly
  • Signal the init process to change the run level
  • Default 1, -h flag 0, -r flag 6

35
Shutting down
  • unmount -a unmounts all the partitions listed in
    fstab
  • shutdown -F Force fsck on reboot
  • Journaling file system
  • saves a transaction log of file system changes
  • replay when the system is restarted

36
Acknowledge
  • Two new links at wildbill.org/rose
  • http//www.linuxforum.com/linux-introduction/ch04s
    02.html
  • http//linux.about.com/library/cmd/blcmdl8_shutdow
    n.htm
Write a Comment
User Comments (0)
About PowerShow.com