根文件系统挂载
一、nfs方式
1、配置內核,make menuconfig
網絡部分,主要是使能CONFIG_IP_PNP以在2中能夠看到Root file system on NFS選項
Networking support
? ? Networking options
? ? ? ? TCP/IP networking
? ? ? ? ? ? IP: kernel level autoconfiguration
? ? ? ? ? ? ? ? ?[*] IP: DHCP support
? ? ? ? ? ? ? ? ?[*] IP: BOOTP support
?? ??? ??? ??? ??? ?
配置開啟nfs服務
File systems ?--->
? ? Network File Systems ?--->
? ? ? ? ?<*> NFS client support
? ? ? ? [*] NFS client support for NFS version 3
? ? ? ? [*] NFS client support for the NFSv3 ACL protocol extension
? ? ? ? [*] NFS client support for NFS version 4 (EXPERIMENTAL)?
? ? ? ? [*] NFS client support for NFSv4.1 (DEVELOPER ONLY)?
? ? ? ? [*] Root file system on NFS ?
2.配置nfs服務器掛載目錄
/home/lsm/workspace/x210/rootfs/rootfs *(rw,sync,no_subtree_check,no_root_squash)
3.向rootfs目錄中寫入一個普通文件linuxrc進行測試
touch linuxrc
4.在uboot中設置啟動參數(IP根據實際使用更改)
set?bootargs 'root=/dev/nfs nfsroot=192.168.0.63:/home/lsm/workspace/x210/rootfs/rootfs ip=192.168.0.88:192.168.0.63:192.168.0.1:255.255.255.0::eth0:off ?init=/linuxrc console=ttySAC2,115200'?
重啟開發板能夠看到掛載成功,執行/linuxrc失敗。
?
二、鏡像方式
mke2fs是一個應用程序,在ubuntu中默認是安裝了的。這個應用程序就是用來制作ext2、ext3、ext4等格式的根文件系統的。一般用來制作各種不同格式的rootfs的應用程序的名字都很相似,類似于mkfs.xxx(譬如用來制作ext2格式的rootfs的工具叫mkfs.ext2、用來制作jffs2格式的rootfs的工具就叫mkfs.jffs2)。
1.創建rootfs.ext2文件
dd if=/dev/zero of=rootfs.ext2 bs=1024 count=2048
losetup ?/dev/loop1 rootfs.ext2
mke2fs -m 0 /dev/loop1 2048
2.將之掛載到它一個目錄下方便訪問
mount -t ext2 /dev/loop1 /home/lsm/workspace/x210/rootfs/rootfs
3.向rootfs目錄中寫入一個普通文件linuxrc進行測試
touch linuxrc
4.卸載
umount /dev/loop1
losetup -d /dev/loop1
5.使用fastboot將制作好的rootfs.ext2燒錄到開發板。重啟開發板能夠看到掛載成功,執行/linuxrc失敗。
總結
- 上一篇: STM32之RTC原理
- 下一篇: java信息管理系统总结_java实现科