Re: uBoot broken on RPI2 Model B?

From: Karl Denninger <karl_at_denninger.net>
Date: Sat, 04 Mar 2023 14:03:12 UTC
On 3/4/2023 03:48, Mark Millard wrote:
> On Mar 3, 2023, at 23:21, Emmanuel Vadot<manu@bidouilliste.com>  wrote:
>
>> On Fri, 3 Mar 2023 16:12:48 -0500
>> Karl Denninger<karl@denninger.net>  wrote:
>>
>>> Just tried to build -13STABLE for the RPi2 and ran into this (I'm using
>>> Crochet and have had to make some changes to the board-specific files,
>>> but it appears the problem that results in it not working is in uboot;
>>> I've made a number of changes since it looks like the system now wants
>>> to boot off EFI as opposed to what worked in -12, which would be ok if
>>> it can find the boot device -- I think (may be wrong here)
>>>
>>> U-Boot 2023.01 (Jan 26 2023 - 04:25:18 +0000)
>>>
>>> DRAM:  948 MiB
>>> RPI 2 Model B (0xa21041)
>>> Core:  70 devices, 13 uclasses, devicetree: board
>>> MMC:   mmc@7e300000: 1
>>> Loading Environment from FAT... ** Bad device specification mmc 0 **
>>> In:    serial
>>> Out:   vidconsole
>>> Err:   vidconsole
>>> Net:   No ethernet found.
>>> starting USB...
>>> Bus usb@7e980000: USB DWC2
>>> scanning bus usb@7e980000 for devices... 3 USB Device(s) found
>>>         scanning usb for storage devices... 0 Storage Device(s) found
>>> Hit any key to stop autoboot:  0
>>> U-Boot>
>>>
>>> Needless to say if I let it try to continue it fails as it can't find
>>> the SD card and "mmc dev" shows nothing present.
>>>
>>> Obviously going to dig into this further myself but I recalled something
>>> about this uBoot version being broken on older Pis...
>>>
>>> The layout of the disk on the boot partition is thus:
>>>
>>> root@NewFS:/mnt # ls -la
>>> total 12679
>>> drwxr-xr-x   1 root  wheel    16384 Dec 31  1979 .
>>> drwxr-xr-x  35 root  wheel       42 Jan 20 10:16 ..
>>> drwxr-xr-x   1 root  wheel     4096 Feb 13 11:09 EFI
>>> -rwxr-xr-x   1 root  wheel      709 Feb 13 11:09 README
>>> -rwxr-xr-x   1 root  wheel    26745 Feb 13 11:09 bcm2709-rpi-2-b.dtb
>>> -rwxr-xr-x   1 root  wheel    52456 Feb 13 11:09 bootcode.bin
>>> -rwxr-xr-x   1 root  wheel      141 Feb 13 11:09 config.txt
>>> -rwxr-xr-x   1 root  wheel     7314 Feb 13 11:09 fixup.dat
>>> -rwxr-xr-x   1 root  wheel     3187 Feb 13 11:09 fixup_cd.dat
>>> -rwxr-xr-x   1 root  wheel    10298 Feb 13 11:09 fixup_db.dat
>>> -rwxr-xr-x   1 root  wheel    10298 Feb 13 11:09 fixup_x.dat
>>> drwxr-xr-x   1 root  wheel    20480 Feb 13 11:09 overlays
>>> -rwxr-xr-x   1 root  wheel    21169 Feb 13 11:09 rpi2.dtb
>>> -rwxr-xr-x   1 root  wheel  2952960 Feb 13 11:09 start.elf
>>> -rwxr-xr-x   1 root  wheel   793116 Feb 13 11:09 start_cd.elf
>>> -rwxr-xr-x   1 root  wheel  4794472 Feb 13 11:09 start_db.elf
>>> -rwxr-xr-x   1 root  wheel  3704808 Feb 13 11:09 start_x.elf
>>> -rwxr-xr-x   1 root  wheel   521916 Feb 13 11:09 u-boot.bin
>>>
>>> root@NewFS:/mnt # ls -laR EFI
>>> total 24
>>> drwxr-xr-x  1 root  wheel   4096 Feb 13 11:09 .
>>> drwxr-xr-x  1 root  wheel  16384 Dec 31  1979 ..
>>> drwxr-xr-x  1 root  wheel   4096 Feb 13 11:09 BOOT
>>>
>>> EFI/BOOT:
>>> total 140
>>> drwxr-xr-x  1 root  wheel    4096 Feb 13 11:09 .
>>> drwxr-xr-x  1 root  wheel    4096 Feb 13 11:09 ..
>>> -rwxr-xr-x  1 root  wheel  133812 Feb 13 11:09 bootarm.efi
>>>
>>> root@NewFS:/mnt # more config.txt
>>> init_uart_clock=3000000
>>> enable_uart=1
>>> kernel=u-boot.bin
>>> kernel7=u-boot.bin
>>> dtoverlay=mmc
>>> audio_pwm_mode=2
>>> dtparam=audio=on,i2c_arm=on,spi=on
>>>
>>> root@NewFS:/mnt # ls -la overlays | grep mmc
>>> -rwxr-xr-x  1 root  wheel    1221 Feb 13 11:09 mmc.dtbo
>>>
>>> Which I BELIEVE should work -- assuming that I can get "see" the SD card
>>> from u-boot that is....
>>>
>>> Installed rpi-related packages:
>>>
>>> root@NewFS:/mnt # pkg info|grep rpi
>>> rpi-firmware-1.20210303.g20210303 Firmware for RaspberryPi Single Board
>>> Computer
>>> u-boot-rpi2-2023.01            Cross-build das u-boot for model rpi2
>>> u-boot-rpi3-2023.01            Cross-build das u-boot for model rpi3
>>> u-boot-rpi4-2023.01            Cross-build das u-boot for model rpi4
>>>
>>> -- 
>>> Karl Denninger
>>> karl@denninger.net
>>> /The Market Ticker/
>>> /[S/MIME encrypted email preferred]/
>> I would not be the first time that a u-boot update break booting on a
>> board. I didn't test on RPI* the last two (or three) update.
>> Just to be sure could you test the official image ? Latest armv7
>> 14-CURRENT snapshot should have the last u-boot.
> Karl reported that he was using boot1.efi instead of
> loader.efi and just substituting in the likes of
> loader.efi got booting to work.
>
> Why boot1.efi ? Because that is what Crochet put in
> place.
>
Yes, and I remember when 13-x first showed up on my AMD box suddenly 
boot1 blew up there too which was a nasty little and unexpected 
surprise.  Not a big deal to fix once you realize what is going on but 
given the fact that u-boot updates have blown up booting on these 
devices before (and I've kept older versions around for this reason) 
that prompted me to ask if anyone else had seen a similar problem with 
the older Pi2s (my '3s are all ok with modern builds) on 13.x

I've fixed Crochet to build and use the lua loader rather than boot1 for 
EFI and it appears to be working fine.

-- 
Karl Denninger
karl@denninger.net
/The Market Ticker/
/[S/MIME encrypted email preferred]/