Linux boot flow
2008-12-10 17:16
183 查看
Linux BootFlow:
BIOS Post Setup->MBR(GRUB/LILO)->Kernel->Kernel self-extract->Kernel Start
Kernel Start:
Create the process that ID is 1->The first process create other kernel threads->The kernel
threads load the /sbin/init binary file then that become a user level process->The init subroutine
init the system with keyboard,font,netword etc by the /etc/inittab configure file:
The configuring flow of the redhat linux is:
/etc/rc.d/rc.sysinit->/etc/rc.d/rc.$RUNLEVEL->/etc/rc.d/rc.local->/sbin/mingetty(wait user
login)
The $RUNLEVEL variable configuring by the /etc/inittab file:
Value range is 0-6:
0:halt
1:Single user
2:Multiple user
3:Multiple user and start the NFS service
4:Reserve
5:Start xdm(X Window)
6:reboot
The /et/inittab file content:
#Set the run level when the machine is starting
id:3:initdefault
#Before starting the services with the current run level, run the bath file for system
initializing or testing.
si::sysinit:/etc/rc.d/rc.sysinit
#Needed services for each run level configured by the script file:
0:0:wait:/etc/rc.d/rc.0
1:1:wait:/etc/rc.d/rc.1
2:2:wait:/etc/rc.d/rc.2
3:3:wait:/etc/rc.d/rc.3
4:4:wait:/etc/rc.d/rc.4
5:5:wait:/etc/rc.d/rc.5
6:6:wait:/etc/rc.d/rc.6
#What to do when press the Alt+Ctrl+Del hot key
ca::ctrlatldel:/sbin/shutdown -t3 -r now
#Run the script file when starting with run level 5(X Window)
x:5:once:/etc/X11/prefdm -nodaemon
Syntax:
ID:Level:Init action:Instructions
ID:
Max length is 4 character,Just the identifier for the some work on init
Level:
What level is the instruction.example: 35 that is run when the run level is 3 or 5.
Init action:
Some instructions often is some script.
About GRUB:
The GRUB is a boot loader or using lilo when early version of linux.
After the BIOS post setup, the BIOS subrutine jump to the instruction load from MBR(0
cylinder 0 track 1 section) to executing.
/boot/grub/grub.conf file content:
default 0 --default starting item
splashimage (hd0,0) /boot/grub/splash.xpm,gz --the bk of grub start menu
timeout 20 --wait time for user select
title=Boot 1 --the menu title
root (hd0,0) --where is the root partition of hd for the linux kernel
kernel /boot/bzImage root=/dev/loop0 init=/initdisk.gz --where is the kernel file
initrd /initdisk/gz --use the initrd to load the kernel file
title= Boot 1 --the menu title
root (hd0, 1) --where is the partition of hd for the system
makeactive --set the partition to active(windows can't boot from a not active partition)
chainloader +1 --the chainloader command call the boot loader on the partition +1 indicates
the boot loader code offset.
If forget the root password do this:
$passwd root
$reboot
Set the password for grub:
password 123456 --pub this above all the default command
title Boot 1
lock --lock the menu item when password error
title Boot 1
password 123456 --pub the password only for the menu item
MD5 encrypt the grub password:
$grub-md5-crypt
$grub
grub>md5crypt
Referrence:
《linux 启动详解 分析 启动流程》
BIOS Post Setup->MBR(GRUB/LILO)->Kernel->Kernel self-extract->Kernel Start
Kernel Start:
Create the process that ID is 1->The first process create other kernel threads->The kernel
threads load the /sbin/init binary file then that become a user level process->The init subroutine
init the system with keyboard,font,netword etc by the /etc/inittab configure file:
The configuring flow of the redhat linux is:
/etc/rc.d/rc.sysinit->/etc/rc.d/rc.$RUNLEVEL->/etc/rc.d/rc.local->/sbin/mingetty(wait user
login)
The $RUNLEVEL variable configuring by the /etc/inittab file:
Value range is 0-6:
0:halt
1:Single user
2:Multiple user
3:Multiple user and start the NFS service
4:Reserve
5:Start xdm(X Window)
6:reboot
The /et/inittab file content:
#Set the run level when the machine is starting
id:3:initdefault
#Before starting the services with the current run level, run the bath file for system
initializing or testing.
si::sysinit:/etc/rc.d/rc.sysinit
#Needed services for each run level configured by the script file:
0:0:wait:/etc/rc.d/rc.0
1:1:wait:/etc/rc.d/rc.1
2:2:wait:/etc/rc.d/rc.2
3:3:wait:/etc/rc.d/rc.3
4:4:wait:/etc/rc.d/rc.4
5:5:wait:/etc/rc.d/rc.5
6:6:wait:/etc/rc.d/rc.6
#What to do when press the Alt+Ctrl+Del hot key
ca::ctrlatldel:/sbin/shutdown -t3 -r now
#Run the script file when starting with run level 5(X Window)
x:5:once:/etc/X11/prefdm -nodaemon
Syntax:
ID:Level:Init action:Instructions
ID:
Max length is 4 character,Just the identifier for the some work on init
Level:
What level is the instruction.example: 35 that is run when the run level is 3 or 5.
Init action:
Some instructions often is some script.
About GRUB:
The GRUB is a boot loader or using lilo when early version of linux.
After the BIOS post setup, the BIOS subrutine jump to the instruction load from MBR(0
cylinder 0 track 1 section) to executing.
/boot/grub/grub.conf file content:
default 0 --default starting item
splashimage (hd0,0) /boot/grub/splash.xpm,gz --the bk of grub start menu
timeout 20 --wait time for user select
title=Boot 1 --the menu title
root (hd0,0) --where is the root partition of hd for the linux kernel
kernel /boot/bzImage root=/dev/loop0 init=/initdisk.gz --where is the kernel file
initrd /initdisk/gz --use the initrd to load the kernel file
title= Boot 1 --the menu title
root (hd0, 1) --where is the partition of hd for the system
makeactive --set the partition to active(windows can't boot from a not active partition)
chainloader +1 --the chainloader command call the boot loader on the partition +1 indicates
the boot loader code offset.
If forget the root password do this:
$passwd root
$reboot
Set the password for grub:
password 123456 --pub this above all the default command
title Boot 1
lock --lock the menu item when password error
title Boot 1
password 123456 --pub the password only for the menu item
MD5 encrypt the grub password:
$grub-md5-crypt
$grub
grub>md5crypt
Referrence:
《linux 启动详解 分析 启动流程》
相关文章推荐
- imx6sx-sdb.dtb imx6sx-sdb.dts 设备树 (d:\swwork\solo\linux-3.14.28\arch\arm\boot\dts)
- Linux/boot/bootsect.S
- u-boot与Linux内核间的参数传递过程分析[转载]
- u-boot与linux内核间的参数传递过程分析
- U-Boot与Linux内核的交互
- linux流量控制 ——Linux flow control
- 【嵌入式Linux学习七步曲之第三篇 Linux系统bootlaoder移植】U-BOOT全线移植分析系列之三--U-BOOT在AT91RM9200上的移植
- 在linux下编译 adb 和 fastboot
- UBOOT PING不通虚拟机linux的解决办法
- [置顶] 【原创分享】嵌入式linux应用之U-BOOT移植定制篇--20130822
- linux net command /uboot command
- Linux Filesystem Hierarchy 之 /boot
- 二..linux开发之uboot移植(二)——网络命令ping开发搭建使用&tftp服务器的安装&nfs网络服务器的安装
- 【Linux 移植 】——5、移植 u-boot-2012.04.01 之 支持Nor Flash
- 用U盘boot自启动实现LINUX的安装及其他WIN功能
- 【嵌入式Linux学习七步曲之第三篇 Linux系统bootlaoder移植】全面解析PowerPC架构下的扁平设备树FDT
- linux基础之uboot load address、entry point、 bootm address以及kernel运行地址的意义及联系
- 用vs2013+velt-0.1.4进行嵌入式开发 进行海思平台 UBOOT 开发 分类: arm-linux-Ubuntu Windows-嵌入式 2015-06-27 11:59 393人阅读 评论(0) 收藏
- arm-linux-ld: error: Source object has EABI version 5, but target u-boot has EABI version 0
- ARM Linux Boot Sequence