Académique Documents
Professionnel Documents
Culture Documents
Outline
Boot sequence How to build a kernel How to configure a network interface How to set up NFS About Project 1
8/30/2005
cs498HOU
Boot Process
Reading: 1. Red Hat Linux 9: Read hat Linux Reference Guide, Chapter 1: Boot process, Init, and Shutdown.
Boot Process
The basic input/output system (BIOS) starts and checks for hardware devices.
Is stored in the computers ROM and described as firmware. Finds the hardware devices (diskette drives, CDROM 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.
8/30/2005 cs498HOU 4
(16 bytes) (16 bytes) (16 bytes) (2 bytes) (/dev/hda1 or /boot) (/dev/hda2) (/dev/hda3) (/dev/had4; no filesystem) (/dev/had5) (/dev/had6)
5
Partition 4
cs498HOU
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.
8/30/2005 cs498HOU 7
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 Specifies the default boot image will # initrd /initrd-version.img be the first hard entry #boot=/dev/hdb default=0 Grub will wait for 10 seconds for input from timeout=10 the user before continuing to boot. 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 root=LABEL=/ rhgb quiet initrd /initrd-2.6.5-1.358smp.img title Linux Fedora-up (2.6.5-1.358) The root partition is the second partition root (hd0,1) on the first hard drive. kernel /vmlinuz-2.6.5-1.358 ro root=LABEL=/ rhgb quiet initrd /initrd-2.6.5-1.358.img title Windows 2000 rootnoverify (hd0,0) chainloader +1
8/30/2005
cs498HOU
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/30/2005 cs498HOU 9
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.
8/30/2005 cs498HOU 10
Inittab
id:5:initdefault:
Tells the init program what run level to use after a reboot.
si::sysinit:/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.
8/30/2005 cs498HOU 11
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.
8/30/2005 cs498HOU 12
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.
8/30/2005 cs498HOU 13
ls K01yum K05saslauthd K10dc_server K10psacct K12dc_client K15httpd K20nfs K24irda K25squid K34yppasswdd K35smb K35vncserver K36lisa K45named K50netdump K50snmpd K50snmptrapd K50tux K50vsftpd K70aep1000 K70bcm5820 K74ntpd
/etc/rc.d/rc3.d
K74ypserv K74ypxfrd K89netplugd K99readahead K99readahead_early S00microcode_ctl S05kudzu S06cpuspeed S08iptables S09isdn S10network S12syslog S13irqbalance S13portmap S14nfslock S18rpcgssd S19rpcidmapd S19rpcsvcgssd S20random S24pcmcia S25netfs S26apmd S28autofs S40smartd S44acpid S55cups S55sshd S56rawdevices S56xinetd S80sendmail S85gpm S87IIim S90crond S90xfs S95anacron S95atd S97messagebus S97rhnsd S99local S99mdmonitor S99mdmpd
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/<command> stop The system runs the scripts whose names start with S to start the processes /etc/rc.d/init.d/<command> start Changing a K name to start with S (e.g., K20nfs S20nfs) makes Linux start the process rather than kill it. 8/30/2005 cs498HOU 14
Inittab (contd)
ca::ctrlaltdel:/sbin/shutdown -t3 -r now Sets the Ctrl+Alt+Delete 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. pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" 3:2345:respawn:/sbin/mingetty tty3
Initializes the ttys, provides the login and retrieves the user-input data, and then starts a login process for the user.
8/30/2005 cs498HOU 15
16
8/30/2005
cs498HOU
17
8/30/2005
cs498HOU
20
21
ifconfig
ifconfig interface [options] [address] interface: network interface, e.g., eth0 options: up, down, netmask mask address: IP address Examples for physical host 1 ifconfig eth0 192.168.2.2; ifconfig eth1 192.168.3.1 ifconfig eth0 Ifconfig eth0 netmask 255.255.255.0 192.168.2.2 /sbin/ifup eth0; /sbin/ifdown eth0
8/30/2005 cs498HOU 22
route
route [add | del] [-net | -host] [target] [gw gateway] [[dev] if]
target is the IP address or network address to which the route applies. One special target is the default route --- 0.0.0.0. or default gw gateway
8/30/2005
cs498HOU
24
netstat
netstat -r displays the kernel routing table in the same way as route does. netstat i displays statistics for the network interfaces currently configured. If the a option is also given, it prints all interfaces present in the kernel, not only those that have been configured currently. netstat supports a set of options to display active or passive sockets. The options t, u, w, and x show active TCP, UDP, RAW, or Unix socket connections. If you provide the a flag in addition, sockets that are waiting for a connection (i.e., listening) are displayed as well.
8/30/2005 cs498HOU 25
Setting up NFS
Reading: 1. Red Hat Linux 9: Red Hat Linux Reference Guide, Chapter 9 NFS 2. Red Hat Linux 9: Red Hat Linux Customization Guide, Chapter16 NFS
26
cs498HOU
27
where soft/hard specifies whether the program should stop and wait (hard) for the server to come back if the server is unavailable or if it should report an error (soft). The mount point /myredhat must exist on the client machine. After adding the above line to /etc/fstab on the client, type mount /myredhat at a shell prompt and the mount point will be mounted.
8/30/2005 cs498HOU 28
8/30/2005
cs498HOU
30
About Project 1
Start now if not yet!
Only two sets of keyboards so at most 2 groups can do at the same time.
Space allocation:
Allocate 10GB to /usr Mount the second disk: /dev/sdb1 during installation or later.
8/30/2005 cs498HOU 31
About Project 1
VMware 4.5.22 is available in the same directory as given in the handout. But it doesnt work in Fedora 4.
Probably Vmware 4.0.5 will not either. So, better stay at Fedora 3 / redhat 9. But up to you.
Problems?
Post on newsgroup!
8/30/2005 cs498HOU 32