BPI R3: How I was able to boot OpenBSD 7.5 and failed. :)

I used the default installation Kernel bsd.rd:

https://ftp.openbsd.org/pub/OpenBSD/7.5/arm64/bsd.rd

Did someone port all the necessary mtk drivers in the default bsd kernel?

No. Otherwise, I would haven gotten further.

which problem is with default dtb? notice that r3 requires the dtbo too for sd/emmc and nand/nor to access these devices…

how far did you got with openbsd? i only see building bootchain till efi boot in uboot and starting the installer (isn’t there any tool similar to debootstrap to get an openbsd rootfs)

but i guess there are drivers missing as eric already mention

Regarding the “default dtb”: Apparently, something is missing. It never goes past the bootloadetr. (See here: Bastelempfehlung FTTH + WiFi + Ethernet + OpenBSD? | Seite 3 | BSDForen.de - Die BSD-Community)

Quite frankly, I do not know how to apply the overlays.

However, using the dtb from the OpenBSD packages works. I can look up the build instructions, if you are interested? They basically use clang-cpp to get from the dts in the Linux Kernel to something dtc understands.

Regarding the “missing drivers”: Yes, OpenBSD is written by enthusiasts with little time. :slight_smile:

in linux we use fit-image wich does the apply of overlays in bootloader automaticly by using specific bootconfig (bootm $kaddr#$bootconf)…no idea how to do this with efi

your error in forum seems to point to rootfs

cannot open sd0a:/etc/random.seed: No such file or directory

which cannot be loaded from mmc if the sd/emmc overlay is not applied :wink:

for testing you could add the changes from dtso to the dts manually instead of replacing the dts

btw. i wonder about your uboot output…you write you use u-boot · GitHub as uboot source, but i see in your bootlog parts from my builtin environment (bpi-r3.itb) :wink:

and when openbds does not support switch you have to write own driver to drive the switch…else you can only use the left sfp on r3 as the other ports are clients of the switch and connected to the second mac

I think even the sfp mac needs ported mtk drivers… Unless someone ports the mtk drivers, you wont be using much of the hardware.

of course…i guess only the syscons are probed without any mtk specific stuff (based on syscon fallback)…only arm64 basic, maybe clock and pinctrl (or they work because already initialized by uboot and not resettet like in linux-drivers)…peripherals are maybe not yet supported…

but missing switch framework (dsa in linux) can be a much larger problem…the full ethernet-stack could be very much work

Yes, the bootlogs are from my first attempt with your bpi-r3 image. It worked, but I really REALLY wanted to know how. :slight_smile:

And there I am still struggling with the first stage bootloader… The one which is hidden somewhere in your sd card image…

I did not record the bootlogs for my approach yet.

Bootrom loads bl2 (img with mtk header with SDMMC_BOOT not the bin) at offset 0x0…on emmc this part (with emmc header) has to be put into boot0 block

Bootrom loads bl2 (img with mtk header with SDMMC_BOOT not the bin) at offset 0x0

Yes, this is the part that I do not understand… Given that the partition starts at Sector 34:

; fdisk /dev/rsd4c
Disk: /dev/rsd4c       Usable LBA: 34 to 12805120 [59406336 Sectors]
   #: type                                 [       start:         size ]
------------------------------------------------------------------------
   0: Linux files*                         [          34:         8158 ]
   1: Linux files*                         [        8192:         1024 ]
   2: Linux files*                         [        9216:         4096 ]
   3: Linux files*                         [       13312:         4096 ]
   4: Linux files*                         [       17408:       204800 ]
   5: OpenBSD                              [      222208:     12582913 ]

; disklabel /dev/sd4c
# /dev/sd4c:
type: SCSI
disk: SCSI disk
label: SD/MMC          
duid: 7162704d6bdfbcd2
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 3697
total sectors: 59406336
boundstart: 222208
boundend: 12805121

16 partitions:
#                size           offset  fstype [fsize bsize   cpg]
  a:         12582912           222208  4.2BSD   2048 16384 12960 
  c:         59406336                0  unused                    
  i:             8158               34  ext2fs                    
  j:             1024             8192  ext2fs                    
  k:             4096             9216  ext2fs                    
  l:             4096            13312  ext2fs                    
  m:           204800            17408  ext2fs

As promised, here is the full bootlog:

F0: 102B 0000
FA: 1040 0000
FA: 1040 0000 [0200]
F9: 103F 0000
F3: 1001 0000 [0200]
F3: 1001 0000
F6: 300C 0028
F5: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 2400 0041 [0000]
G0: 1190 0000
EC: 0000 0000 [3000]
T0: 0000 01CE [010F]
Jump to BL

NOTICE:  BL2: v2.10.0	(release):v2.4-rc0-5845-gbacca82a8
NOTICE:  BL2: Built : 09:21:14, Aug 20 2024
NOTICE:  WDT: Cold boot
NOTICE:  WDT: disabled
NOTICE:  CPU: MT7986 (2000MHz)
NOTICE:  EMI: Using DDR4 settings
NOTICE:  EMI: Detected DRAM size: 2048MB
NOTICE:  EMI: complex R/W mem test passed
NOTICE:  BL2: Booting BL31
NOTICE:  BL31: v2.10.0	(release):v2.4-rc0-5845-gbacca82a8
NOTICE:  BL31: Built : 09:21:19, Aug 20 2024
ofnode_read_bool: bootph-all: true
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: true
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: true
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: true
ofnode_read_u32_index: clock-parent: 0x3 (3)
ofnode_read_u32_index: clock-parent: 0x5 (5)
ofnode_read_u32_index: clock-parent: 0x4 (4)
ofnode_read_u32_index: clock-parent: (not found)
ofnode_read_bool: mediatek,force-highspeed: true


U-Boot 2024.10-rc3 (Aug 20 2024 - 09:20:28 +0200)

ofnode_read_u32_array: ranges: ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_bool: bootph-all: false
ofnode_read_bool: bootph-some-ram: false
ofnode_read_bool: bootph-pre-ram: false
ofnode_read_bool: bootph-pre-sram: false
ofnode_read_bool: u-boot,dm-pre-reloc: false
ofnode_read_bool: u-boot,dm-pre-proper: false
ofnode_read_bool: u-boot,dm-spl: false
ofnode_read_bool: u-boot,dm-tpl: false
ofnode_read_bool: u-boot,dm-vpl: false
ofnode_read_prop: reg: ofnode_read_bool: little-endian: false
ofnode_read_bool: big-endian: false
ofnode_read_bool: native-endian: false
CPU:   MediaTek MT7986
Model: BananaPi BPi-R3
DRAM:  2 GiB
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_bool: gpio-controller: true
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: false
ofnode_read_prop: regulator-name: fixed-3.3V
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_u32_index: clock-parent: 0x3 (3)
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_u32_index: clock-parent: 0x5 (5)
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_u32_index: clock-parent: 0x4 (4)
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_u32_index: clock-parent: (not found)
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_bool: mediatek,force-highspeed: true
Core:  39 devices, 14 uclasses, devicetree: separate
MMC:   ofnode_read_u32_index: bus-width: 0x4 (4)
ofnode_read_u32_index: max-frequency: 0x3197500 (52000000)
ofnode_read_bool: cap-sd-highspeed: true
ofnode_read_bool: cap-mmc-highspeed: false
ofnode_read_bool: sd-uhs-sdr12: false
ofnode_read_bool: sd-uhs-sdr25: false
ofnode_read_bool: sd-uhs-sdr50: false
ofnode_read_bool: sd-uhs-sdr104: false
ofnode_read_bool: sd-uhs-ddr50: false
ofnode_read_bool: mmc-ddr-1_8v: false
ofnode_read_bool: mmc-ddr-1_2v: false
ofnode_read_bool: mmc-hs200-1_8v: false
ofnode_read_bool: mmc-hs200-1_2v: false
ofnode_read_bool: mmc-hs400-1_8v: false
ofnode_read_bool: mmc-hs400-1_2v: false
ofnode_read_bool: mmc-hs400-enhanced-strobe: false
ofnode_read_bool: no-mmc-hs400: false
ofnode_read_bool: non-removable: false
ofnode_read_bool: cd-inverted: false
ofnode_read_bool: broken-cd: false
ofnode_read_bool: no-1-8-v: false
ofnode_read_u32_index: hs400-ds-delay: (not found)
ofnode_read_u32_index: mediatek,hs200-cmd-int-delay: (not found)
ofnode_read_u32_index: cmd_int_delay: (not found)
ofnode_read_u32_index: write_int_delay: (not found)
ofnode_read_u32_index: mediatek,latch-ck: (not found)
ofnode_read_u32_index: latch-ck: (not found)
ofnode_read_u32_index: r_smpl: 0x1 (1)
ofnode_read_bool: mediatek,hs400-cmd-resp-sel-rising: false
ofnode_read_u32_index: builtin-cd: (not found)
ofnode_read_bool: cd-active-high: false
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_bool: gpio-controller: false
ofnode_read_bool: gpio-controller: true
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_prop: assigned-clock-rates: <not found>
mmc@11230000: 0
ofnode_read_u32_index: load-environment: (not found)
Loading Environment from MMC... ofnode_read_u32_index: vmmc-supply: 0xe (14)
ofnode_read_bool: gpios: false
ofnode_read_bool: enable-active-high: false
ofnode_read_bool: regulator-boot-on: true
ofnode_read_u32_index: startup-delay-us: (not found)
ofnode_read_u32_index: off-on-delay-us: (not found)
ofnode_read_u32_index: u-boot,off-on-delay-us: (not found)
ofnode_read_u32_index: regulator-min-microvolt: 0x325aa0 (3300000)
ofnode_read_u32_index: regulator-max-microvolt: 0x325aa0 (3300000)
ofnode_read_u32_index: regulator-init-microvolt: (not found)
ofnode_read_u32_index: regulator-min-microamp: (not found)
ofnode_read_u32_index: regulator-max-microamp: (not found)
ofnode_read_bool: regulator-always-on: true
ofnode_read_bool: regulator-boot-on: true
ofnode_read_u32_index: regulator-ramp-delay: (not found)
ofnode_read_bool: regulator-force-boot-off: false
ofnode_find_subnode: regulator-state-mem: <none>
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_u32_index: vqmmc-supply: 0xe (14)
ofnode_read_prop: u-boot,mmc-env-partition: u-boot-env
Reading from MMC(0)... *** Warning - bad CRC, using default environment

In:    serial@11002000
Out:   serial@11002000
Err:   serial@11002000
Net:   ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_u32_index: clock-parent: 0x5 (5)
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_prop: reg: ofnode_read_bool: little-endian: false
ofnode_read_bool: big-endian: false
ofnode_read_bool: native-endian: false
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_u32_index: mediatek,gmac-id: 0x0 (0)
ofnode_find_subnode: mdio: <none>
ofnode_read_prop: phy-mode: 2500base-x
ofnode_find_subnode: fixed-link: fixed-link
ofnode_read_u32_index: speed: 0x9c4 (2500)
ofnode_read_bool: full-duplex: true
ofnode_read_prop: reg: ofnode_read_bool: little-endian: false
ofnode_read_bool: big-endian: false
ofnode_read_bool: native-endian: false
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_bool: pn_swap: false
ofnode_read_bool: mediatek,pnswap: false
ofnode_read_prop: mediatek,switch: mt7531
ofnode_read_bool: mediatek,mcm: false
ofnode_read_prop: assigned-clock-rates: <not found>
ofnode_read_prop: assigned-clock-rates: <not found>

Warning: ethernet@15100000 (eth0) using random MAC address - 7e:54:dc:35:97:fe
eth0: ethernet@15100000
ofnode_find_subnode: bios: <none>
ofnode_find_subnode: system: <none>
ofnode_read_prop: compatible: mediatek,mt7986
ofnode_read_prop: model: BananaPi BPi-R3
ofnode_find_subnode: baseboard: <none>
ofnode_read_prop: compatible: mediatek,mt7986
ofnode_read_prop: model: BananaPi BPi-R3
ofnode_find_subnode: chassis: <none>
ofnode_read_u32_array: ranges: regmap_raw_read_range: regmap size 3942645758 unknown
ofnode_read_prop: bootcmd: <not found>
ofnode_read_u32_index: bootsecure: (not found)
BPI-R3> fatls mmc 0:5 /
   227979   BOOTAA64.EFI
 18362795   bsd.rd
     9600   mt7986a-bpi-r3-sd.dtb
            debian-installer/
       65   version.info
    18144   mt7986a-bananapi-bpi-r3.dtb

5 file(s), 1 dir(s)

BPI-R3> fatload mmc 0:5 0x46000000 /BOOTAA64.EFI
227979 bytes read in 15 ms (14.5 MiB/s)
BPI-R3> fatload mmc 0:5 0x47000000 /mt7986a-bananapi-bpi-r3.dtb
18144 bytes read in 2 ms (8.7 MiB/s)
BPI-R3> bootefi 0x46000000 0x47000000
No EFI system partition
No EFI system partition
Failed to persist EFI variables
No EFI system partition
Failed to persist EFI variables
No EFI system partition
Failed to persist EFI variables
Booting /\BOOTAA64.EFI
disks: sd0*
>> OpenBSD/arm64 BOOTAA64 1.18
boot> boot bsd.rd
cannot open sd0a:/etc/random.seed: No such file or directory
booting sd0a:bsd.rd: 3023768+1214656+12712936+633232 [269381+91+701664+287051]=0x13edb50
Copyright (c) 1982, 1986, 1989, 1991, 1993
	The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2024 OpenBSD. All rights reserved.  https://www.OpenBSD.org

OpenBSD 7.5 (RAMDISK) #124: Wed Mar 20 20:05:58 MDT 2024
    [email protected]:/usr/src/sys/arch/arm64/compile/RAMDISK
real mem  = 2141921280 (2042MB)
avail mem = 2035347456 (1941MB)
random: boothowto does not indicate good seed
mainbus0 at root: Bananapi BPI-R3
psci0 at mainbus0: PSCI 1.1, SMCCC 1.4, SYSTEM_SUSPEND
efi0 at mainbus0: UEFI 2.10
efi0: Das U-Boot rev 0x20241000
smbios0 at efi0: SMBIOS 3.7.0
smbios0: vendor U-Boot version "2024.10-rc3" date 10/01/2024
smbios0: mediatek BananaPi BPi-R3
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
cpu0: CRC32,SHA2,SHA1,AES+PMULL,ASID16
"secmon" at mainbus0 not configured
"wmcpu-reserved" at mainbus0 not configured
"wo-emi" at mainbus0 not configured
"wo-emi" at mainbus0 not configured
"wo-ilm" at mainbus0 not configured
"wo-ilm" at mainbus0 not configured
"wo-data" at mainbus0 not configured
"wo-dlm" at mainbus0 not configured
"wo-dlm" at mainbus0 not configured
"wo-boot" at mainbus0 not configured
"oscillator-40m" at mainbus0 not configured
agtimer0 at mainbus0: 13000 kHz
simplebus0 at mainbus0: "soc"
agintc0 at simplebus0 shift 4:3 nirq 672 nredist 4: "interrupt-controller"
syscon0 at simplebus0: "infracfg"
syscon1 at simplebus0: "wed-pcie"
syscon2 at simplebus0: "topckgen"
syscon3 at simplebus0: "syscon"
syscon4 at simplebus0: "syscon"
syscon5 at simplebus0: "syscon"
syscon6 at simplebus0: "wed"
syscon7 at simplebus0: "wed"
syscon8 at simplebus0: "syscon"
syscon9 at simplebus0: "syscon"
"watchdog" at simplebus0 not configured
"apmixedsys" at simplebus0 not configured
"pinctrl" at simplebus0 not configured
"rng" at simplebus0 not configured
"crypto" at simplebus0 not configured
"pwm" at simplebus0 not configured
com0 at simplebus�: ns16550a, 16 byte fifo
com0: console
com1 at simplebus0: ns16550a, 16 byte fifo
com2 at simplebus0: ns16550a, 16 byte fifo
"i2c" at simplebus0 not configured
"spi" at simplebus0 not configured
"spi" at simplebus0 not configured
"usb" at simplebus0 not configured
"thermal" at simplebus0 not configured
"pcie" at simplebus0 not configured
"t-phy" at simplebus0 not configured
"efuse" at simplebus0 not configured
"t-phy" at simplebus0 not configured
"ethernet" at simplebus0 not configured
"wifi" at simplebus0 not configured
"regulator-12vd" at mainbus0 not configured
pwmfan0 at mainbus0
"gpio-keys" at mainbus0 not configured
"i2c-gpio-0" at mainbus0 not configured
"i2c-gpio-1" at mainbus0 not configured
"leds" at mainbus0 not configured
"regulator-1p8v" at mainbus0 not configured
"regulator-3p3v" at mainbus0 not configured
sfp0 at mainbus0: can't get i2c bus
sfp1 at mainbus0: can't get i2c bus
softraid0 at root
scsibus0 at softraid0: 256 targets
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 7.5 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? s
# mount
/dev/rd0a on / type ffs (local)


And this is how you can compile a single DTB file:

wget  https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.tar.xz
gtar xvfJ linux-6.5.tar.xz
clang-cpp -nostdinc -I linux-6.5/arch/arm64/boot/dts/mediatek/ -I linux-6.5/scripts/dtc/include-prefixes/ -I linux-6.5/include/ -undef -D__DTS__ -x assembler-with-cpp linux-6.5/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts  | dtc -I dts -O dtb -o mt7986a-bananapi-bpi-r3.okay.dtb -

oh, sorry, bl2 on sdmmc is in partition1, not offset 0x0, as 0x0 is the mbr+gpt (spi was 0x0)

only flash my cards using my build.sh after getting it working for sdmmc :smiley:

but be sure to use the correct file…

and the mainline dts does not contain the mmc and spi related parts which differs for sdmmc/emmc and spi-nand/nor so you have to add these manually or build the dtso to dtbo and combine it with fdtoverlay

Okay! I found the solution to my first problem: Starting from scratch with a fresh SD card always resulted in a


F0: 102B 0000
FA: 1040 0000
FA: 1040 0000 [0200]
F9: 103F 0000
F3: 1001 0000 [0200]
F3: 1001 0000
F6: 300C 0028
F5: 480C 0000
00: 1005 0000
FA: 1040 0000
FA: 1040 0000 [0200]
F9: 103F 0000
F3: 1001 0000 [0200]
F3: 1001 0000
F6: 300C 0028
01: 102A 0001
02: 1005 0000
BP: 2000 00C0 [0001]
EC: 0000 0000 [3000]
T0: 0000 014F [010F]
System halt!

However, after using gdisk to set the attribute for the Partion 1 to “Legacy Bootable” and the name of Partition 4 to “fip”, everything was booting smoothly.

F0: 102B 0000
FA: 1040 0000
FA: 1040 0000 [0200]
F9: 103F 0000
F3: 1001 0000 [0200]
F3: 1001 0000
F6: 300C 0028
F5: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 2400 0041 [0000]
G0: 1190 0000
EC: 0000 0000 [3000]
T0: 0000 0209 [010F]
Jump to BL

So, in other words: The first stage Bootloader was looking for the partition with the “bootable” flag, and the second stage bootloader was looking for the Partition with the name “fip”.

Right, you see in my uboot-repo (mtk-atf branch) in build.sh how i create the image…there are all commands for it including the bootable flag :slight_smile:

You mean this one?

dtc -I dts -O dtb -o mt7986a-bananapi-bpi-r3-sd.dtbo mt7986a-bananapi-bpi-r3-sd.dtso
fdtoverlay -i mt7986a-bananapi-bpi-r3.dtb -o modified-full.dtb  mt7986a-bananapi-bpi-r3-sd.dtbo

(Using a dtso file with fdtoverlay results in a “Overlay ‘mt7986a-bananapi-bpi-r3-sd.dtso’ is incomplete (1024 / 1346656301 bytes read)” error.

Fdtoverlay needs dtbo,right,but you should use the original bpi-r3 dtb not your current bsd version

The “OpenBSD version” is actually taken from the Linux sources. (See above). And it works. :wink:

I am currently cleaning up. I was able to Frankenstein a Debian 12 (Bookworm) on my Bananapi with Linux Kernel 6.10.6. But I used a wild combination of Qemu, Hacks, and your Bullseye release.

? Why not look into the sources or using the bookworm release from my gdrive and looking in the pipelines/build.sh how it is done?

Because it is more fun this way. :slight_smile: Plus: Having a shell script that does the work for you is one thing. UNDERSTANDING how everything is working together is another.