用Qemu模拟vexpress-a9 (四) --- u-boot引导kernel,用nfs挂载根文件系统
?
環境介紹
Win7 64 + Vmware 11 + ubuntu14.04 32
u-boot 版本:u-boot-2015-04
Linux kernel版本:linux-3.16.y
busybox版本:1_24_stable
交叉編譯工具鏈:arm-linux-gnueabi-
qemu版本:stable-2.4
?
目的
這篇博文的目的是實現NFS根文件系統的掛載。具體步驟如下。
?
步驟
1、參照上一篇博文,以保證Qemu的網絡是可以用的。
2、配置u-boot的環境變量bootargs
setenv bootargs 'root=/dev/nfs rw nfsroot=192.168.11.20:/nfs_rootfs/rootfs init=/linuxrc console=ttyAMA0 ip=192.168.11.5'?
3、配置kernel
配置內核,使其支持nfs掛載根文件系統
make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm O=./out_vexpress_3_16/ menuconfig配置:
File systems? --->
??? [*] Network File Systems? --->
??????? <*>?? NFS client support
??????? <*>???? NFS client support for NFS version 3
??????? [*]?????? NFS client support for the NFSv3 ACL protocol extension
??????? [*]?? Root file system on NFS
?
然后重新編譯內核
make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm O=./out_vexpress_3_16 LOADADDR=0x60003000 uImage -j2將生成的uImage拷貝到/tftpboot下
4、啟動
qemu-system-arm -M vexpress-a9 \-kernel /root/tq2440_work/u-boot/u-boot/u-boot \-nographic \-m 512M \-net nic,vlan=0 -net tap,vlan=0,ifname=tap0-sd /root/tq2440_work/busybox_study/a9rootfs.ext3注:這里的-sd參數此時可以不用設置。
啟動信息:
VFS: Mounted root (nfs filesystem) on device 0:12. Freeing unused kernel memory: 236K (805c2000 - 805fd000)Please press Enter to activate this console. [root@vexpress ]# [root@vexpress ]# [root@vexpress ]# [root@vexpress ]# mount rootfs on / type rootfs (rw) 192.168.11.20:/nfs_rootfs/rootfs on / type nfs (rw,relatime,vers=2,rsize=4096,wsize=4096,namlen=255,hard,nolock,proto=udp,timeo=11,retrans=3,sec=sys,mountaddr=192.168.11.20,mountvers=1,mountproto=udp,local_lock=all,addr=192.168.11.20) proc on /proc type proc (rw,relatime) tmpfs on /tmp type tmpfs (rw,relatime) sysfs on /sys type sysfs (rw,relatime) tmpfs on /dev type tmpfs (rw,relatime) devpts on /dev/pts type devpts (rw,relatime,mode=600)?
此時我們由于指定了-sd參數,所以我們還可以訪問原來的根文件系統,方法如下:
[root@vexpress ]# ls /dev/mmcblk0 -lh brw-rw---- 1 0 0 179, 0 Dec 6 08:47 /dev/mmcblk0 [root@vexpress ]# df -h Filesystem Size Used Available Use% Mounted on 192.168.11.20:/nfs_rootfs/rootfs15.6G 5.1G 9.7G 34% / tmpfs 250.7M 0 250.7M 0% /tmp tmpfs 250.7M 0 250.7M 0% /dev [root@vexpress ]# mount -t ext3 /dev/mmcblk0 /mnt/tmp random: nonblocking pool is initialized kjournald starting. Commit interval 5 seconds EXT3-fs (mmcblk0): using internal journal EXT3-fs (mmcblk0): mounted filesystem with writeback data mode [root@vexpress ]# ls /mnt/tmp/ bin etc linuxrc mnt root sys usr dev lib lost+found proc sbin tmp var [root@vexpress ]#?
5、開啟圖形界面
- 修改u-boot參數
- 執行命令
?
截圖:
?
未完待續。
轉載于:https://www.cnblogs.com/pengdonglin137/p/5023875.html
總結
以上是生活随笔為你收集整理的用Qemu模拟vexpress-a9 (四) --- u-boot引导kernel,用nfs挂载根文件系统的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于css的text-indent首行缩
- 下一篇: JNI基础 c语言调用java方法