一、实验环境
VMware-workstation-full-10.0.1-1379776
操作系统:CentOS-6.5 x86_64
二、操作步骤
自己检查开发环境,缺什么就yum装什么
1、在宿主机上添加一块10G的硬盘,并分区格式化
[root@90sec ~]# fdisk /dev/sdb
[root@90sec ~]# mke2fs -t ext4 /dev/sdb1
[root@90sec ~]# mke2fs -t ext4 /dev/sdb2
[root@90sec ~]# fdisk -l /dev/sdb
Device Boot Start End Blocks Id System
/dev/sdb1 1 200 1606468+ 83 Linux
/dev/sdb2 201 1305 8875912+ 83 Linux
2、创建grub引导程序
[root@90sec ~]# mkdir -pv /mnt/{boot,sysroot}
[root@90sec mnt]# mount /dev/sdb1 /mnt/boot/
[root@90sec /]# grub-install --root-directory=/mnt /dev/sdb
Probing devices to guess BIOS drives. This may take a long time.
Installation finished. No error reported.
This is the contents of the device map /mnt/boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb
[root@90sec /]# ls /mnt/boot/grub/
device.map ffs_stage1_5 minix_stage1_5 stage2 xfs_stage1_5
e2fs_stage1_5 iso9660_stage1_5 reiserfs_stage1_5 ufs2_stage1_5
fat_stage1_5 jfs_stage1_5 stage1 vstafs_stage1_5
3、编译内核
[root@90sec ~]# tar xf linux-3.10.10.tar.xz -C /usr/src/
[root@90sec ~]# cd /usr/src/
[root@90sec src]# ln -sv linux-3.10.10/ linux
`linux' -> `linux-3.10.10/'
[root@90sec src]# cd linux