Re: Help / Information request regarding FreeBSD boot on Raspberry Pi CM4

From: Hugo Kirnbichler <kirnbichler_at_gmx.co.uk>
Date: Wed, 21 May 2025 10:22:45 UTC
Hello Klaus,

thanks again for your helpful reply.

I have now joined the mailing list and will therefore post further questions there.

Regarding u-boot, I'm afraid that the u-boot binary shipped with the FreeBSD 15 snapshot behaves differently from what you describe.

Yes, via "pci" it dumps the two pci devices:

    U-Boot> pci
    BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
    _____________________________________________________________
    00.00.00   0x14e4     0x2711     Bridge device           0x04
    01.00.00   0x1e4b     0x1202     Mass storage controller 0x08
 
(in my case that's a cheap "Patriot" NVMe SSD)

But the command list (printable by "help") is missing the "nvme" commands.
And "ls" complains rightfully that it has no file system mounted:
 
    U-Boot> ls /
    ** No device specified **
    Couldn't find partition / <NULL>

Thus I think that this seems indeed to be an issue with u-boot.

When I replace the u-boot binary provided with the FreeBSD 15 snapshot with a binary I've created myself, 
adding the following options in .config.txt

    CONFIG_CMD_NVME=y
    CONFIG_NVME=y
    CONFIG_NVME_PCI=y

the "pci" command still lists the same devices as above. But now I can use the "nvme" commands in u-boot.

Alas, "nvme scan" invariably fails.

Now, I'm completely new at u-boot, I may well have failed to set other important options.
The documentation is, well, "böhmische dörfer" as you might say, at least for me.

Another observation:

u-boot (the one provided in the FreeBSD snapshot) does not work with USB.
It complains that it can't find any USB controllers:

    U-Boot 2024.07 (May 15 2025 - 04:37:37 +0000)

    DRAM:  948 MiB (effective 3.9 GiB)
    RPI Compute Module 4 (0xc03141)
    Core:  211 devices, 16 uclasses, devicetree: board
    MMC:   mmc@7e300000: 3, mmc@7e340000: 0
    Loading Environment from FAT... ** Bad device specification mmc 1 **
    In:    serial,usbkbd
    Out:   serial,vidconsole
    Err:   serial,vidconsole
    Net:   eth0: ethernet@7d580000

    PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
    starting USB...
    No USB controllers found

The only way to interact with it is via the debug serial port.

In config.txt I've set both variants of the command supposedly enabling USB

    dtoverlay=dwc2,dr_mode=host
    otg_mode=1

but neither one works; the usb keyboard (and mouse) I've attached aren't even powered up.

When booting a working OS (as for instance my copy of FreeBSD 13.3 from SD card), the USB host controller 
gets enabled somewhen in the boot process, so that everything works fine.


I've spent yesterday afternoon with another approach, using the RPI4 UEFI boot loader that can be obtained from here:
https://github.com/pftf/RPi4

Combining that with the ufs partition from the FreeBSD 15 snapshot gave me a system that actually booted, but the only way 
to access it is again the debug serial port. Neither network nor USB are working.

The only USB device present is a root hub:

    root@generic:~ # usbconfig
    ugen0.1: <OTG Root HUB DWCOTG> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)

Resetting it does not yield anything.


There are so many screws to twiddle on that I'm afraid that I miss the right one.



Again, thanks for bearing with me

Hugo