Boot fails with self-build u-boot

Some help from people who are able to test different preloaders is appreciated. What to do:

  1. Take any preloader from this list and install it to resp. boot media. Note the name of preloader you had used and boot media you placed it to (SD or eMMC).
  2. Boot your board into u-boot, good idea would be to capture bootlog. Go to the u-boot command line. Check bootlog to get an idea what was the real bootmedia u-boot was loaded from. Strings to look for: “Load u-boot from SD Card...” or “Load u-boot from eMMC...” or “Boot from SD Card!!” or “Boot from eMMC!!”. Note the string you had found.
  3. In u-boot shell execute “md.b 0x00100048 10”, note the output.
  4. Post the info you had noted to this thread so we can collect and analyze it.

Big thanks to contributors in advance!

We should only use the 2 new preloaders (2019-02-22), because they load entire uboot…

https://github.com/BPI-SINOVOIP/BPI-files/tree/master/SD/100MB.

  • BPI-R2-preloader-DDR1600-20190722-2k.img.gz
  • BPI-R2-EMMC-boot0-DDR1600-20190722-0k.img.gz

Oh my, @sinovoip, it is an epic fail again! Preloaders in files above are bit to bit identical. And if you ungzip BPI-R2-preloader-DDR1600-20190722-2k.img.gz you get a file named BPI-R2-EMMC-boot0-DDR1600-20190722-2k.img - which is exactly what its name implies - BPI-R2-EMMC-boot0-DDR1600-20190722-0k.img prepended with eMMC boot signatures. @sinovoip, why the level of support provided for R2 has to be this bad?

1 Like

I’d say nope, we shouldn’t. It is OK to use older preloaders as long as u-boot binary size is under 300000.

New preloader behavior w.r.t. boot from eMMC/SD is the same as of BPI-R2-720P-DDR1600-2k.img, i.e.: (1) no “eMMC” string at 0x81dffff0 even when u-boot is loaded from eMMC and (2) it always tries to load u-boot from SD card if any SD card is inserted, no matter the position of hardware boot switch. Point (2) is a show-stopper as it breaks the most useful use case for hw bootswitch. The only point in setting hw switch to eMMC position is to force the board to ignore SD card on boot. Having preloader always trying to load u-boot from SD card no matter what makes it impossible.

P.S. It is especially bad for “board set up at some distant location” case. Forgetting to remove SD card from it will lead to a board hang on the next reboot and user having to drive in there just to eject the SD.

@sinovoip

can you please fix the problems described in preloader?

  • load uboot from device where preloader was loaded (maybe make real emmc/sd-preloaders which each load specific device), but better would be let 1 preloader look from which device it was loaded
  • respect boot-switch (can we read out the boot-switch in uboot?)
  • write a string in memory to determine which device was really used to load uboot
  • if the prior bootdevice is no more available, try the other one (needs to be only done if a device-switch is done like now or if first 2 points are conflicting). i don’t know which is done by hardware and which by preloader (does hardware/bootrom read-out the boot-switch and load bootloader from the selected device?)