Qemu Freescale i.MX6 DualLite SABRE:根文件系统未挂载 [英] Qemu Freescale i.MX6 DualLite SABRE : root filesystem does not mount

查看:22
本文介绍了Qemu Freescale i.MX6 DualLite SABRE:根文件系统未挂载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标:模拟 Qemu 特别支持的sabrelite : Freescale i.MX6 Quad SABRE Lite Board (Cortex A9)"(执行 'qemu-system-arm -M ?' 它显示出来).

Goal: emulate the "sabrelite : Freescale i.MX6 Quad SABRE Lite Board (Cortex A9)" that Qemu specifically supports (doing 'qemu-system-arm -M ?' it shows up).

Qemu 版本:2.10.1(主机:fedora-27).

Qemu ver: 2.10.1 (host: fedora-27).

我已经成功地交叉编译并构建了一个 4.1.46 Linux 内核(使用了 imx_v6_v7_defconfig 配置文件)以及一个简单的骨架"根文件系统(基于busybox).(仅供参考,我有一个类似的 ARM Cortex-A9 Versatile Express 平台的工作设置 - 我使用我自己的自制嵌入式 Linux 系统来实现这个,该系统名为 海豹).

I have successfully cross-compiled and built a 4.1.46 Linux kernel (used the imx_v6_v7_defconfig config file) as well as a simple "skeleton" root filesystem (busybox-based). (FYI, I have a similar working setup for the ARM Cortex-A9 Versatile Express platform - I do this using my own home-spun embedded Linux system called SEALS).

查看类似板子使用的 U-Boot 配置文件,我想使用 'root=/dev/mmcblk0p0' 作为内核的 root= 参数.所以,为了尝试一下,我然后按如下方式运行 qemu(请水平滚动以查看):

Looking at the U-Boot config file used by similar boards, I figured to use 'root=/dev/mmcblk0p0' as the root= param for the kernel. So, to try it out I then run qemu as follows (pl scroll horizontally as well to see):

qemu-system-arm -m 512 -M sabrelite -kernel zImage -drive file=rfs.img,format=raw -append "console=ttymxc0 rootfstype=ext4 root=/dev/mmcblk0p0 rw rootwait init=/sbin/init " -nographic -dtb imx6dl-sabresd.dtb

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.1.46 (kai@klaptop) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #2 SMP Mon Nov 27 17:16:22 IST 2017
[    0.000000] CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[    0.000000] Machine model: Freescale i.MX6 DualLite SABRE Smart Device Board
[    0.000000] cma: Reserved 16 MiB at 0x2f000000

[...]

所以它开始启动就好了.但随后:

So it starts to boot up just fine. But then:

[...]
[    2.210965] /soc/aips-bus@02100000/usdhc@02194000: voltage-ranges unspecified
[    2.211796] sdhci-esdhc-imx 2194000.usdhc: Got CD GPIO
[    2.212199] sdhci-esdhc-imx 2194000.usdhc: Got WP GPIO
[    2.214392] sdhci-esdhc-imx 2194000.usdhc: could not get ultra high speed state, work on normal mode
[    2.218084] sdhci-esdhc-imx 2194000.usdhc: No vmmc regulator found
[    2.218367] sdhci-esdhc-imx 2194000.usdhc: No vqmmc regulator found
[    2.265431] mmc0: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA
[    2.267300] mmc0: mmc_rescan_try_freq: trying to init card at 400000 Hz
[    2.281912] /soc/aips-bus@02100000/usdhc@02198000: voltage-ranges unspecified
[    2.282956] sdhci-esdhc-imx 2198000.usdhc: Got CD GPIO
[    2.283703] sdhci-esdhc-imx 2198000.usdhc: Got WP GPIO
[    2.284044] sdhci-esdhc-imx 2198000.usdhc: could not get ultra high speed state, work on normal mode
[    2.284892] sdhci-esdhc-imx 2198000.usdhc: No vmmc regulator found
[    2.285167] sdhci-esdhc-imx 2198000.usdhc: No vqmmc regulator found
[    2.298029] mmc0: mmc_rescan_try_freq: trying to init card at 300000 Hz
[    2.337904] mmc1: SDHCI controller on 2198000.usdhc [2198000.usdhc] using ADMA
[    2.357051] /soc/aips-bus@02100000/usdhc@0219c000: voltage-ranges unspecified
[    2.358313] sdhci-esdhc-imx 219c000.usdhc: No vmmc regulator found
[    2.358642] sdhci-esdhc-imx 219c000.usdhc: No vqmmc regulator found
[    2.368204] mmc0: mmc_rescan_try_freq: trying to init card at 200000 Hz
[    2.414722] mmc2: SDHCI controller on 219c000.usdhc [219c000.usdhc] using ADMA
[    2.440456] mmc0: mmc_rescan_try_freq: trying to init card at 100000 Hz

