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

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

问题描述

目标:模仿Qemu特别支持的"sabrelite:飞思卡尔i.MX6 Quad SABRE Lite板(Cortex A9)"(显示为"qemu-system-arm -M?").

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

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

查看类似板卡使用的U-Boot配置文件,我发现将'root =/dev/mmcblk0p0'用作内核的root =参数. 因此,要尝试一下,我然后按以下方式运行qemu(请同时水平滚动以查看):

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

[...]

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

[...]
[    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...

永远在这里等着...

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

解决方案

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

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

第二,QEMU当前的imx6 sd控制器仿真中存在错误,因为如果执行此操作,则来宾内核会连续打印

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

...因此它找到了仿真卡,但没有收到预期的中断.

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

如果您执行了所有操作,则可以引导可以看到mmc卡的内核:

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

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

截至2018年3月9日进行编辑-相关修复程序现在位于QEMU master中(提交fd1e5c81796,df2a5cf4c8),版本为2.12.

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 ver: 2.10.1 (host: fedora-27).

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).

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 ...

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,

解决方案

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

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.

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.)

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 

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.

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天全站免登陆