zoukankan      html  css  js  c++  java
  • Linux 命令大全(八)——启动引导

    八、启动引导
    1Linux的启动流程
    1) BIOS 自检
    2) 启动 GRUB/LILO
    3) 运行 Linux kernel 并检测硬件
    4) 挂载根文件系统
    5) 运行 Linux 系统的第一个进程 init(PID 永远为 1,是所有其它进程的父进程)
    6) init 读取系统引导配置文件 /etc/inittab 中的信息进行初始化7) 执行系统初始化脚本- /etc/rc.d/rc.sysinit,执行系统初始化(包括很多内容)
    8) 根据指定的运行级别(runlevel)来运行服务器脚本程序,再执行脚本 /etc/rc.d/rc.local
    9) 运行一些其他的特别服务,一般为 /sbin/mingetty /etc/X11/prefdm
    10) Linux 控制台(console)提示用户输入用户名、密码进行登陆。
    总结:BIOS 初始化检查外围设备检查启动设备读区 MBR
    2、在Linux中常用的启动引导工具:grublilo
    Linux WINDOWS 两系统并存时就需要安装 GRUBGrand Unified Bootloader),GRUB 被广泛地
    用于替代 lilo,GRUB 支持在启动时使用命令行模式,支持 md5 加密保护 还可以从 ext2/ext3ReiseFSJFS
    FATminix FFS 文件系统上启动其配置文件为/boot/grub/grub.conf,更改 grub.conf 即可立时生效如果
    硬盘上的 MBR 被更动过,可以用/sbin/grub-install /dev/hda 来重安装 grub 现在我们打开
    /boot/grub/grub.conf 查看一下
    # vim /boot/grub/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,0)
    # kernel /vmlinuz-version ro root=/dev/sda2 # initrd /initrd-version.img
    #boot=/dev/sda
    default=0
    #default=0 表示默认启动第一个系统,如果系统有两个系统是用什么做为分隔符的呢?title 就是系统的分
    隔符,第一个 title 后面就是第一个系统,0 表示。
    timeout=5
    #timout=5,就是默认在启动选择界面停留的时间,单位是秒。等待 5 秒自动进入默认操作系统
    splashimage=(hd0,0)/grub/splash.xpm.gz
    #splashimage grub 启动背景画面,如果是自己写 grub.conf 文件,这个可以不用写。
    hiddenmenu
    title Red Hat Enterprise Linux Server (2.6.18-53.el5)
    #title 后面就是系统在启动时候显示的名字
    root (hd0,0)
    #root 启动文件所在位置
    kernel /vmlinuz-2.6.18-53.el5 ro root=LABEL=/ rhgb quiet
    #kernel 内核所在位置和名字
    initrd /initrd-2.6.18-53.el5.img
    #initrd 内核镜象的名字
    grub.conf 的范例:
    timeout=10 #等待 10 秒自动进入默认操作系统
    splashimage=(hd0,0)/grub/splash.xpm.gz #grub 启动背景画面
    default=0 #默认进入第一个标题
    title Red Hat Linux (2.4.20-18) #Red Hat Linux 标题
    root (hd0,0) #根文件系统位置
    kernel /vmlinuz-2.4.20-18 ro root=LABEL=/ #核心位置与核心加载参数
    initrd /initrd-2.4.20-18.img #启动 initrd ram
    title windows #另一个操作系统的标题
    rootnoverify (hd0,1) #操作系统存放在 hd0,1 上,不要在 grub mount
    chainloader +1 #hd0,1 的第一个扇面启动
  • 相关阅读:
    Sublime Text 2快捷键大全
    JavaSE
    Ubuntu16.04 install ideaIC-2017.2.5.tar.gz
    Ubuntu/CentOS hadoop-2.x Cluster Setup
    Ubuntu16.04 install hadoop-2.8.1.tar.gz Cluster Setup
    12file
    11input/output
    10function
    09FlowControl
    08test
  • 原文地址:https://www.cnblogs.com/zhuminghui/p/13594853.html
Copyright © 2011-2022 走看看