10.重新編譯內核使其支持鍵盤和鼠標驅動
11.第四次測試啓動
12.利用腳本實現init功能
13.第五次測試啓動
14.編譯內核使其能夠直接識別到設備文件
15.第六次測試啓動
10.重新編譯內核使其支持鍵盤和鼠標驅動
[root@centos6 ~]# lsusb //查看Usb接口類型和型號 [root@centos6 ~]# cd /usr/src/linux [root@centos6 ~]# make menuconfig //使其支持鍵盤和鼠標驅動 Device Drivers ---> Input device support ---> [*] Keyboards ---> [*] Mice ---> 默認爲ps/2驅動,如果爲USB,則需要首先加載USB驅動 <*> Mouse interface [*] USB support ---> <*> Support for Host-side USB <*> xHCI HCD (USB 3.0) support [*] Debugging for the xHCI host controller <*> OHCI HCD support 1.1驅動 <*> UHCI HCD (most Intel and VIA) support [root@centos6 linux]# make bzImage [root@centos6 linux]# cp arch/x86/boot/bzImage /mnt/boot/vmlinuz cp: overwrite '/mnt/boot/vmlinuz'? y
//此時可以複製幾個常用命令用來做測試
11.第四次測試啓動
12.利用腳本實現init功能
(注意移植mount、echo命令)
[root@centos6 ~]# vim /mnt/sysroot/sbin/init #!/bin/bash echo -e "\tWelcome to \033[32mMY Mini\033[0m Linux" mount -n -t proc proc /proc mount -n -t sysfs sysfs /sys mount -n -o remount,rw /dev/sda2 / /bin/bash [root@centos6 ~]# chmod +x /mnt/sysroot/sbin/init [root@centos6 ~]# mkdir /mnt/sysroot/{sys,proc,dev} [root@centos6 ~]# vim /mnt/boot/grub/grub.conf default=0 timeout=5 hiddenmenu title sxj Minu root (hd0,0) kernel /vmlinuz root=/dev/sda2 init=/sbin/init(可省略,默認位置)
13.第五次測試啓動
//由於設備文件是由udev程序創建的,但此時我們沒有udev,
所有/dev/目錄爲空
14.編譯內核使其能夠直接識別到設備文件
[root@centos6 ~]# cd /usr/src/linux [root@centos6 linux]# make menuconfig //選擇可以直接識別設備文件選項 Device Drivers ---> Generic Driver Options ---> [*] Maintain a devtmpfs filesystem to mount at /dev [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs [root@centos6 linux]# make bzIamge [root@centos6 linux]# cp arch/x86/boot/bzImage /mnt/boot/vmlinuz cp: overwrite '/mnt/boot/vmlinuz'? y [root@centos6 linux]# sync
15.第六次測試啓動