Zeltrax
Zeltrax

Reputation: 319

How to set MMC number in QEMU raspi4b

I have a task relate to u-boot and have to simulate raspberry pi 4 when I am working remotely. I got the image here(the rasberrypi4-64 one). Because the QEMU use mmc 1 but image has some hardcoded mmcblk0 and real device use mmc 0 also then QEMU doesn't work.

Some output from QEMU:

U-Boot 2022.01 (Jan 10 2022 - 18:46:34 +0000)

DRAM:  960 MiB
RPI 4 Model B (0xb03115)
MMC:   mmcnr@7e300000: 1, mmc@7e340000: 0
Loading Environment from FAT... MMC: no card present
In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0
U-Boot> ls mmc 0
MMC: no card present
Couldn't find partition mmc 0
U-Boot> ls mmc 1
    52556   bcm2711-rpi-400.dtb
    52424   bcm2711-rpi-4-b.dtb
    53165   bcm2711-rpi-cm4.dtb
    52460   bootcode.bin
      154   boot.scr
      399   cmdline.txt
     2274   config.txt
     3170   fixup4cd.dat
     5399   fixup4.dat
     8379   fixup4db.dat
     8379   fixup4x.dat
     3170   fixup_cd.dat
     7262   fixup.dat
    10228   fixup_db.dat
    10226   fixup_x.dat
 24617472   Image
   561672   kernel8.img
            overlays/
        0   rpi-bootfiles-20220830.stamp
   803964   start4cd.elf
  3744808   start4db.elf
  2249280   start4.elf
  2996680   start4x.elf
   803964   start_cd.elf
  4816712   start_db.elf
  2973536   start.elf
  3720360   start_x.elf
     2117   uEnv.txt

27 file(s), 1 dir(s)

U-Boot> ls mmc 1:2
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
<DIR>       4096 bin
<DIR>       4096 boot
<DIR>       4096 data
<DIR>       4096 dev
<DIR>       4096 etc
<DIR>       4096 home
<SYM>          7 lg
<DIR>       4096 lib
<SYM>         19 linuxrc
<DIR>       4096 media
<DIR>       4096 mnt
<DIR>       4096 opt
<DIR>       4096 overlay
<DIR>       4096 proc
<DIR>       4096 run
<DIR>       4096 sbin
<DIR>       4096 share
<DIR>       4096 srv
<DIR>       4096 sys
<DIR>       4096 tmp
<DIR>       4096 usr
<DIR>       4096 var
U-Boot> mmc info
MMC: no card present
U-Boot> mmc list
mmcnr@7e300000: 1 (SD)
mmc@7e340000: 0
U-Boot>

I extracted to get .wic file and renamed it to sd.wic, also qemu-img resize it to 16G. I got 0.fat file inside the wic and extracted to 0 folder. QEMU command:

qemu-system-aarch64 -M raspi4b -dtb 0/bcm2711-rpi-4-b.dtb -m 2G -smp 4 -sd sd.wic -kernel 0/kernel8.img -append "console=ttyAMA0" -serial stdio

also try

qemu-system-aarch64 -M raspi4b -dtb 0/bcm2711-rpi-4-b.dtb -m 2G -smp 4 -drive file=sd.wic,if=sd,index=0,format=raw -kernel 0/kernel8.img -append "console=ttyAMA0" -serial stdio

but nothing work. How can I force QEMU use the mmc 0 ?

Upvotes: 1

Views: 287

Answers (0)

Related Questions