1 / 33

系统启动过程分析

系统启动过程分析. 5-1 RH9.0 启动过程. 1 . BIOS 自检 硬件检测及初始化 2 .引导启动设备 ( 1 )软盘( 0 磁道 0 扇区) ( 2 )光盘(最外围存储轨道) ( 3 )硬盘( MBR ). 3 .调用 Linux 引导程序至内存中 4 .运行 Linux 内核 5 .执行 init 进程 6 . init 调用 getty 提示用户登录 7 .运行 SHELL 程序. 5-2 引导装载程序使用. 1 . LILO ( Linux Loader ).

twyla
Download Presentation

系统启动过程分析

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. 系统启动过程分析

  2. 5-1 RH9.0启动过程 1.BIOS自检 硬件检测及初始化 2.引导启动设备 (1)软盘(0磁道0扇区) (2)光盘(最外围存储轨道) (3)硬盘(MBR)

  3. 3.调用Linux引导程序至内存中 4.运行Linux内核 5.执行init进程 6.init调用getty提示用户登录 7.运行SHELL程序

  4. 5-2引导装载程序使用 1.LILO(Linux Loader)

  5. 2、GRUB (Grand Unified Boot Loader) (1)GRUB简介 GRUB与LILO一样都是一种多重启动引导器 Red Hat Linux9.0 的默认启动引导器 (2)GRUB特点 • GRUB提供了真正命令行交互界面 • 支持大硬盘,能够访问1024柱面的后的文件 • 开机画面美观细腻

  6. (3)GRUB的设置 • GRUB的文件/etc/grub.conf内容: default=0 //设置默认菜单 timeout=30 //设置超时时间 splashimage=(hd0,0)/grub/splash.xpm.gz //设定开机画面

  7. title RedHat Linux //设置标题 root (hd0,0) //设置内核存放的分区 kernel /vmlinuz-2.4.20-8 ro root=LABEL=/ //设置内核文件 initrd /initrd-2.4.20-8.img //设置内核映像文件

  8. title win2k rootnoverify (hd0,1) //设置WINDOWS系统的位置 chainloader +1 // 读取扇区

  9. 实例: • 要求如下: • 1)hda上有两个操作系统,分别为RH9.0 和 Win2K • RH9.0安装在/BOOT分区号为hda2, • Win2K安装在C:下 • 3)设置GRUB的口令为123且用MD5加密 • 4)锁定每个菜单选项

  10. 配置过程: • #grub -md5 -crypt Password: Retype password: $MQBa@#12Q(注意大小写)

  11. # vi /etc/grub.conf default=0 timeout=30 plashimage=(hd0,0)/grub/1.jpg password --md5 $MQBa@#12Q

  12. title RedHat Linux9.0 root (hd0,1) kernel /vmlinuz-2.4.20-8 ro root=LABEL=/ initrd /initrd-2.4.20-8.img lock

  13. title window 2k server rootnoverify (hd0,0) chainloader +1 lock

  14. (4)GRUB的命令行,菜单模式,编辑模式的操作(4)GRUB的命令行,菜单模式,编辑模式的操作 • 解锁GRUB启动菜单 • 在锁定的启动菜单中选择“p”键 • 输入口令

  15. 编辑模式: • 作用:用于修改菜单的选项 • 热键:e键进入

  16. 命令行模式: • 作用:设置GRUB的选项 • 热键:c键 • 实例:启动Linux grub>root (hdx,y) grub>kernel /vmlinuz-版本号 ro root=LABEL=/ grub>initrd /initrd-版本号.img grub>boot

  17. 启动WINDOWS grub>rootnoverify (hdx,y) grub>chainloader +1 grub>boot

  18. (5)安装GRUB • 第一步:安装GRUB软件包 • #rpm –ivh grub-0.93-4.i386.rpm • 第二步:安装GRUB到MBR • 建立GRUB配置文件:/boot/grub/grub.conf • 使用命令安装GRUB到MBR

  19. (6)恢复GRUB • 放入第一张安装启动盘,开始启动计算机: boot:linux rescue # grub grub>root(hd0,0) grub>setup(hd0)

  20. (7)恢复GRUB的配置文件 • 放入第一张安装启动盘,启动计算机: boot: linux rescue • # cd /mnt/sysimage • # vi ./boot/grub/grub.conf • 修改grub.conf,恢复设置选项

  21. 5-4 init 进程 (PID=1) 1、init进程的作用 • 系统初始化

  22. 2、系统运行级别 • 0 //关机 • 1 //单用户模式 • 2 //多用户、不支持NFS • 3 //完全多用户模式 • 4 //保留 • 5 //X-WINDOWS • 6 //重启 • 切换:# init [0--6]

  23. 注: (1) shutdown • 功能:重启/关机 • 格式: shutdown [参数] time [信息]

  24. 参数: • -r //重启 • -c //取消shutdown的动作 • -h //关闭计算机 • -f //重启时使用fsck检查文件系统 • -F //重启时不检查文件 • time //设定时间 • hh:mm //某时某分 • +mm //当前时间往后几分钟 • now //立即

  25. 实例: • # shutdown -r now • # shutdown -r +5 • # shutdown -h 18:00 • # shutdown -h now

  26. (2)reboot • 功能:重启系统 • 实例: • #reboot

  27. (3)runlevel • 功能:显示系统当前和上一次的运行级别,如果 上次运行级别记录不存在,则显示N,如果都不存在,则显示unknow. • 实例: • #runlevel

  28. 3、inittab文件的分析 • 作用:设置init进程默认级别,设置init的动作 • 格式:# vi /etc/inittab id:runlevels:action:process • 实例: • id : 3 :initdefault : • ………… • ca : : ctrlaltdel : shutdown -r now

  29. 说明: • 运行的级别: • 动作: • initdefault //启动默认级别 • sysinit //sysinit类进程是init进程的第一个子进程,在boot类进程之前运行。 • wait //wait进程在进入指定级别后运行一次,且init进程要等待其结束

  30. ctrlaltdel: //指按CTRL+ALT+DEL键时的动作 • powerfail //用于指当UPS发来断电信号时所运行的命令 • powerokwait //用于当供电恢复时运行的命令

  31. 4、/etc/rc.d 目录内容说明 • init.d //存放服务的启动脚本 • rc //负责运行级别改变时启动或停止相应的服务 • rc n //存放每个运行级别中要运行的程序 (k*:关闭程序,s*:启动服务) • rc.sysinit //完成系统初始化 • rc.local //系统启动时自动运行的脚本文件

  32. 上机作业 • 练习掌握GRUB的功能和使用方法 • 练习掌握init进程的功能和inittab文件的设置

More Related