從無到有構建一個Mini Linux(5)


20.編輯/etc/fstab文件,進一步完善 rc.sysinit 及 inittab文件linux

21.第八次測試啓動vim

22.編譯內核使用可以支持網絡功能 (直接編譯爲核心)centos

23.第九次測試啓動bash

24.編譯內核使其可以支持網絡功能 (編譯爲模塊)網絡

25.第十次測試啓動ide



20.編輯/etc/fstab,完善 rc.sysinit、inittab測試

[root@centos6 sysroot]# vim etc/fstab
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sda1 /boot ext4 defaults 0 0
/dev/sda2 / ext4 defaults 0 0

[root@centos6 sysroot]# vim etc/rc.d/rc.sysinit
echo -e "\tWelcome to ++++ \033[32mMini\033[0m Linux"
mount -n -t proc proc /proc
mount -n -t sysfs sysfs /sys
echo "scan /sys and to populate to /dev..."
mdev -s
mount -o remount,rw /dev/sda2 /
echo "mounting all filesystems..."
mount -a      //掛載/etc/fstab中的設備

[root@centos6 sysroot]# vim etc/inittab
::sysinit:/etc/rc.d/rc.sysinit
tty1::askfirst:/bin/sh  //實現3個終端
tty2::askfirst:/bin/sh
tty3::askfirst:/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r



21.第八次測試啓動
spa


wKiom1hOVLTR16QVAAAPLMDXnLM629.png-wh_50


wKioL1hOVLWSnPh9AAAQyak4sXI114.png-wh_50


wKiom1hOVLWhQpqBAAAO1XfnqAE029.png-wh_50



22.編譯內核使用可以支持網絡功能 (直接編譯爲核心)orm


[root@centos6 ~]# cd /usr/src/linux
[root@centos6 linux]# make menuconfig
[*] Networking support  --->
    Networking options  ---> 
        [*] TCP/IP networking
(驅動網卡:第一種實現 --> 編譯爲核心)
//編譯網卡驅動到內核核心中

[root@centos6 ~]# cd /usr/src/linux
[root@centos6 linux]# make menuconfig
//驅動網卡
Device Drivers  --->
	[*] Network device support  --->
		[*]   Ethernet driver support (NEW)  --->
			[*]   Intel devices
			<*>     Intel(R) PRO/1000 Gigabit Ethernet support 編譯爲核心

[root@centos6 linux]# make bzImage
[root@centos6 linux]# cp arch/x86/boot/bzImage /mnt/boot/vmlinuz 
cp: overwrite '/mnt/boot/vmlinuz'? y


23.第九次測試啓動blog


wKiom1hOVYqTGKKVAAAtPeyEdaA275.png-wh_50


wKioL1hOVYrSs6N7AAApyclXBMg919.png-wh_50


wKiom1hOVY3hlZvuAAAebTkgVsM280.png-wh_50



24.編譯內核使其可以支持網絡功能 (編譯爲模塊)


[root@centos6 ~]# cd /usr/src/linux
[root@centos6 linux]# make menuconfig

Device Drivers  --->
	[*] Network device support  --->
		[*]   Ethernet driver support (NEW)  --->
			[*]   Intel devices
			<M>     Intel(R) PRO/1000 Gigabit Ethernet support 編譯爲模塊


[root@centos6 linux]# make bzImage
[root@centos6 linux]# cp arch/x86/boot/bzImage /mnt/boot/vmlinuz 
cp: overwrite '/mnt/boot/vmlinuz'? y   //此內核不包括網卡驅動

//單獨編譯模塊

[root@centos6 linux]# make M=drivers/net/ethernet/intel/e1000

//複製模塊到目標主機上

[root@centos6 linux]# mkdir -pv /mnt/sysroot/lib/modules
[root@centos6 linux]# cp drivers/net/ethernet/intel/e1000/e1000.ko /mnt/sysroot/lib/modules
[root@centos6 linux]# ls /mnt/sysroot/lib/modules
e1000.ko


25.第十次測試啓動


wKioL1hOVhmwuGDcAAAWChVSOUE281.png-wh_50


wKiom1hOVhnhje7rAAA58gIhr28627.png-wh_50

相關文章
相關標籤/搜索