1 / 25

第 9 章 操作系统构成实验

第 9 章 操作系统构成实验. 9.1 实验目的 9.2 准备知识 9.3 实验内容 9.4 实验指导. 9.1 实验目的 9.2 准备知识. 9.2.1 Linux 操作系统的启动流程. VFS : Mounted root(ext2filesystem)readonly. 图 9-1 系统引导流程示意图. 9.2.2 开机载入程序 — 引导软件 LILO. 9.2.3 Linux 根文件系统简介. 图 9-2 LILO 的引导示意图. 9.3 实验内容 9.4 实验指导. 9.4.1 实验设计思想

ordell
Télécharger la présentation

第 9 章 操作系统构成实验

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第9章 操作系统构成实验 9.1 实验目的 9.2 准备知识 9.3 实验内容 9.4 实验指导 操作系统构成实验 _ 1 成都信息工程学院 徐虹

  2. 9.1 实验目的 • 9.2 准备知识 操作系统构成实验 _ 2 成都信息工程学院 徐虹

  3. 9.2.1 Linux 操作系统的启动流程 VFS:Mounted root(ext2filesystem)readonly 图9-1 系统引导流程示意图 操作系统构成实验 _ 3 成都信息工程学院 徐虹

  4. 9.2.2 开机载入程序—引导软件LILO 操作系统构成实验 _ 4 成都信息工程学院 徐虹

  5. 9.2.3 Linux根文件系统简介 图9-2 LILO的引导示意图 操作系统构成实验 _ 5 成都信息工程学院 徐虹

  6. 9.3 实验内容 9.4 实验指导 • 9.4.1 实验设计思想 • 9.4.2 配置新内核bzImage • 9.4.3 制作启动盘(Boot盘) • 9.4.4 制作根文件系统盘 • 9.4.5 系统整合 • 9.4.6 系统测试 操作系统构成实验 _ 6 成都信息工程学院 徐虹

  7. 9.4.2 配置新内核bzImage 9.4.1 实验设计思想 [root@linux root]# cd /usr/src/linux-n.n.n [root@linux linux-n.n.n]# make mrproper [root@linux linux-n.n.n]# make menuconfig [root@linux linux-n.n.n777]# make dep [root@linux linux-n.n.n]# make clean [root@linux linux-n.n.n]# make bzImage [root@linux linux-n.n.n]# make modules [root@linux linux-n.n.n]# make modules_install [root@linux linux-n.n.n]#cp /usr/src/linux- n.n.n/arch/i386/boot/bzImage / 操作系统构成实验 _ 7 成都信息工程学院 徐虹

  8. 9.4.3 制作启动盘(Boot盘)(1) [root@linux /]# mke2fs -i 8192 -m0 /dev/fd0 nnnn [root@linux /]# mount /dev/fd0 /mnt [root@linux /]# cd /mnt [root@linux mnt]# rm -rf lost+found [root@linux mnt]# mkdir boot dev etc [root@linux mnt]# cd etc 操作系统构成实验 _ 8 成都信息工程学院 徐虹

  9. 9.4.3 制作启动盘(Boot盘)(2) boot = /dev/fd0 install = /boot/boot.b map = /boot/map read-write ramdisk = nnnn # ramdiskd的大小,如4096 backup = /dev/null compact linear # 此命令可以避免1024柱面问题 image = bzImage # 新配置的内核;若裁减的内 核<4096K,则可以用 # image =zImage label=SDLinux # (自己可随意命名) root = /dev/fd0 操作系统构成实验 _ 9 成都信息工程学院 徐虹

  10. 9.4.3 制作启动盘(Boot盘)(3) [root@linux etc]# cd ../dev [root@linux dev]# cp –dpR /dev/{fd0,null} /mnt/dev/ [root@linux dev]# cd ../boot [root@linux boot]# cp /boot/{boot.b,map} /mnt/boot/ [root@linux boot]# cd .. [root@linux mnt]# cp /bzImage /mnt/ [root@linux mnt]# cd / [root@linux /]# lilo –v –C /mnt/etc/lilo.conf –r /mnt [root@linux /]# rdev –r /mnt/bzImage 49152 [root@linux /]# umount /mnt [root@linux /]# chmod 755 bootdisk [root@linux /]# ./bootdisk 操作系统构成实验 _ 10 成都信息工程学院 徐虹

  11. 9.4.4 制作根文件系统盘(1) [root@linux /]# dd if = /dev/zero of = DEVICE bs = 1k count = 4096 [root@linux /]# mke2fs -m 0 -i 2000 DEVICE [root@linux /]# mount -t ext2 -o loop DEVICE /mnt [root@linux /]# mkdir /mnt/{proc,mnt,tmp} [root@linux /]#cd /mnt ↙ 操作系统构成实验 _ 11 成都信息工程学院 徐虹

  12. 9.4.4 制作根文件系统盘(2) [root@linux mnt]#cp –dpR /dev/ { console,fd0h1200,fd0h1440,full,hd*,icmp, inet,inportbm,ip,kmem,loop*,lp0,mem,null, ram*,socket,socksys,systty,tty*,zero } /mnt/dev [root@linux mnt]#cp –dpR/bin/ {bash,cat,chgrp,chmod,chown,cp,dd,df,echo,fgrep, grep,hostname,kill,ln,login,ls,mkdir,mknod, mount,mv,rm,rmdir,sh,sync,umount,vi} /mnt/bin ↙ 操作系统构成实验 _ 12 成都信息工程学院 徐虹

  13. 9.4.4 制作根文件系统盘(3) [root@linuxmnt]#cp-dpR/usr/bin/ {clear,cmp,dircolors,dirname,du,finger,free, fwhois,killall,which,who,whois } /mnt/bin↙ [root@linux mnt]# cp –dpR/usr/sbin/traceroute/mnt/bin↙ [root@linux mnt]# cp –dpR /sbin/ {halt,init,insmod,killall5,lsmod,mingetty,mke2fs, mkfs,mkfs.ext2,modprobe,runlevel,shutdown, swapon,update,mkdosfs,reboot,rmmod,swapoff, telinit } /mnt/sbin ↙ 操作系统构成实验 _ 13 成都信息工程学院 徐虹

  14. 9.4.4 制作根文件系统盘(4) [root@linux mnt]# cp –dpR /usr/sbin/{gpm,rdev} /mnt/sbin ↙ [root@linux mnt]# cd /mnt/sbin ↙ [root@linux mnt]# ln –s bdflush update ↙ [root@linux mnt]# cd / ↙ [root@linux /]# cp –dpR/etc/ { fstab,group,inittab,issue,ld.so.cache, ld.so.conf,passwd,profile,shells,termcap,rc.d} /mnt/etc ↙ [root@linux /]# cd /mnt/etc ↙ [root@linux etc]# ln –s utmp /mnt/var/run/utmp ↙ 操作系统构成实验 _ 14 成都信息工程学院 徐虹

  15. 9.4.4 制作根文件系统盘(5) [root@linux etc]# mkdir sysconfig vga ↙ [root@linux etc]# cp –dpR /etc/sysconfig/ {clock,keyboard,mouse,network} /mnt/etc/sysconfig ↙ [root@linux etc]# cd sysconfig ↙ [root@linux sysconfig]# mkdir network-scripts ↙ [root@linux sysconfig]#cp–dpR /etc/sysconfig/network-scripts/ {ifcfg-eth0,ifcfg-lo,ifdown,ifup} /mnt/etc/sysconfig/network-scripts ↙ [root@linux sysconfig]# cd / 操作系统构成实验 _ 15 成都信息工程学院 徐虹

  16. 9.4.4 制作根文件系统盘(6) /dev/ram / ext2 defaults /dev/fd0 / ext2 defaults /proc /proc proc defaults /dev/hda1 /mnt/dosc vfat defaults 0 0 /dev/hda5 /mnt/dosd vfat defaults 0 0 none /proc proc defaults 操作系统构成实验 _ 16 成都信息工程学院 徐虹

  17. 9.4.4 制作根文件系统盘(7) id:2:initdefault: si::sysinit:/etc/rc.d/rc.sysinit l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 ca::ctrlaltdel:/sbin/shutdown -t3 –r now 1:12345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 操作系统构成实验 _ 17 成都信息工程学院 徐虹

  18. 9.4.4 制作根文件系统盘(8) #!/bin/sh /bin/mount -av /bin/hostname SDLinux [root@linux /]# cp - dpR /lib/ { libext2fs.so.n,libcom_err.so.n, libe2p.so.n,ld-linux.so.n,libc.so.n, libdl.so.n,libm.so.n,libtermcap.so.n, ld.so.n} /mnt/lib/ ↙ 操作系统构成实验 _ 18 成都信息工程学院 徐虹

  19. 9.4.4 制作根文件系统盘(9) [root@linux /]# objcopy --strip-debug /lib/libext2fs.so.n /mnt/lib/libext2fs.so.n ↙ [root@linux /]# objcopy --strip-debug /lib/libcom_err.so.n /mnt/lib/libcom_err.so.n ↙ [root@linux /]# objcopy --strip-debug /lib/libe2p.so.n /mnt/lib/libe2p.so.n↙ [root@linux /]# objcopy --strip-debug /lib/libdl.so.n /mnt/lib/libdl.so.n ↙ [root@linux /]# objcopy --strip-debug /lib/ld-linux.so.n /mnt/lib/ld-linux.so.n ↙ [root@linux /]#objcopy --strip-debug /lib/libc.so.n /mnt/lib/libc.so.n↙ [root@linux /]#objcopy --strip-debug /lib/libm.so.n /mnt/lib/libm.so.n ↙ [root@linux /]# objcopy --strip-debug /lib/libtermcap.so.n /mnt/lib/libtermcap.so.n ↙ [root@linux /]# objcopy --strip-debug /lib/ld.so.n /mnt/lib/ld.so.n↙ 操作系统构成实验 _ 19 成都信息工程学院 徐虹

  20. 9.4.4 制作根文件系统盘(10) [root@linux /]# mkdir /mnt/lib/modules ↙ [root@linux /]# mkidr /mnt/usr/ {adm,bin,etc,lib,local,sbin} ↙ [root@linux /]# cp –dpR /etc/wgetrc /mnt/usr/etc ↙ [root@linux /]#cp –dpR /usr/lib/ {libncurse.so,libncurse.so.n,libtermcap.so, sendmail.hf} /mnt/usr/lib ↙ 操作系统构成实验 _ 20 成都信息工程学院 徐虹

  21. 9.4.4 制作根文件系统盘(11) [root@linux /]# objcopy --strip-debug /usr/lib/libncurse.so /mnt/usr/lib/libncurse.so ↙ [root@linux /]# objcopy --strip-debug /usr/lib/libncurse.so.n /mnt/usr/lib/libncurse.so.n ↙ [root@linux /]# objcopy --strip-debug /usr/lib/libtermcap.so /mnt/usr/lib/libtermcap.so ↙ 操作系统构成实验 _ 21 成都信息工程学院 徐虹

  22. 9.4.4 制作根文件系统盘(12) [root@linux /]# cp –dpR /usr/lib/rpc/rpmrc /mnt/usr/lib ↙ [root@linux /]# cp –dpR /usr/sbin/ {in.telnetd,rpc.mountd,rpc.nfsd,tcpd}/mnt/usr/sbin ↙ [root@linux /]# cp –dpR /sbin/portmap /mnt/usr/sbin ↙ [root@linux /]# mkdir /mnt/var/{lock,lock/subsys,log,run,spool, spool/mail,spool/mqueue,subsys} ↙ [root@linux /]#cp –dpR /var/lock/subsys/sendmail /mnt/var/lock/subsys ↙ [root@linux /]# cd /mnt/var/run ↙ [root@linux /]# vi utmp ↙ [root@linux /]# umount /mnt ↙ [root@linux /]# dd if = DEVICE bs = 1k | gzip –v9 > rootfs.gz ↙ 操作系统构成实验 _ 22 成都信息工程学院 徐虹

  23. 9.4.5 系统整合 [root@linux /]# dd if = rootfs.gz of = /dev/fd0 bs=1k seek = nnn ↙ [root@linux /]# dd if = rootfs.gz of = /dev/fd0 bs=1k ↙ 操作系统构成实验 _ 23 成都信息工程学院 徐虹

  24. 9.4.6 系统测试(1) (nothing) L LI LIL LIL? LIL− LILO Kernel panic: VFS: Unable to mount root fs on XX:YY end_request: I/O error, dev 01:00 (ramdisk), sector NNN Ramdisk driver initialized : 16 ramdisks of 4096K size Id xxx respawning too fast: disabled for 5 minutes You are welcome to use our SDLinux ... ... 操作系统构成实验 _ 24 成都信息工程学院 徐虹

  25. 9.4.6 系统测试(2) login: passwd: files shadow: files group: files hosts: files services: files networks: files protocols: files rpc: files ethers: files netmasks: files bootparams: files automount: files aliases: files netgroup: files publickey: files login: root passwd: 操作系统构成实验 _ 25 成都信息工程学院 徐虹

More Related