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

From: Klaus_Küchemann <maciphone2_at_googlemail.com>
Date: Wed, 21 May 2025 22:44:49 UTC
Hi Hugo,

Thanks for subscribing to the list 

today the hard drive let me down
and some hours of repair didn`t help…….
ROOT INODE UNALLOCATED…..
..UFS2 cylinder group 0 failed: cgp->cg_ckhash ("4051856848") != calchash ("1683761082“)
..CYLINDER GROUP 0: INTEGRITY CHECK FAILED
…..
In that test I wanted to try to boot root-filesystem from the nvme(„kickstart“ from emmc) by adding this line to /etc/fstab(on the emmc root filesystem)  :

/dev/nda0   /       ufs     rw      1       1 

I hope hdd-issues and early boot issues here have nothing to do with e.g. power issues for various nvme-types on the cm4..
I know that nvme scan fails on u-boot(in the past  with older u-boot I remember it sometimes worked and sometimes not).
Best bet for now seems to try  „kickstart" from emmc/ uSD and later mount root from nvme...
Will have to look for/ try other Hdd

You will hear again from me when some things are sorted out better…

Regards
K.



> Am 21.05.2025 um 12:22 schrieb Hugo Kirnbichler <kirnbichler@gmx.co.uk>:
> 
> 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 
>