Linux U盘系统(学习系统启动过程)
作者 佚名技术
来源 Linux系统
浏览
发布时间 2012-04-04
|
- 本文描述了Red Hat Enterprise Linux 5环境下制作U盘系统,旨在了解linux操作系统的系统启动过程.
- 系统启动过程
- 1、加电自检(POST代码)
2、boot loader
GRUB -- /boot/grub/grub.conf
kernel
initrd.img
3、INIT
/sbin/init ----- /etc/inittab
/etc/rc.d/rc.sysinit
/etc/rc.d/rc RUNLEVEL
/etc/rc$runlevel.d/S* start
/etc/rc$runlevel.d/K* stop
/etc/X11/prefdm
4、登录
文本 login
图形 gdm/kdm
- 自制一个U盘系统
- 准备工作:在真实机中把yum配置好
[root@localhost /]# ls /mnt/Server/ 这是软件包所处的目录
[root@localhost /]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
rhel-debuginfo.repo
[root@localhost yum.repos.d]# cp rhel-debuginfo.repo pg.repo
[root@localhost yum.repos.d]# vim pg.repo
[root@localhost yum.repos.d]# cat pg.repo
[rhel-server]
name=Red Hat Enterprise Linux
baseurl=file:///mnt/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
1、准备U盘,并分区,格式化成ext3(可选)文件系统[root@localhost pg]# fdisk -l
[root@localhost pg]# fdisk -l
Disk /dev/sda: 4003 MB, 4003463168 bytes
84 heads, 20 sectors/track, 4654 cylinders
Units = cylinders of 1680 * 512 = 860160 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 5 4655 3905600 c W95 FAT32 (LBA)
[root@localhost pg]# fdisk /dev/sda
The number of cylinders for this disk is set to 4654.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): d
Selected partition 1
Command (m for help): p
Disk /dev/sda: 4003 MB, 4003463168 bytes
84 heads, 20 sectors/track, 4654 cylinders
Units = cylinders of 1680 * 512 = 860160 bytes
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-4654, default 1):
Using default value 1
Last cylind[root@localhost pg]# mount -t ext3 /dev/sda1 /neter or size or sizeM or sizeK (1-4654, default 4654):
Using default value 4654
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@localhost pg]# partprobe /dev/sda
[root@localhost pg]# ls /dev/sda1
/dev/sda1
--------------
[root@localhost pg]# mkfs.ext3 /dev/sda1
2、挂载U盘,并把相关文件拷到U盘中
[root@localhost pg]# mount -t ext3 /dev/sda1 /net
把/目录树结构在u盘创建好
]# yum --installroot=/net -y install filesystem
/boot
这个目录应该有vmlinuz-x.x.x initrd-x.x.x.img
/boot/grub
这个目录中应该有grub的相关文件
grub还要安装到
|
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn
为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!
|