[...]

[    2.986441]   No soundcards found.
[    3.007698] Waiting for root device /dev/mmcblk0p0...

永远在这里等待......

Keeps waiting forever here ...

我知道,在实际的物理板上,必须对 MMC(或 SD)卡进行格式化"或分区,然后让 u-boot 将内核和 rootfs 加载到 RAM 中.但我目前有兴趣让 IMX6 在 Qemu 上工作......所以,我的实际问题是:如何在 Qemu 上安装和运行根文件系统?任何帮助表示赞赏!TIA,

I understand that, on an actual physical board, one would have to "format" or partition the MMC (or SD) card, and have u-boot load up the kernel and rootfs into RAM. But am currently interested in getting the IMX6 working on Qemu... So, my actual question: how can I get the root filesystem mounted and operational on Qemu? Any help appreciated! TIA,

推荐答案

这里有两个问题.首先,您的命令行实际上并没有创建 SD 卡: -drive 选项创建了一个驱动器对象,但不会尝试将其插入任何地方(因为 sabrelite 板没有定义默认类型的块驱动器").要将驱动器实际插入模拟 SD 卡,您需要

There are two problems here. Firstly, your command line isn't actually creating an SD card: the -drive option creates a drive object but doesn't try to plug it in anywhere (because the sabrelite board doesn't define a "default kind of block drive"). To actually plug in the drive to an emulated sd card you need

-drive file=yourfile.img,format=raw,id=mycard -device sd-card,drive=mycard

其次,QEMU 当前的 imx6 sd 控制器仿真中存在错误,因为如果您这样做,那么来宾内核会不断打印

Secondly, there are bugs in QEMU's current imx6 sd controller emulation, because if you do that then the guest kernel continuously prints

[   28.971663] mmc1: Timeout waiting for hardware interrupt.
[   28.973619] mmc1: error -110 whilst initialising SD card

...所以它找到了模拟卡,但没有得到预期的中断.

...so it has found the emulated card but isn't getting an interrupt it expects.

这些可以通过当前在 qemu-devel 邮件列表上的补丁修复并通过代码审查:http://patchwork.ozlabs.org/patch/834805/ 加上对 hw/arm/fsl-imx6.c 的简单更改,使其创建 TYPE_IMX_USDHC 设备而不是 TYPE_SYSBUS_SDHCI.(基本上,imx6 的 SD 控制器不是完全标准兼容的 sdhci 控制器,但我们在 QEMU 模型中创建的是普通类型.)

These can be fixed by a patch currently on the qemu-devel mailing lists and going through code review: http://patchwork.ozlabs.org/patch/834805/ plus a simple change to hw/arm/fsl-imx6.c to make it create TYPE_IMX_USDHC devices rather than TYPE_SYSBUS_SDHCI. (Basically the imx6's SD controller isn't a completely standard compatible sdhci controller but what we were creating in the QEMU model was the plain variety.)

如果你这样做了,那么你就可以启动一个可以看到 mmc 卡的内核:

If you do all that then you can boot a kernel that can see the mmc card:

[    8.878283] mmc1: new SD card at address 4567
[    8.910566] mmcblk0: mmc1:4567 QEMU! 256 MiB 

如果幸运的话,我们将能够在 QEMU 2.12 版本中修复此问题,该版本将于 2018 年春季发布.

With a little luck we'll be able to have this fixed in the 2.12 release of QEMU, which will be out in some time in spring 2018.

截至 2018 年 3 月 9 日编辑——相关修复现在在 QEMU 主控中(提交 fd1e5c81796、df2a5cf4c8)并将在 2.12 中.

Edit as of 9 Mar 2018 -- the relevant fixes are now in QEMU master (commits fd1e5c81796, df2a5cf4c8) and will be in 2.12.

这篇关于Qemu Freescale i.MX6 DualLite SABRE:根文件系统未挂载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