Re: Orange Pi RV2 boot with some success

From: Rich Dunkle <rdunkle_at_smallcatbrain.com>
Date: Sun, 04 May 2025 06:15:26 UTC
On 04.05.2025 04:03, Tom Pusateri wrote:

--8<--- snip ---

> Device 0: unknown device
> [   5.693] switch to partitions #0, OK
> [   5.693] mmc0 is current device
> [   5.783] Scanning mmc 0:3...
> [   5.896] ** Unable to read file / **
> [   5.897] Failed to load '/'
> [   5.930] ** Unable to read file /dtb/ **
> [   5.930] Failed to load '/dtb/'

--8<--- snip ---

> And this is where it hangs on both serial console and HDMI console.
>
> Tom
>
I do not have one of these boards.
There is no HowTo written yet.
So we are going on experience with similar boards.

OK.... so this is the first thing needed to boot-->   dtb file
That file tells the operating system about the board resources.
Since this is a new board for FreeBSD... there is no dtb.
So let's try to find one.

There is a chance the the dtb file used by the Xunlong ported operating 
systems.
Go to support page for the Pi RV2:
http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-RV2.html

Look at the bottom of the page.  There is a link to Ubuntu Image Downloads.
That will take you to the location of the Ubuntu images.
Grab the small one--> Orangepirv2_1.0.0_ubuntu_noble_server_linux6.6.63.7z

Use some tool to explore that image.  I actually found that Nanazip is a 
nice tool to peruse these images.
Look at this path--> 
Orangepirv2_1.0.0_ubuntu_noble_server_linux6.6.63.img\boot\dtb-6.6.63-ky\ky\

There you will find the Xunlong created dtb files.
This is probably the one we want-->   x1_orangepi-rv2.dtb

Next we need some method to allow the u-boot system to read this dtb file
before FreeBSD starts booting the EFI boot.

You can make a separate sd card with one partition and this dtb.
Interrupt the u-boot process and force u-boot to read the dtb file.
Swap in the FreeBSD sd card and start the EFI boot.
    OR
Copy the dtb file into the EFI partition of the existing sd card.
I assume you have access to another working FreeBSD system.
Examine the FreeBSD sd card image on the working FreeBSD system.
Assume the sdcard is device:   da0
It will look something like this:
        #  gpart show da0

      =>      34  14746648  da0  GPT  (7.0G)  [CORRUPT]

You will probably get an benign error about a corrupt gpt

That is expected when you burn an image with dd command

Fix the error with-->     gpart recover da0

#  gpart show da0
=>      34  14746648  da0   GPT  (7.0G)
            34     66584          1    efi  (33M)
      66618   2097152       2    freebsd-swap  (1.0G)
    2163770  12582912    3   freebsd-ufs  (6.0G)

The partition we need to add the dtb file is -->  da0p1

mount -t msdosfs -o longnames /dev/da0p1 /mnt

Make a directory and copy the dtb file to the sd card:
mkdir -p /mnt/dtb
cp  x1_orangepi-rv2.dtb   /mnt/dtb
umount /mnt

Now the sd card is ready for booting.
But the problem is to get the dtb file read during boot.
We do not know what location the the u-boot environment was set to look 
for the dtb file.
It may boot the first time and pick up the dtb file.
If it boots good.
If it fails to find the dtb I can give more explanation of how to 
control u-boot.