0

I am trying to start a QEMU sabrelite machine with U-Boot. I am managed to build it according to guide.

I run it as

./qemu-6.1.0/build/qemu-system-arm \
    -M sabrelite \
    -m 1G \
    -kernel u-boot \
    -drive file=disk.img,format=raw,id=mycard \
    -device sd-card,drive=mycard,bus=sd-bus \
    -serial null \
    -serial stdio \
    -nic user \
    -no-reboot

Disk.img is a raw formatted file with the first vfat partition. I tried partition types 0xc 'EFI (FAT-12/16/32)' and 0xef 'W95 FAT32 (LBA)'. It starts with a bundle of errors.

U-Boot 2021.07 (Aug 24 2021 - 19:43:55 +0300)

CPU:   Freescale i.MX6Q rev1.0 at 792 MHz
Reset cause: POR
Model: Freescale i.MX6 Quad SABRE Lite Board
Board: SABRE Lite
I2C:   ready
DRAM:  1 GiB
force_idle_bus: sda=0 scl=0 sda.gp=0x5c scl.gp=0x55
force_idle_bus: failed to clear bus, sda=0 scl=0
force_idle_bus: sda=0 scl=0 sda.gp=0x6d scl.gp=0x6c
force_idle_bus: failed to clear bus, sda=0 scl=0
force_idle_bus: sda=0 scl=0 sda.gp=0xcb scl.gp=0x5
force_idle_bus: failed to clear bus, sda=0 scl=0
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... *** Warning - No block device, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   using phy at 6
FEC [PRIME]
Error: FEC address not set.
, usb_ether
Error: usb_ether address not set.

starting USB...
Bus usb@2184000: usb dr_mode not found
probe failed, error -22
Bus usb@2184200: probe failed, error -22
No working controllers found
Hit any key to stop autoboot:  0
SATA Device Info:
S/N:
Product model number:
Firmware version:
Capacity: 0 sectors

Device 0: starting USB...
Bus usb@2184000: usb dr_mode not found
probe failed, error -22
Bus usb@2184200: probe failed, error -22
No working controllers found
USB is stopped. Please issue 'usb start' first.
starting USB...
Bus usb@2184000: usb dr_mode not found
probe failed, error -22
Bus usb@2184200: probe failed, error -22
No working controllers found
*** ERROR: `ethaddr' not set
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
*** ERROR: `serverip' not set
…
=> mmcinfo
=> mmc list
FSL_SDHC: 0
FSL_SDHC: 1

The issue is that SD/MMC and USB Storage fails. So, I am not able to load an OS. I came across a discussion. It mentions that this board have some SD controller specific and that there were SD related bug. But the fix was applied a couple years ago.

I guess there is a mismatch between QEMU and U-Boot SD controller definitions. But I have no idea how to fix it. I would be relly happy if anyone could give me a hint.

Real i.MX6Q SABRE Lite board boots from SPI-NOR flash that is preloaded with U-Boot. QEMU emulates it as sst25vf016b device. I tried to load it with a proprietary bootloader as

-device sst25vf016b,drive=spi \
-drive if=none,file=flash.bin,format=raw,id=spi \

But it doesn’t work. Is it possible to bootload a QEMU sabrelite machine this way?

Some time later... I built a linux kernel and started it with rootfs from an SD card. QEMU 5.1.0, 5.2.0, 6.0.0 and 6.1.0 plus linux handles SD/MMC well.

[   10.400092] sdhci: Secure Digital Host Controller Interface driver
[   10.401012] sdhci: Copyright(c) Pierre Ossman
[   10.401982] sdhci-pltfm: SDHCI platform and OF driver helper
[   10.425404] caam 2100000.crypto: device ID = 0x0000000000000000 (Era -524)
[   10.427688] sdhci-esdhc-imx 2198000.mmc: Got CD GPIO
[   10.427954] caam 2100000.crypto: job rings = 2, qi = 0
[   10.429650] sdhci-esdhc-imx 2198000.mmc: Got WP GPIO
[   10.435224] sdhci-esdhc-imx 219c000.mmc: Got CD GPIO
[   10.459144] caam_jr 2101000.jr: failed to flush job ring 0
[   10.472458] caam_jr: probe of 2101000.jr failed with error -5
[   10.481084] caam_jr 2102000.jr: failed to flush job ring 1
[   10.488221] caam_jr: probe of 2102000.jr failed with error -5
[   10.507965] usbcore: registered new interface driver usbhid
[   10.515781] usbhid: USB HID core driver
[   10.571593] mmc2: SDHCI controller on 2198000.mmc [2198000.mmc] using ADMA
[   10.583693] mmc3: SDHCI controller on 219c000.mmc [219c000.mmc] using ADMA
[   10.590880] ipu1_csi0: Registered ipu1_csi0 capture as /dev/video0
[   10.611980] ipu1_ic_prpenc: Registered ipu1_ic_prpenc capture as /dev/video1
[   10.622227] ipu1_ic_prpvf: Registered ipu1_ic_prpvf capture as /dev/video2
[   10.643235] ipu1_csi1: Registered ipu1_csi1 capture as /dev/video3
[   10.655850] ipu2_csi0: Registered ipu2_csi0 capture as /dev/video4
[   10.660920] ipu2_ic_prpenc: Registered ipu2_ic_prpenc capture as /dev/video5
[   10.670717] ipu2_ic_prpvf: Registered ipu2_ic_prpvf capture as /dev/video6
[   10.690556] ipu2_csi1: Registered ipu2_csi1 capture as /dev/video7
[   10.702178] mmc3: host does not support reading read-only switch, assuming write-enable
[   10.710571] mmc3: new high speed SD card at address 4567
[   10.729816] mmcblk3: mmc3:4567 QEMU! 32.0 MiB

I bet that it is a U-Boot issue. On the other hand I believe that U-Boot works with real hardware. Probably it is worth it to use U-Boot from Boundary? Can anyone with a real board confirm what U-Boot version does it support?

Evgeni Lipatov
  • 326
  • 3
  • 12
  • I'm glad to see you trying current mainline U-Boot. To rule out some possible problems, I see the guide you link to says it was tested on v2020.10. Have you confirmed the rest of your setup works that way? That would help to give a good/bad point for git bisect and to find the problematic commit. Or show there's another problem with your steps. – Tom Rini Aug 25 '21 at 22:16
  • I downgraded U-Boot to V2020.10 builded from https://github.com/u-boot/u-boot I am not sure what QEMU version was used by the guide author. I tried versions 6.0.0 and 6.1.0 - both have the same issue SD/MMC. Also I tried 5.1.0 and 5.2.0 - U-Boot does not start at all. After that I tried nitrogen6q_defconfig (these boards seem to be pretty the same) - U-Boot loads with similar SD issues. I came across https://github.com/boundarydevices/u-boot-imx6/tree/boundary-v2020.10 U-Boot starts, but hangs at DDR initialization. This tree differs from the mainline quite a lot and is actively updated. – Evgeni Lipatov Aug 26 '21 at 19:54

0 Answers0