Re: Orange Pi RV2 boot with some success

From: Rich Dunkle <rdunkle_at_smallcatbrain.com>
Date: Mon, 05 May 2025 07:33:48 UTC
On 05.05.2025 02:44, Tom Pusateri wrote:
> Rich,
>
> Thank-you for the descriptive reply. I have been using FreeBSD since 1997 and BSD 4.[234] since 1984 so I am very experienced with all the traditional boot stuff. The dtb and uboot are new and make no sense to me. Linux seems trivial to get working on these boards and FreeBSD almost impossible. Not sure why that is.
>
> I have another board (GlobalScale mochabin, aarch64) that I have struggled with as well.
>
> I had no luck getting the riscv board to find the .dtb file from Ubuntu no matter where I put it in the EFI or root directory. I also tried booting a separate single partition TF card with the .dtb in the root and in the dtb directory with no success. It only appears to be looking for EFI.
>
> I was able to get the loader to find and load the .dtb by placing the info in /boot/loader.conf on the FreeBSD UFS partition but this didn’t seem to help any. Same results as before.
>
> # /boot/loader.conf
> dtbfile_load="YES"
> dtbfile_type="dtb"
> dtbfile_name="x1_orangepi-rv2.dtb”
>
> I’m assuming this is too late.
>
> I’ll keep playing with it and maybe I can figure something out. Everything I can find online about FreeBSD / u-boot / and .dtb files seems to be very old and not applicable.
>
> Thanks,
> Tom
>
---8<----   snip  ---

The FreeBSD arm64 architecture is really good now.

You are correct the dtb file is getting loaded too late.

As for riscv---
The board vendors just ship a board and expect a linux binary blob to be OK.
They send a board to some "internet influencer" and that is about it.

FreeBSD just does not have the resources that Linux has working on riscv.
FreeBSD basically has one guy, Mitchell Horne.

Then look at all the patches submitted for Linux riscv in just a few days:
https://patchwork.kernel.org/project/linux-riscv/list/

OK...   so we need to dig into the u-boot commands to make more progress.

The u-boot environment is set up for linux boot.
We need to override the settings.

When u-boot starts up you need to break into the u-boot command prompt
before it starts up the FreeBSD boot.

Control c should break out to a u-boot prompt.

Enter:   printenv
that will show the saved environment for u-boot
-->    show that to us in email

You will notice some important variables right away:
fdtfile   ---> show the pathname to the the dtb file

Here are the u-boot commands that will probably boot
(will not know for sure until looking at the printenv)

--SHOW US THE OUTPUT FROM THE CONSOLE--

mmc list
**  u-boot will recognize the sd card

mmc dev 1
**  should see something like this:
**  switch to partitions #0, OK
**  mmc1 is current device
** this set a variable for addressing the sd card

load mmc 1:1 ${fdt_addr_r}  dtb/x1_orangepi-rv2.dtb
***  should see it read in the dtb file


load mmc 1:1 ${kernel_addr_r} efi/boot/bootriscv64.efi
*** should see it read in the bootriscv64.efi

bootefi ${kernel_addr_r} ${fdt_addr_r}
***  should see it start to boot FreeBSD

---------------------------------------------
Here are some bonus commands for looking at the sd card
mmc list
mmc dev 1
mmc part

***  show you the partitions of the sd card
-----------------------------------------------------------------
  ls mmc 1:1
**  show the files on mmc(sd card) (devnum 1)  (first partition)

ls mmc 1:1 dtb
** show the file in the dtb directory

---------------------------------------
There is also a help system:

help ls
----------------------------------------