用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/rootfs 15.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参数
setenv bootargs 'root=/dev/nfs rw nfsroot=192.168.11.20:/nfs_rootfs/rootfs init=/linuxrc console=ttyAMA0 console=tty0 ip=192.168.11.5'
  • 执行命令
qemu-system-arm -M vexpress-a9 \ -kernel /root/tq2440_work/u-boot/u-boot/u-boot \ -serial stdio \ -m 512M \ -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \ -sd /root/tq2440_work/busybox_study/a9rootfs.ext3

 

截图:

 

未完待续。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM