OpenBSD -current doesn't boot on Raspberry Pi 3 Model B+

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

OpenBSD -current doesn't boot on Raspberry Pi 3 Model B+

Andrey Melentyev
Hello,

OpenBSD -current doesn't boot on Raspberry Pi 3 Model B+.
Tried snapshots from 2018-09-25, 2018-09-26 and 2018-09-30.

The hardware setup is: raspberry pi 3b+ is connected to a laptop
using serial console via PL2303HX. There are no more devices
plugged into the pi, except for the microSD card with miniroot.

The installation process is described in
https://undeadly.org/cgi?action=article&sid=20170409123528
and seems to comply with recommendations in INSTALL.arm64

There are new (compared to OpenBSD 6.3 release) warnings from u-boot:

    libfdt fdt_check_header(): FDT_ERR_BADMAGIC
    FDT memrsv map 0: Failed to add to map

The boot process continues to the OpenBSD boot loader, attempts to boot
the kernel, then the device reboots and the process starts over.

What I tried so far:

- OpenBSD 6.3 stable - everything works fine, I can boot into the
  installer and finish the installation.
- Upgrading Raspberry Pi firmware by downloading a newer version from
  GitHub and replacing the files in the miniroot - doesn't work.
- Replacing the Raspberry Pi firmware and u-boot with the one from
  OpenBSD 6.3 release - it works.
- Replacing just the u-boot.bin with the version from 6.3 - works too.

Unless I'm missing something, U-Boot version makes a difference. Searching
the internet and mailing list archives for raspberry-related issues
didn't yield any relevant results; the FDT_ERR_BADMAGIC message pops up
every here and there but without any actionable insights.

Question: is this a known issue that is already tracked? If not, should
I raise it with U-Boot or is it still an OpenBSD problem somehow?

Here's the full output of a problematic boot using a recent snapshot:

U-Boot 2018.09 (Sep 15 2018 - 03:19:53 -0600)

DRAM:  948 MiB
RPI 3 Model B+ (0xa020d3)
MMC:   mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT... *** Warning - bad CRC, using default environment

