16.編譯busyboxlinux
17.提供inittab文件shell
18.提供初始化腳本vim
19.第七次測試啓動centos
16.編譯busyboxbash
BusyBox簡介 BusyBox 是一個集成了一百多個最經常使用linux命令和工具的軟件。 BusyBox 包含了一些簡單的工具,例如ls、cat和echo等等,還包含了一些更大、更復雜的工具, 如grep、find、mount以及telnet.有些人將 BusyBox 稱爲 Linux 工具裏的瑞士×××. 簡單的說BusyBox就好像是個大工具箱,它集成壓縮了 Linux 的許多工具和命令, 也包含了 Android 系統的自帶的shell. --- 來源 百度百科
[root@centos6 ~]# tar xf busybox-1.22.1.tar.bz2 [root@centos6 ~]# cd busybox-1.22.1 [root@centos6 busybox-1.22.1]# less INSTALL [root@centos6 busybox-1.22.1]# make menuconfig //靜態方式編譯 Busybox Settings ---> Build Options ---> [*] Build BusyBox as a static binary (no shared libs) Installation Options ("make install" behavior) ---> (./_install) BusyBox installation prefix [root@centos6 busybox-1.22.1]# make && make install
//刪除/mnt/sysroot下的目錄,從新開始從頭測試less
[root@centos6 busybox-1.22.1]# rm -rf /mnt/sysroot/*
[root@centos6 busybox-1.22.1]# ls _install/ bin linuxrc sbin usr //編譯成功後生成的文件 [root@centos6 busybox-1.22.1]# cp -a _install/* /mnt/sysroot/ [root@centos6 busybox-1.22.1]# ls /mnt/sysroot/ bin linuxrc sbin usr
簡單測試ide
[root@centos6 ~]# chroot /mnt/sysroot/ chroot: failed to run command '/bin/bash': No such file or directory [root@centos6 ~]# chroot /mnt/sysroot/ /bin/ash / # //絕大部分命令執行成功
//建立相應的目錄工具
[root@centos6 sysroot]# mkdir -pv etc lib lib64 proc sys dev root home boot mnt media tmp var
17.提供inittab文件測試
//busybox提供/sbin/init文件,咱們手動編寫init的配置文件/etc/inittab文件便可(參照centos 5系列)ui
[root@centos6 sysroot]# vim etc/inittab //注意是相對路徑 ::sysinit:/etc/rc.d/rc.sysinit console::respawn:-/bin/ash ::ctrlaltdel:/sbin/reboot ::shutdown:/bin/umount -a -r
18.提供初始化腳本
[root@centos6 sysroot]# mkdir etc/rc.d/ [root@centos6 sysroot]# vim etc/rc.d/rc.sysinit #!/bin/ash # echo -e "\tWelcome to Sxj \033[32mMini\033[0m Linux" mount -t proc proc /proc mount -t sysfs sysfs /sys mount -o remount,rw /dev/sda2 / //加執行權限 [root@centos6 sysroot]# chmod +x etc/rc.d/rc.sysinit
19.第七次測試啓動
//啓動成功,且絕大多數的命令均可以使用