Advanced Unix - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Advanced Unix

Description:

Stored in the computer's ROM and described as firmware. Finds the hardware devices (diskette drives, CD-ROM ... title Linux Fedora-up (2.6.5-1.358) root (hd0,1) ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 19
Provided by: universit9
Learn more at: http://www.wildbill.org
Category:
Tags: advanced | fedora | unix

less

Transcript and Presenter's Notes

Title: Advanced Unix


1
Advanced Unix
  • Linux Kernel
  • December 1, 2005

2
Boot Process
3
Boot Process
  • The basic input/output system (BIOS) starts and
    checks for hardware devices.
  • Stored in the computers ROM and described as
    firmware.
  • Finds the hardware devices (diskette drives,
    CD-ROM drives, and hard drives) needed by the
    boot process.
  • Loads and initiates the boot program stored in
    the Master Boot Record (MBR, residing in the
    first sector of the device), and passes control
    to the boot program.

4
First Stage Boot Loader
  • Two boot loaders are available Linux Loader
    (lilo) and Grand Unified Bootloader (grub)
  • The first-stage boot loader
  • reads in the partition table and looks for the
    second-stage boot loader on the partition
    configured as bootable (/boot partition).
  • Launches the second stage boot loader.

5
Second Stage Boot Loader
  • Presents the user with different OS kernels it
    has been configured to boot.
  • Finds the kernel image in the /boot directory.
  • The kernel binary is named
  • /boot/vmlinuz-ltkernel-versiongt
  • Places the appropriate initial RAM disk image,
    called an initrd, into memory. The initrd is used
    by the kernel to load drivers necessary to boot
    the system.
  • Hands control to the kernel.

6
grub.conf
  • grub.conf generated by anaconda
  • Note that you do not have to rerun grub after
    making changes to this file
  • NOTICE You have a /boot partition. This
    means that
  • all kernel and initrd paths are
    relative to /boot/, eg.
  • root (hd0,1)
  • kernel /vmlinuz-version ro
    root/dev/hdb3
  • initrd /initrd-version.img
  • boot/dev/hdb
  • default0
  • timeout10
  • splashimage(hd0,1)/grub/splash.xpm.gz
  • title Linux Fedora (2.6.5-1.358smp)
  • root (hd0,1)
  • kernel /vmlinuz-2.6.5-1.358smp ro
    rootLABEL/ rhgb quiet
  • initrd /initrd-2.6.5-1.358smp.img
  • title Linux Fedora-up (2.6.5-1.358)
  • root (hd0,1)
  • kernel /vmlinuz-2.6.5-1.358 ro
    rootLABEL/ rhgb quiet

Specifies the default boot image will be the
first hard entry
Grub will wait for 10 seconds for input from the
user before continuing to boot.
The root partition is the second partition on the
first hard drive.
7
The Kernel
  • Initializes and configures the computers memory
    and configures hardware attached to the system
    (processors, I/O subsystems, and storage
    devices).
  • Decompresses and mounts initrd to load all
    necessary drivers.
  • Mounts the root file system in read-only mode and
    frees any unused memory.
  • Starts the init process by running /sbin/init.

8
Initialization Process
  • Init parses the /etc/inittab file to determine
    the specifics of what programs to run and at what
    level.
  • 0 used to halt the system. The system performs
    an init 0 command and the system is halted.
  • 1 Puts he system into single-user mode.
  • 2 Puts the system into a multiuser mode but does
    not support networking.
  • 3 Puts the system into the standard full
    multiuser mode but does not automatically start
    X.
  • 4 Unused.
  • 5 X11 Puts the system into standard multiuser
    mode with a graphical (X-based) login.

9
Inittab
  • id5initdefault
  • Tells the init program what run level to use
    after a reboot.
  • sisysinit/etc/rc.d/rc.sysinit
  • Tells the init program to run the rc.sysinit
    script.
  • Since the second field is empty, the script will
    run at boot time for all run levels.

10
rc.systinit
  • Setting the path and the hostname, and checking
    whether networking is activated.
  • Mounting the /proc file system
  • Setting the kernel parameters
  • Setting the system clock
  • Loading keymaps and fonts
  • Starting swapping
  • Initializing the USB controller along with the
    attached devices.
  • Checking the root file system.
  • Remounting the root file system as read-write.
  • Loading modules as appropriate.

