On 8/11/24 11:48, Mark Kettenis wrote:
Date: Sun, 11 Aug 2024 01:41:32 +0200
From: Thomas Dettbarn <det...@dettus.net>
Hello.
So, I am currently trying to run my favourite operating system
on my shiny new BananaPI BPI-R3. Thus far, I was able to Frankenstein
a u-boot image with the miniroot75.img and got into the OpenBSD
bootloader.
However, whilst loading the bsd.rd MIGHT work, running it does not.
(Please see the .txt file I attached to this email for a full log of the
boot process. It is completely stuck after that last line)
One of my assumptions is that the bootloader itself might load the
bsd.rd to the wrong location in memory, namely the one defined in
/usr/src/sys/arch/arm64/conf/RAMDISK:
makeoptions KERNEL_BASE_PHYS="0x00200000"
makeoptions KERNEL_BASE_VIRT="0xffffff8000200000"
Loading anything to this address on this platform is forbidden:
BPI-R3> fatload mmc 0:5 0x00200000 /efi/boot/bootaa64.efi
** Reading file would overwrite reserved memory **
So my question (to eliminate this hypothesis), can you tell me
if the boot loader is loading the kernel to KERNEL_BASE_PHYS
or KERNEL_BASE_VIRT?
Neither. The bootloader will load the kernel into a block of
memory that is free according to the UEFI memory map.
Now it is entirely possible that your the U-Boot in your frankenstein
setup is busted and doesn't provide a correct UEFI memory map. But
based on your bootlog I have a different hypothesis. Your device tree
might be wrong.
The U-Boot device tree differs from the upstream Linux device tree.
One of the aspects it differs in is the "compatible" property of the
UART. OpenBSD doesn't recognize this alternative "compatible" and
therefor won't find a suitable console device. The result would be no
serial console output.
To test this hypothesis you could take the mt7986a-bananapi-bpi-r3.dtb
device tree from OpenBSD's dtb package and try to load that.
One warning though, support for the MediaTek SoC on this board in
OpenBSD is minimal. Don't expect much more to work than just the
serial port...
Sir, you were correct.
So, on my host PC, I installed the dtb package: pkg_add dtb.
Afterwards, I copied the mt7986a-bananapi-bpi-r3.dtb from
/usr/local/share/dtb/arm64/mediatek to the DOS partition
of my SD card.
As you can see from the log, I did a couple more experiments,
but now I am at a stage where I have a booted OpenBSD kernel on
my board.
Thank you!
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 0221 [010F]
Jump to BL
NOTICE: BL2: v2.6(release):c30a1caf827-dirty sdmmc
NOTICE: BL2: Built : 21:35:11, Aug 10 2024
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.6(release):c30a1caf827-dirty sdmmc
NOTICE: BL31: Built : 21:35:15, Aug 10 2024
U-Boot 2024.07-rc3-mt7986-43599-gbc68f3572ff (Aug 10 2024 - 21:29:30 +0200)
CPU: MediaTek MT7986
Model: BananaPi BPi-R3
DRAM: 2 GiB
Core: 44 devices, 19 uclasses, devicetree: separate
MMC: mmc@11230000: 0
Loading Environment from MMC... Reading from MMC(0)... *** Warning - bad CRC,
using default environment
In: serial@11002000
Out: serial@11002000
Err: serial@11002000
Net:
Warning: ethernet@15100000 (eth0) using random MAC address - 3e:87:d0:f2:fb:c8
eth0: ethernet@15100000
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
26894 bcm2710-rpi-2-b.dtb
29011 bcm2710-rpi-3-b-plus.dtb
28392 bcm2710-rpi-3-b.dtb
26890 bcm2710-rpi-cm3.dtb
49090 bcm2711-rpi-4-b.dtb
48810 bcm2711-rpi-400.dtb
49202 bcm2711-rpi-cm4.dtb
52456 bootcode.bin
65 config.txt
efi/
7314 fixup.dat
5448 fixup4.dat
overlays/
2953312 start.elf
2229120 start4.elf
570680 u-boot.bin
11304 mt7986a-bpi-r3-sd.dtb
18144 mt7986a-bananapi-bpi-r3.dtb
16 file(s), 2 dir(s)
enter kernel-name:
## Error: "kernelinput" not defined
## Error: "initrd" not defined
PARTITION_CONFIG only exists on eMMC
sd available
jedec_spi_nor spi_nor@0: unrecognized JEDEC id bytes: ff, ef, aa
Failed to initialize SPI flash at 0:0 (error -2)
NAND available
sd nand
fit=bpi-r3.itb
Failed to load 'bpi-r3.itb'
BPI-R3> fatload mmc 0:5 0x46000000 /efi/boot/bootaa64.efi
227979 bytes read in 18 ms (12.1 MiB/s)
BPI-R3> bootefi 0x46000000 0x46000000
ERROR: invalid device tree
BPI-R3> bootefi 0x46000000 0x45000000
ERROR: invalid device tree
BPI-R3> bootefi 0x46000000 0x47000000
ERROR: invalid device tree
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
Booting /\efi\boot\bootaa64.efi
disks: sd0*
>> OpenBSD/arm64 BOOTAA64 1.18
boot>
cannot open sd0a:/etc/random.seed: No such file or directory
booting sd0a:/bsd: 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
dera...@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/RAMDISK
real mem = 2141806592 (2042MB)
avail mem = 2035232768 (1940MB)
random: boothowto does not indicate good seed
mainbus0 at root: Bananapi BPI-R3
psci0 at mainbus0: PSCI 1.1, SMCCC 1.2, SYSTEM_SUSPEND
efi0 at mainbus0: UEFI 2.10
efi0: Das U-Boot rev 0x20240700
smbios0 at efi0: SMBIOS 3.7.0
smbios0: vendor U-Boot version "2024.07-rc3-mt7986-43599-gbc68f3572ff" date
07/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
"ramoops" at mainbus0 not configured
"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!