Bug 239197 - FreeBSD 11.3-RELEASE boot failed on RaspberryPI 1
Summary: FreeBSD 11.3-RELEASE boot failed on RaspberryPI 1
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: 11.3-RELEASE
Hardware: arm Any
: --- Affects Some People
Assignee: freebsd-arm (Nobody)
Keywords: regression
Depends on:
Reported: 2019-07-14 11:25 UTC by Oleksii Samorukov
Modified: 2020-01-06 00:45 UTC (History)
6 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Oleksii Samorukov freebsd_committer 2019-07-14 11:25:29 UTC
I found that there is a regression on RPi1/FreeBSD. When i am copying official image to the SD card i am getting boot loop. Previous (11.2) version works just fine on the same hardware. Boot log from the serial console provided below:

Loading Environment from FAT... In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
USB0:   scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
MMC Device 0 not found
no mmc device at slot 0
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Found U-Boot script /boot.scr
199 bytes read in 6 ms (32.2 KiB/s)
## Executing script at 02400000
285056 bytes read in 32 ms (8.5 MiB/s)
## Starting application at 0x00080000 ...
Consoles: U-Boot console
Compatible U-Boot API signature found @0x1bb40c80

FreeBSD/armv6 U-Boot loader, Revision 1.2
(Fri Jul  5 03:38:30 UTC 2019 root@releng2.nyi.freebsd.org)

Number of U-Boot devices: 1
U-Boot env: loaderdev not set, will probe all devices.
Found U-Boot device: disk
  Probing all <unknown> devices...
  Checking unit=0 slice=<auto> partition=<auto>... good.
Booting from disk0s2a:
Loading /boot/defaults/loader.conf
/boot/kernel/kernel data=0x6482ac+0x19fd54 syms=[0x4+0xaae80+0x4+0x98ff0]
Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...
Using DTB provided by U-Boot at address 0x1bfea200.
Kernel entry at 0x400100...
Kernel args: (null)
Copyright (c) 1992-2019 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
    The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.3-RELEASE #0 r349754: Fri Jul  5 03:51:28 UTC 2019
root@releng2.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/RPI-B arm
FreeBSD clang version 8.0.0 (tags/RELEASE_800/final 356365) (based on LLVM 8.0.0)
VT: init without driver.
CPU: ARM ARM1176 r0p7 (ECO: 0x00000000)
CPU Features:
  Thumb, Security, VMSAv7
Optional instructions:
  16KB/32B 4-way instruction cache
  16KB/32B 4-way WB data cache
real memory  = 469757952 (447 MB)
avail memory = 448118784 (427 MB)
random: entropy device external interface
kbd0 at kbdmux0
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> on ofwbus0
bcm_dma0: <BCM2835 DMA Controller> mem 0x7e007000-0x7e007eff irq 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 on simplebus0
bcm_dma0: cannot allocate interrupt
device_attach: bcm_dma0 attach returned 6
bcmwd0: <BCM2708/2835 Watchdog> mem 0x7e100000-0x7e100027 on simplebus0
bcmrng0: <Broadcom BCM2835 RNG> mem 0x7e104000-0x7e10400f irq 20 on simplebus0
mbox0: <BCM2835 VideoCore Mailbox> mem 0x7e00b880-0x7e00b8bf irq 21 on simplebus0
mbox0: could not allocate interrupt resource
device_attach: mbox0 attach returned 6
gpio0: <BCM2708/2835 GPIO controller> mem 0x7e200000-0x7e2000b3 irq 22,23 on simplebus0
gpio0: cannot allocate resources
gpio0: bcm_gpio_pic_detach: not implemented yet
device_attach: gpio0 attach returned 6
uart0: <PrimeCell UART (PL011)> mem 0x7e201000-0x7e201fff irq 24 on simplebus0
uart0: console (115200,n,8,1)
bcm283x_dwcotg0: <DWC OTG 2.0 integrated USB controller (bcm283x)> mem 0x7e980000-0x7e98ffff,0x7e006000-0x7e006fff irq 45,46 on simplebus0
bcm283x_dwcotg0: failed to set power state, err=6
device_attach: bcm283x_dwcotg0 attach returned 6
sdhci_bcm0: <Broadcom 2708 SDHCI controller> mem 0x7e300000-0x7e3000ff irq 48 on simplebus0
device_attach: sdhci_bcm0 attach returned 6
fb0: <BCM2835 VT framebuffer driver> on simplebus0
device_attach: fb0 attach returned 6
vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b84e irq 51 on simplebus0
vchiq0: could not allocate interrupt resource
device_attach: vchiq0 attach returned 6
gpioled0: <GPIO LEDs> on ofwbus0
gpioled0: <led0> failed to map pin
cryptosoft0: <software crypto>
panic: No usable event timer found!
Uptime: 1s
Automatic reboot in 15 seconds - press a key on the console to abort
Comment 1 Oleksii Samorukov freebsd_committer 2019-07-14 11:26:50 UTC
I found that problem is with loader and dtb file. 

Ubldr now seems to ignore uboot.fdtfile=bcm2835-rpi-b-rev2.dtb enry. If i am doing in loader: "load -t dtb bcm2835-rpi-b-rev2.dtb" and then boot - it loads as expected. I can see var in the "ubenv show" output, so it makes me thinking that loader simply ignores it.

As temporary workaround i am using now fat partition from the 11.2-RELEASE
Comment 2 Oleksii Samorukov freebsd_committer 2019-07-14 20:47:15 UTC
Some additional data: new firmware of rpi, which is installed in the loader, automatically loads bcm2708-rpi-b.dtb file. This file seems to be taken from and is not playing well with a FreeBSD. ubldr detects that this dtb is loaded by u-boot and is not loading one from FreeBSD /boot directory. 

Also if i am enforcing RPi loader to use file from /boot - u-boot hangs and i have a black screen on load
Comment 3 Oleksii Samorukov freebsd_committer 2019-07-14 21:21:57 UTC
I been able to load FreeBSD with a loader from FreeBSD 11.3 using such hack:

--- /boot/loader.4th.orig       2019-07-14 20:12:47.780973000 +0000
+++ /boot/loader.4th    2019-07-14 20:21:05.650486000 +0000
@@ -151,6 +151,8 @@
     s" loader_delay" getenv -1 = if
+      s" ubenv import fdtfile" evaluate
+      s" load -t dtb ${uboot.fdtfile}" evaluate

This needs to be fixed on upstream, not sure about correct way to handle that.
Comment 4 Matias 2020-01-06 00:45:42 UTC
Hi Oleksii,

Would you please confirm if only updating boot/loader.4th with your patch is all what is required to boot 11.3 version? Now I'm running 11.2 but I'd like to upgrade.
I tried with 12.x with no luck. Thanks!