11
Inittab (contd)
  • Starts the /etc/rc.d/rc script with the
    appropriate run level.
  • The rc script executes all of the scripts pointed
    to by the symblic links contained in the
    directory for that run level.
  • For example, if the run level is 3, the scripts
    pointed to by the links in /etc/rc.d/rc3.d are
    run.

12
/etc/rc.d/rc3.d
  • K01yum K35vncserver K74ypserv
    S12syslog S28autofs S90xfs
  • K05saslauthd K36lisa K74ypxfrd
    S13irqbalance S40smartd S95anacron
  • K10dc_server K45named K89netplugd
    S13portmap S44acpid S95atd
  • K10psacct K50netdump K99readahead
    S14nfslock S55cups S97messagebus
  • K12dc_client K50snmpd K99readahead_early
    S18rpcgssd S55sshd S97rhnsd
  • K15httpd K50snmptrapd S00microcode_ctl
    S19rpcidmapd S56rawdevices S99local
  • K20nfs K50tux S05kudzu
    S19rpcsvcgssd S56xinetd S99mdmonitor
  • K24irda K50vsftpd S06cpuspeed
    S20random S80sendmail S99mdmpd
  • K25squid K70aep1000 S08iptables
    S24pcmcia S85gpm
  • K34yppasswdd K70bcm5820 S09isdn
    S25netfs S87IIim
  • K35smb K74ntpd S10network
    S26apmd S90crond
  • All the files here are only symbolic links to the
    actual scripts that exist in /etc/rc.d/init.d.
  • The system first runs the scripts whose names
    start with K to kill the associated processes ?
    /etc/rc.d/init.d/ltcommandgt stop
  • The system runs the scripts whose names start
    with S to start the processes ?
    /etc/rc.d/init.d/ltcommandgt start
  • Changing a K name to start with S (e.g., K20nfs ?
    S20nfs) makes Linux start the process rather than
    kill it.

13
Inittab (contd)
  • cactrlaltdel/sbin/shutdown -t3 -r now
  • Sets the CtrlAltDelete key combination to
    indicate a reboot of the system.
  • -t option indicates that the init process waits
    for 3 seconds after sending the warning message
    and before sending the kill signal.
  • pfpowerfail/sbin/shutdown -f -h 2 "Power
    Failure System Shutting Down"
  • pr12345powerokwait/sbin/shutdown -c "Power
    Restored Shutdown Cancelled"
  • 32345respawn/sbin/mingetty tty3
  • Initializes the ttys, provides the login and
    retrieves the user-input data, and then starts a
    login process for the user.

14
Building the Kernel
15
Building the Kernel
  • cd /usr/src/linux-2.4.20-8
  • make mrproper (optional but recommended)
  • make xconfig
  • This command runs a X-based configuration tool
    that asks you specific question about every
    kernel configuration.

16
Building the Kernel (Contd)
  • make xconfig, make menuconfig, make config, etc.
  • Most kernel features have three compilation
    options Y (compiling the option directly into
    the kernel), N (not compiling the option at all),
    and M (compiling the option as a kernel module
    and load it on demand).
  • After saving the selection, the configuration
    file /user/src/linux-2.4.20-8/.config is created.

17
Building the Kernel (Contd)
  • make dep
  • Creates dependency information, so that the
    compiler knows each components dependencies and
    can compile components as appropriate.
  • make clean
  • Cleans up some miscellaneous object files.
  • make bzImage
  • Can customize the title in Makefile
  • Compiles the Linux kernel properly.
  • The result is a kernel file called bzImage and
    located in /user/src/linux-2.4.20-8/arch/i386/boot
  • make modules
  • Compiles the kernel modules files

18
Building the Kernel (Contd)
  • make modules_install
  • Installs the kernel modules into the directory
    path /lib/modules/2.4.20-8/kernel/drivers.
  • make install
  • Copies the new kernel and its associated files to
    /boot directory.
  • Builds a new initrd image and adds new entries to
    the boot loader configuration file.
  • Use the command ls -l /boot to make sure the
    initrd-2.4.20-8.img file was created.
  • Confirm that the file /boot/grub/grub.conf
    contains a title section with the same version as
    the kernel package just installed
Write a Comment
User Comments (0)
About PowerShow.com