As noted here, I am trying to experiment with mainline U-Boot in the hopes of getting specific hardware behavior at power-on, before the kernel is loaded. I am using EMMC only. NO SDCARD.
I am using the image for the current release of Batocera (v34), which runs fine “stock.” The Batocera image includes the MBR and a u-boot binary–“U-Boot 2021.07-24128-g0cd076b58b” to be precise.
I have compiled U-Boot from mainline using the Radxa Zero defconfig and it compiles fine. I used the U-Boot build instructions from the Radxa wiki to generate the new u-boot.bin file from the compiled bl33.bin and the other components in the FIP repo. The version string for the new build is “U-Boot 2022.07-rc6-dirty.” However, no matter how I try to flash it, the board will either continue loading U-Boot 2021.07-24128-g0cd076b58b, or it will not boot at all and only output G12A:BL:0253b8:61aa2d;FEAT:E0F83180:2000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK:1F;SD?:20000;USB:8;
I have tried:
$ sudo /home/theophile/.nexustools/fastboot erase mmc0
$ sudo /home/theophile/.nexustools/fastboot erase mmc0boot0
$ sudo /home/theophile/.nexustools/fastboot erase mmc0boot1
$ sudo /home/theophile/.nexustools/fastboot flash mmc0 ~/Downloads/batocera-s905gen2-34-20220611.img
$ sudo /home/theophile/.nexustools/fastboot flash mmc0boot0 ~/temp/rz-uboot/fip/radxa-zero/u-boot.bin
$ sudo /home/theophile/.nexustools/fastboot flash mmc0boot1 ~/temp/rz-uboot/fip/radxa-zero/u-boot.bin
All commands complete successfully, but when I boot, U-Boot 2021.07-24128-g0cd076b58b is what loads.
I have tried putting the device into mass storage mode and then doing:
sudo dd if=~/temp/rz-uboot/fip/radxa-zero/u-boot.bin of=/dev/sdg bs=1 count=444; sync
sudo dd if=~/temp/rz-uboot/fip/radxa-zero/u-boot.bin of=/dev/sdg bs=512 skip=1 seek=1; sync
Again, I just keep getting U-Boot 2021.07-24128-g0cd076b58b.
According to this, the SOC looks for bootloaders in the order of mmcblk0, mmcblk0boot0, and mmcblk0boot1, and boots the first one it finds. I assume that the fastboot flash targets mmc0boot0 and mmc0boot1 correspond to mmcblk0boot0 and mmcblk0boot1. If I’m understanding correctly, that means that the SOC must be finding U-Boot 2021.07-24128-g0cd076b58b in mmcblk0 and boots it without proceeding to check in mmc0boot0 or mmc0boot1.
I would have thought that the sudo dd if=~/temp/rz-uboot/fip/radxa-zero/u-boot.bin of=/dev/sdg bs=512 skip=1 seek=1; sync
command would write to mmcblk0, but apparently that’s not the case because even after doing that, I still get U-Boot 2021.07-24128-g0cd076b58b.
I even tried to replace U-Boot directly in the Batocera image before flashing it:
dd conv=notrunc if=rz-uboot/fip/radxa-zero/u-boot.bin of=batocera-s905gen2-34-20220611.img bs=512 skip=1 seek=1
But after flashing this modified image, I only get
G12A:BL:0253b8:61aa2d;FEAT:E0F83180:2000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK:1F;SD?:20000;USB:8;
I tried erasing mmc0, mmc0boot0, and mmc0boot1 in fastboot and then flashing the new U-Boot image to mmc0boot0 and mmc0boot1 without flashing any image to mmc0. I figured that this would result in the new U-Boot loading, although it obviously would not be able to boot beyond this because it would not be able to find a system image. But that does not work either, only giving me:
G12A:BL:0253b8:61aa2d;FEAT:E0F83180:2000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK:1F;SD?:20000;USB:8;
I do not understand the behavior I am seeing. What do I have to do to flash my new U-Boot image to the emmc so that it actually loads?