On Sun, Jun 18, 2023 at 08:40:28AM +0800, qianfan wrote: > > 在 2023/6/18 0:29, Guenter Roeck 写道: > > Hi, > > > > On Tue, May 23, 2023 at 06:04:58PM +0800, qianfangui...@163.com wrote: > > > From: qianfan Zhao <qianfangui...@163.com> > > > > > > Allwinner R40 (sun8i) SoC features a Quad-Core Cortex-A7 ARM CPU, > > > and a Mali400 MP2 GPU from ARM. It's also known as the Allwinner T3 > > > for In-Car Entertainment usage, A40i and A40pro are variants that > > > differ in applicable temperatures range (industrial and military). > > > > > > Signed-off-by: qianfan Zhao <qianfangui...@163.com> > > > Reviewed-by: Niek Linnenbank <nieklinnenb...@gmail.com> > > I tried this in mainline linux with the following command. > > > > qemu-system-arm -M bpim2u \ > > -kernel arch/arm/boot/zImage -no-reboot \ > > -snapshot -drive file=rootfs-armv7a.ext2,format=raw,if=sd \ > > -nic user \ > > --append "root=/dev/mmcblk0 rootwait console=ttyS0,115200" \ > > -dtb arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dtb \ > > -nographic -monitor null -serial stdio > > > > Main problem is that the SD card gets instantiated randomly to > > mmc0, mmc1, or mmc2, making it all but impossible to specify a > > root file system device. The non-instantiated cards are always > > reported as non-removable, including mmc0. Example: > > > > mmc0: Failed to initialize a non-removable card > > > > Using "-sd <file>" instead of "-drive file=<file>" does not > > make a difference. > > > > I can fix (work around ?) the problem by adding the following information > > to the devicetree file. > > > > aliases { > > ethernet0 = &gmac; > > serial0 = &uart0; > > + mmc0 = &mmc0; > > + mmc1 = &mmc1; > > + mmc2 = &mmc2; > > }; > > > > Linux upstream commits fa2d0aa96941 and 2a43322ca7f3 describe the > > logic behind this change. > > > > Is this a bug in the Linux kernel, or a problem with the qemu emulation ? > > On my work, the linux kenrel doesn't startup ext4 rootfs directly, it start > > a custom ramdisk and we can handle this in ramdisk scripts. >
That won't help for automated testing. I guess that means the answer to my question below is "no". Thanks, Guenter > > Either case, is there a way to specify a qemu command line that doesn't > > result in random assignments of the provided drive to mmc0/1/2 ? > > > > Thanks, > > Guenter >