In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
USB0:   scanning bus 0 for devices... 5 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot:  2  1  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
[18tScanning disk [hidden email]...
Card did not respond to voltage select!
Scanning disk [hidden email]...
Disk [hidden email] not ready
Scanning disk usb_mass_storage.lun0...
Found 6 disks
FDT memrsv map 0: Failed to add to map
116963 bytes read in 12 ms (9.3 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
FDT memrsv map 0: Failed to add to map
## Starting EFI application at 00080000 ...
>> OpenBSD/arm64 BOOTAA64 0.13
|/-boot>
\|/cannot open sd0a:/etc/random.seed: No such file or directory
booting sd0a:/bsd: -\|/-2667920\|/-\|/-\|/-\|/-\| <-- a very long line


^^ at this point the device reboots.

And here's the output from one of the recent snapshots but with u-boot.bin
from 6.3 release:

U-Boot 2018.03 (Mar 20 2018 - 04:28:27 -0600)

DRAM:  948 MiB
RPI 3 Model B+ (0xa020d3)
MMC:   mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT... *** Warning - bad CRC, using default environment

Failed (-5)
In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
USB0:   Core Release: 2.80a
scanning bus 0 for devices... 4 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  2  1  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
Scanning disk [hidden email]...
Card did not respond to voltage select!
Scanning disk [hidden email]...
Disk [hidden email] not ready
Found 3 disks
116963 bytes read in 15 ms (7.4 MiB/s)
## Starting EFI application at 01000000 ...
>> OpenBSD/arm64 BOOTAA64 0.13
|/-boot>
\|/cannot open sd0a:/etc/random.seed: No such file or directory
booting sd0a:/bsd: -\|/-2700940\|/-\|/-\|/-\| <-- another very long line here
type 0x0 pa 0x0 va 0x0 pages 0x1 attr 0x8
type 0x7 pa 0x1000 va 0x0 pages 0x1ff attr 0x8
type 0x2 pa 0x200000 va 0x200000 pages 0x4000 attr 0x8
type 0x7 pa 0x4200000 va 0x0 pages 0x3e00 attr 0x8
type 0x6 pa 0x8000000 va 0x3e024be000 pages 0x8 attr 0x8000000000000008
type 0x7 pa 0x8009000 va 0x0 pages 0x311fd attr 0x8
type 0x2 pa 0x39206000 va 0x39206000 pages 0x4 attr 0x8
type 0x0 pa 0x39f40000 va 0x39f40000 pages 0x1 attr 0x8
type 0x2 pa 0x39f41000 va 0x39f41000 pages 0x146a attr 0x8
type 0x5 pa 0x3b3ab000 va 0x3e35869000 pages 0x1 attr 0x8000000000000008
type 0x2 pa 0x3b3ac000 va 0x39f41000 pages 0x54 attr 0x8
type 0xb pa 0x3f100000 va 0x3e3586a000 pages 0x1 attr 0x8000000000000000
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2018 OpenBSD. All rights reserved.  https://www.OpenBSD.org

OpenBSD 6.4 (RAMDISK) #484: Sat Sep 29 21:48:31 MDT 2018
    [hidden email]:/usr/src/sys/arch/arm64/compile/RAMDISK
real mem  = 958382080 (913MB)
avail mem = 894857216 (853MB)
mainbus0 at root: Raspberry Pi 3 Model B Plus Rev 1.3
cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
cpu0: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu0: 512KB 64b/line 16-way L2 cache
efi0 at mainbus0: UEFI 2.7
efi0: Das U-Boot rev 0x0
simplefb0 at mainbus0: 656x416, 32bpp
wsdisplay0 at simplefb0
wsdisplay0: screen 0 added (std, vt100 emulation)
simplebus0 at mainbus0: "soc"
bcmintc0 at simplebus0
bcmdog0 at simplebus0
bcmrng0 at simplebus0
pluart0 at simplebus0
bcmaux0 at simplebus0
com0 at sim����: ns16550, no workingcom0: console
dwctwo0 at simplebus0
simplebus1 at mainbus0: "clocks"
agtimer0 at mainbus0: tick rate 19200 KHz
usb0 at dwctwo0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "Broadcom DWC2 root hub" rev 2.00/1.00 addr 1
uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard Microsystems product 0x2514" rev 2.00/b.b3 addr 2
uhub2 at uhub1 port 1 configuration 1 interface 0 "Standard Microsystems product 0x2514" rev 2.00/b.b3 addr 3
softraid0 at root
scsibus0 at softraid0: 256 targets
bootfile: sd0a:/bsd
boot device: lookup sd0a:/bsd failed
root on rd0a swap on rd0b dump on rd0b
WARNING: CHECK AND RESET THE DATE!
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/arm64 6.4 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?


/Andrey

Reply | Threaded
Open this post in threaded view
|

Re: OpenBSD -current doesn't boot on Raspberry Pi 3 Model B+

Andrey Melentyev
On Sunday, September 30, 2018 8:25 PM, Andrey Melentyev <[hidden email]> wrote:

> OpenBSD -current doesn't boot on Raspberry Pi 3 Model B+.
> Tried snapshots from 2018-09-25, 2018-09-26 and 2018-09-30.
>
> libfdt fdt_check_header(): FDT_ERR_BADMAGIC
> FDT memrsv map 0: Failed to add to map

I did some digging and it looks like the breakage is due to u-boot
changing their expectations for the address of the DT. According to
https://github.com/u-boot/u-boot/commit/385cbe298a6ddcab2d6cc21fb6a549152572957b#diff-4423363118839006e390baeab521e520
the new address is 0x02600000, so to make it work, config.txt needs to
contain:

arm_64bit=1
enable_uart=1
device_tree_address=0x02600000
kernel=u-boot.bin

there may also be other ways which I haven't tried, for example u-boot
seems to check broadcom/ directory for .dtb files, see https://github.com/u-boot/u-boot/commit/5d3c4ba19f0537313aa23f29894bc05952f08206
but expects to have different file names, where instead of bcm2710-
prefix for RPI-3, bcm2835- is used. And the third option can be to
include a u-boot script which does some custom loading.

Unless I got it completely wrong, the following small config.txt
change needs to be applied to -current in order to unbreak booting
on RPI3.

diff --git a/distrib/arm64/miniroot/Makefile b/distrib/arm64/miniroot/Makefile
index cee5434e5be..a418daca7df 100644
--- a/distrib/arm64/miniroot/Makefile
+++ b/distrib/arm64/miniroot/Makefile
@@ -65,7 +65,7 @@ do_files:
        mkdir -p ${MOUNT_POINT}/efi/boot
        cp /usr/mdec/BOOTAA64.EFI ${MOUNT_POINT}/efi/boot/bootaa64.efi
        echo bootaa64.efi > ${MOUNT_POINT}/efi/boot/startup.nsh
-       echo 'arm_control=0x200\nenable_uart=1\ndevice_tree_address=0x100\nkernel=u-boot.bin' > ${MOUNT_POINT}/config.txt
+       echo 'arm_64bit=1\nenable_uart=1\ndevice_tree_address=0x02600000\nkernel=u-boot.bin' > ${MOUNT_POINT}/config.txt
        dd if=${PUBOOT}/pine64_plus/u-boot-sunxi-with-spl.bin \
            of=${VND_CDEV} bs=1024 seek=8