【问题标题】:QEMU: How To mount rootfs using NFS on qemu emulatorQEMU:如何在 qemu 模拟器上使用 NFS 挂载 rootfs
【发布时间】:2014-04-30 00:44:19
【问题描述】:

- 我使用busybox构建rootfs,使用内核源代码构建zimage。现在我想使用 NFS 在 qemu 提示符下读取 rootfs 任何人都可以 告诉我 arm 作为目标,x86 作为主机。

【问题讨论】:

    标签: linux embedded qemu


    【解决方案1】:

    1)安装nfs-kernel-server

    sudo apt-get install nfs-kernel-server
    

    2) 创建将复制 rootfs 的 nfs 文件夹。

    mkdir -p /srv/nfs/
    chown 1000:1000 /srv/nfs
    

    3) 编辑文件 /etc/exports

    /srv/nfs 127.0.0.1(rw,sync,no_subtree_check,all_squash,insecure,anonuid=1000,anongid=1000)

    or如果上述方法不起作用,那么试试这个

    /srv/nfs 127.0.0.1(rw,sync,no_subtree_check,no_root_squash,insecure)

    4)以root身份运行命令

    exportfs -av

    将使用 Busybox 构建生成的 _install 目录复制到 NFS 共享中。

    5)如果您没有正确创建 rootfs,请按照此帖子获取完整详细信息http://balau82.wordpress.com/2010/04/27/linux-nfs-root-under-qemu-arm-emulator/

    6) 运行

    qemu-system-arm -M versatilepb -m 128M -kernel zImage -append "root=/dev/nfs nfsroot=10.0.2.2:/srv/nfs/_install rw ip=10.0.2.15::10.0.2.1:255.255.255.0 init=/sbin/init"

    【讨论】:

    • 感谢您的回答,但我收到错误,我无法启动 /sbin/init 进程,我也仅为您编辑了我的问题(添加了错误快照),我根据您的尝试回答,请重播。
    • 你是静态编译busybox还是动态编译?请参考这个stackoverflow.com/questions/22409516/how-to-compile-busybox/…
    • Vinod,“/sbin/init”错误意味着你的rootfs(从busybox创建)没有它,试试/bin/init怎么样? (只需挂载它并尝试先搜索文件)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-06
    • 2015-06-06
    • 1970-01-01
    • 2016-12-14
    • 1970-01-01
    相关资源
    最近更新 更多