How to boot FreeBSD installed on the sd card on the Khadas Edge-V instead of Android

im on the mailing list so ive seen it.
but the efi images share code with u-boot so its not impossible
Code:
titus@ubuntu:~/builds/quartz64_uefi$ strings QUARTZ64_EFI.img |grep -i u-boot
u-boot,spl-boot-order
U-Boot SPL board init
u-boot,dm-pre-reloc
u-boot,dm-spl
command in your U-Boot project: ./scripts/stacktrace.sh dump.txt %s
U-Boot SPL 2017.09-gaaca6ffec1-211203 #zzz (Dec 03 2021 - 18:42:16)
U-Boot
u-boot
u-boot,dm-pre-reloc
u-boot,dm-spl
u-boot,spl-boot-order
=U-Boot
 
FreeBSD 14.2 for RockPro64 : (with the panfrost enabled)


FreeBSD 14.2 for RockPro64 running on KHADAS (with the panfrost enabled) : the same image as before.

Code:
hw.clock.emmc_cardclock.enable_cnt: 0
hw.clock.emmc_cardclock.childrens:
hw.clock.emmc_cardclock.parents: clk_emmc
hw.clock.emmc_cardclock.parent: clk_emmc
hw.clock.emmc_cardclock.frequency: 198000000
hw.clock.rk808-clkout2.enable_cnt: 0
hw.clock.rk808-clkout2.childrens:
hw.clock.rk808-clkout2.parents:
hw.clock.rk808-clkout2.parent:
hw.clock.rk808-clkout2.gate: unimplemented
hw.clock.rk808-clkout2.frequency: 32768
hw.clock.hclk_i2s0.enable_cnt: 1
hw.clock.hclk_i2s0.childrens:
hw.clock.hclk_i2s0.parents: hclk_perilp1
hw.clock.hclk_i2s0.parent: hclk_perilp1
hw.clock.hclk_i2s0.gate: unimplemented
 
the khadas version is much to short

Maybe because I'm using the kernel 14.x that hasn't been patched and configured to work for the KHADAS,but for the RockPro64. How can I add the missing entries ?

Who knows if the trembling of the screen will disappear if I disable the panfrost driver on FreeBSD 14.2 for the RockPro64 but that runs on the KHADAS ?
 
What are u looking for if I have used the same combination between the kernel and the userland,but on different boards ? There can't be differences,right ?
 
compare clocks relevant to hdmi and vop
but they look the same
clock freqs depend on dtb, u-boot and factory reset settings
--- rk 2025-08-08 12:42:27.210035000 +0300
+++ kh 2025-08-08 12:42:03.157102000 +0300

-hw.clock.bpll.frequency: 1416000000
+hw.clock.bpll.frequency: 408000000
-hw.clock.lpll.frequency: 1416000000
+hw.clock.lpll.frequency: 408000000

there are other diffs but the propagate from the plls above
these are not directly linked to hdmi and vop but i don't know if they can have secondary effects or whatever

did you use the same dtb on both ?
 
I was using the dtb files of the rockpro64. I have exchanged the dtb dir with the dtb dir used by FreeBSD 13 [on the UFS partition,not on the msdos partition],but the screen still trembling. I suspect that the files are the same. Anyway,this is the result of the command "sysctl hw.clock >somefile.txt" :

 
There is a file that's present only on the msdos / efi partitition of the sd card where I have installed FreeBSD 13 that's called "u-boot-spi.bin",that I don't have on the sd card where I have installed FreeBSD 14.2 for the RockPro64. What is this ?

Should I dd the msdos / efi partition of the sd card where I have installed FreeBSD 13 to the msdos / efi partition of the sd card where I have installed FreeBSD 14.2 for the Rockpro64 ?
 
This is what happened when I copied the u-boot-spi.bin to the msdos / efi partition of the sd card where I have installed FreeBSD 14.2 for the Rockpro64 :

Code:
Welcome to minicom 2.10

OPTIONS: I18n
Compiled on Apr  4 2025, 15:33:54.
Port /dev/ttyU0, 17:10:14 [U]

Press CTRL-A Z for help on special keys                          
                                                                 
## Checking hash(es) for Image u-boot ... sha256+ OK             
## Checking hash(es) for Image fdt-1 ... sha256+ OK              
## Checking hash(es) for Image atf-2 ... sha256+ OK              
## Checking hash(es) for Image atf-3 ... sha256+ OK
## Checking hash(es) for Image atf-4 ... sha256+ OK
load_simple_fit: Skip load 'atf-5': image size is 0!


U-Boot 2024.04 (Sep 05 2024 - 04:32:21 +0000)

SoC: Rockchip rk3399
Reset cause: POR
Model: Pine64 RockPro64 v2.1
DRAM:  4 GiB (effective 3.9 GiB)
Core:  311 devices, 35 uclasses, devicetree: separate                                                  
MMC:   mmc@fe310000: 3, mmc@fe320000: 1, mmc@fe330000: 0                                               
Loading Environment from SPIFlash... jedec_spi_nor flash@0: unrecognized JEDEC id bytes: ef, 60, 18    
*** Warning - spi_flash_probe_bus_cs() failed, using default environment                               
                                                                                                       
In:    serial,usbkbd                                                                                   
Out:   serial,vidconsole                                                                               
Err:   serial,vidconsole                                                                               
Model: Pine64 RockPro64 v2.1                                                                           
Net:   eth0: ethernet@fe300000                                                                         
starting USB...                                                                                        
Bus usb@fe380000: USB EHCI 1.00                                                                        
Bus usb@fe3a0000: USB OHCI 1.0                                                                         
Bus usb@fe3c0000: USB EHCI 1.00                                                                        
Bus usb@fe3e0000: USB OHCI 1.0                                                                         
Bus usb@fe800000: Register 2000140 NbrPorts 2                                                          
Starting the controller                                                                                
USB XHCI 1.10                                                                                          
Bus usb@fe900000: Register 2000140 NbrPorts 2                                                          
Starting the controller                                                                                
USB XHCI 1.10                                                                                          
scanning bus usb@fe380000 for devices... 1 USB Device(s) found                                         
scanning bus usb@fe3a0000 for devices... 1 USB Device(s) found                                         
scanning bus usb@fe3c0000 for devices... 1 USB Device(s) found                                         
scanning bus usb@fe3e0000 for devices... 1 USB Device(s) found                                         
scanning bus usb@fe800000 for devices... 1 USB Device(s) found                                         
scanning bus usb@fe900000 for devices... 1 USB Device(s) found                                         
       scanning usb for storage devices... 0 Storage Device(s) found                                   
Hit any key to stop autoboot:  0                                                                       
Scanning for bootflows in all bootdevs                                                                 
Seq  Method       State   Uclass    Part  Name                      Filename                           
---  -----------  ------  --------  ----  ------------------------  ----------------                   
Scanning global bootmeth 'efi_mgr':                                                                    
Card did not respond to voltage select! : -110                                                         
Failed to load EFI variables                                                                           
  0  efi_mgr      ready   (none)       0  <NULL>                                                       
** Booting bootflow '<NULL>' with efi_mgr                                                              
Booting: mmc 1                                                                                         

























Consoles: EFI console
    Reading loader env vars from /efi/freebsd/loader.env
Setting currdev to disk0p1:
FreeBSD/arm64 EFI loader, Revision 1.1

   Command line arguments: loader.efi
   Image base: 0xf0c4d000
   EFI version: 2.100
   EFI Firmware: Das U-Boot (rev 8228.1024)
   Console: comconsole (0)
   Load Path: /\EFI\BOOT\BOOTAA64.EFI
   Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(1)/SD(1)/HD(1,GPT,224c5)
   BootCurrent: 0000
   BootOrder: 0000[*] 0001
   BootInfo Path: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(1)/SD(1)
Ignoring Boot0000: Only one DP found
Trying ESP: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(1)/SD(1)/HD(1,GPT,224c5b5c-)
Setting currdev to disk0p1:
Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(1)/SD(1)/HD(2,GPT,224d3741-6b6b)
Setting currdev to disk0p2:
\


Loading /boot/defaults/loader.conf                                                                     
Loading /boot/defaults/loader.conf                                                                     
Loading /boot/device.hints                                                                             
Loading /boot/loader.conf                                                                              
Loading /boot/loader.conf.local                                                                        
c-
|  ______               ____   _____ _____
  |  ____|             |  _ \ / ____|  __ \
  | |___ _ __ ___  ___ | |_) | (___ | |  | |
  |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | |
  | |   | | |  __/  __/| |_) |____) | |__| |
  | |   | | |    |    ||     |      |      |
  |_|   |_|  \___|\___||____/|_____/|_____/      ```                        `
                                                s` `.....---.......--.```   -/
 +---------- Welcome to FreeBSD -----------+    +o   .--`         /y:`      +.
 |                                         |     yo`:.            :o      `+-
 |  1. Boot Multi user [Enter]             |      y/               -/`   -o/
 |  2. Boot Single user                    |     .-                  ::/sy+:.
 |  3. Escape to loader prompt             |     /                     `--  /
 |  4. Reboot                              |    `:                          :`
 |  5. Cons: Dual (Serial primary)         |    `:                          :`
 |                                         |     /                          /
 |  Options:                               |     .-                        -.
 |  6. Kernel: default/kernel (1 of 5)     |      --                      -.
 |  7. Boot Options                        |       `:`                  `:`
 |                                         |         .--             `--.
 |                                         |            .---.....----.
 +-----------------------------------------+
   Autoboot in 0 seconds. [Space] to pause
Loading kernel...                                                                                      
/boot/kernel/kernel text=0x2a8 text=0x9ecb90 text=0x2675f4 data=0x1520f8 data=0x0+0x2bc000 syms=[0x8+0x]-
Loading configured modules...                                                                          
/etc/hostid size=0x25                                                                                  
/boot/kernel/umodem.ko text=0x1aa0 text=0xef0 data=0x5f0 syms=[0x8+0xd80+0x8+0xa31]                    
loading required module 'ucom'                                                                         
/boot/kernel/ucom.ko text=0x2140 text=0x2d40 data=0x8e8+0x850 syms=[0x8+0x1230+0x8+0xb6e]              
loading required module 'kernel'                                                                       
module 'kernel' exists but with wrong version                                                          
"Synchronous Abort" handler, esr 0x96000004, far 0x656b2f746f6f622f                                    
elr: fffffffffcf852c4 lr : fffffffffcf3bd1c (reloc)                                                    
elr: 00000000f0ca42c4 lr : 00000000f0c5ad1c                                                            
x0 : 00000000edc9db50 x1 : 656b2f746f6f622f                                                            
x2 : 0000000000000014 x3 : 00000000f3fdf3d0                                                            
x4 : 00000000f3fdf3d0 x5 : 00000000f0d6f368                                                            
x6 : 00000000edd62600 x7 : 0000000080000014                                                            
x8 : 00000000fffffffd x9 : 000000000000002f                                                            
x10: 0000000000000000 x11: 000000006f6f622f                                                            
x12: 0000000000001fff x13: 00000000edc9ddf0                                                            
x14: 00000000edc9db70 x15: 0000000000000250                                                            
x16: 0000000000000000 x17: 0000000000000030                                                            
x18: 0000000000000000 x19: 00000000edc9db50                                                            
x20: 00000000edc9d8c0 x21: 0000000000000000                                                            
x22: 00000000edc9dfa0 x23: 00000000edc9ce20                                                            
x24: 00000000f0d71648 x25: 0000000000000003                                                            
x26: 00000000edc9db20 x27: 00000000edd1a8c0                                                            
x28: 0000000000000003 x29: 00000000f0d6f9f0                                                            
                                                                                                       
Code: d65f03c0 aa1f03e0 d65f03c0 39400009 (39400028)                                                   
UEFI image [0x00000000f0c4d000:0x00000000f0d80697] pc=0x572c4 '/\EFI\BOOT\BOOTAA64.EFI'                
Resetting CPU ...                                                                                      
                                                                                                       
resetting ...                                                                                          
                                                                                                       
U-Boot TPL 2024.04 (Sep 05 2024 - 04:32:21)                                                            
lpddr4_set_rate: change freq to 400MHz 0, 1                                                            
Channel 0: LPDDR4, 400MHz                                                                              
BW=32 Col=10 Bk=8 CS0 Row=16 CS=1 Die BW=16 Size=2048MB                                                
Channel 1: LPDDR4, 400MHz                                                                              
BW=32 Col=10 Bk=8 CS0 Row=16 CS=1 Die BW=16 Size=2048MB                                                
256B stride                                                                                            
lpddr4_set_rate: change freq to 800MHz 1, 0                                                            
Trying to boot from BOOTROM                                                                            
Returning to boot ROM...                                                                               
                                                                                                       
U-Boot SPL 2024.04 (Sep 05 2024 - 04:32:21 +0000)                                                      
Trying to boot from MMC2                                                                               
## Checking hash(es) for config config-1 ... OK                                                        
## Checking hash(es) for Image atf-1 ... sha256+ OK                                                    
## Checking hash(es) for Image u-boot ... sha256+ OK                                                   
## Checking hash(es) for Image fdt-1 ... sha256+ OK                                                    
## Checking hash(es) for Image atf-2 ... sha256+ OK                                                    
## Checking hash(es) for Image atf-3 ... sha256+ OK                                                    
## Checking hash(es) for Image atf-4 ... sha256+ OK                                                    
load_simple_fit: Skip load 'atf-5': image size is 0!
 
I'm trying to update FreeBSD 13 to 14.2,but the procedure is failing.

Code:
# freebsd-update fetch --debug                                                      

Looking up update.FreeBSD.org mirrors... 3 mirrors found.                                              
Fetching metadata signature for 13.0-RELEASE from update1.freebsd.org...
latest.ssl 512 B 2348 kBps 00s

done.                                                                                                  
Fetching metadata index...                                                                             
72f3dd07ca369cdcaa1a824e02c58ebe84b02db9bdf78a         225  B 1071 kBps    00s                        
done.                                                                                                  
Fetching 1 metadata files...                                                                           

/usr/libexec/phttpget update1.freebsd.org 13.0-RELEASE/arm64/m/e4d60e0b522b8cd1923c9108fcd005eb4813e2ac73f96c6c1db47da105625ac6.gz                                        

http://update1.freebsd.org/13.0-RELEASE/arm64/m/e4d60e0b522b8cd1923c9108fcd005eb4813e2ac73f96c6c1db47da105625ac6.gz: 404 Error (ignored)                                                                        
failed.                                                                                                


# freebsd-update upgrade -r 14.2-RELEASE --debug                                    

Looking up update.FreeBSD.org mirrors... 3 mirrors found.                                              
Fetching metadata signature for 13.0-RELEASE from update1.freebsd.org...                               

latest.ssl                                             512  B 2427 kBps    00s                         
done.                                                                                                  
Fetching metadata index...                                                                             

72f3dd07ca369cdcaa1a824e02c58ebe84b02db9bdf78a         225  B 1559 kBps    00s                        
done.                                                                                                  
Fetching 1 metadata files...                                                                           

/usr/libexec/phttpget update1.freebsd.org 13.0-RELEASE/arm64/m/40c9d141e84379f522c770f6860de62c75629a1f12d14dcdb544e6ebef5f295d.gz                                                                              
http://update1.freebsd.org/13.0-RELEASE/arm64/m/40c9d141e84379f522c770f6860de62c75629a1f12d14dcdb544e6ebef5f295d.gz: 404 Error (ignored)                                                                        
failed.                                                                                                


# freebsd-update upgrade -r 14.2 --debug                                            

Looking up update.FreeBSD.org mirrors... 3 mirrors found.                                              
Fetching metadata signature for 13.0-RELEASE from update2.freebsd.org...                               

latest.ssl                                             512  B 2262 kBps    00s                         
done.                                                                                                  
Fetching metadata index...                                                                             

72f3dd07ca369cdcaa1a824e02c58ebe84b02db9bdf78a         225  B 1036 kBps    00s                        
done.                                                                                                  


Fetching 1 metadata files...                                                                          
/usr/libexec/phttpget update2.freebsd.org 13.0-RELEASE/arm64/m/40c9d141e84379f522c770f6860de62c75629a1f12d14dcdb544e6ebef5f295d.gz

http://update2.freebsd.org/13.0-RELEASE/arm64/m/40c9d141e84379f522c770f6860de62c75629a1f12d14dcdb544e6ebef5f295d.gz: 404 Error (ignored)                                                                        
failed.
 
btw i remembered that my orange pi 3b won't boot edk2 efi until i cleared the spi flash
so maybe the khadas won't boot until you clear it
you may clear it from the u-boot prompt
with the sf command
 
btw i remembered that my orange pi 3b won't boot edk2 efi until i cleared the spi flash
so maybe the khadas won't boot until you clear it
you may clear it from the u-boot prompt
with the sf command

Not sure if the procedure is the one explained by you,since the khadas is an high customized board. They have implemented a lot of custom procedures. Anyway,I found two interesting links that explain that this board can use u-boot and....uefi for rk3399 :

1:
2:
The first link talks about the khadas Edge and at the bottom,it invites to jump to the rockchip website. The second link is very interesting when it reaches this point :

Flash and boot from Media device

Here we introduce how to write image to different Medeia device.

Get image Ready:
  • For with SPL:
    • idbloader.img
    • u-boot.itb
    • boot.img or boot folder with Image, dtb and exitlinulx inside
    • rootfs.img
  • For with miniloader
    • idbloader.img
    • uboot.img
    • trust.img
    • boot.img or boot folder with Image, dtb and exitlinulx inside
    • rootfs.img

and later :

  • For with miniloader:

dd if=idbloader.img of=sdb seek=64
dd if=uboot.img of=sdb seek=16384
dd if=trust.img of=sdb seek=24576
dd if=boot.img of=sdb seek=32768
dd if=rootfs.img of=sdb seek=262144

that's exactly what I'm trying to do ! And the files mentioned there can be downloaded here :


It explains how to do what I tried to do in a different and probably wrong way :

rkdeveloptool db rkxx_loader_vx.xx.bin
rkdeveloptool ul rkxx_loader_vx.xx.bin
rkdeveloptool wl 0x4000 uboot.img
rkdeveloptool wl 0x6000 trust.img
rkdeveloptool wl 0x8000 boot.img
rkdeveloptool wl 0x40000 rootfs.img
rkdeveloptool rd

I didn't use rkdevelop tool and I didn't add any memory address...

I still don't understand which kind of files are the ones below and where I can get them.

rkdeveloptool db rkxx_loader_vx.xx.bin
rkdeveloptool ul rkxx_loader_vx.xx.bin

They recall me the missing files suggested by the log file :

No find bl30.bin
No find bl32.bin
 
Here is step by step what I do to build u-boot for this platform.

First off go to another boards build and look to see if defconfig file exists for this board. It does. Checking ./u-boot/configs/ directory.

/usr/ports/sysutils/u-boot-radxa-zero3/work/u-boot-2025.07-rc2/configs/khadas-edge-v-rk3399_defconfig

Do you understand this part? You are looking for a default configuration file for Khadis Edge V. I am using another port to do this.

You could just as easily build any board port for this u-boot source tree.

Once you have this information (the name of defconfig file) you can build a slave u-boot port for your unsupported board.

mkdir /usr/ports/sysutils/u-boot-khadis-edge-v

cd /usr/ports/sysutils/u-boot-khadis-edge-v

ee Makefile
Code:
MASTERDIR=      ${.CURDIR}/../u-boot-master

MODEL=          khadis-edge-v
BOARD_CONFIG=   khadas-edge-v-rk3399_defconfig
FAMILY=         rk3399

.include "${MASTERDIR}/Makefile"

Now create the package description file.
ee pkg-descr
Code:
U-Boot loader and related files for the khadis-edge-v

To install this bootloader on an sdcard just do:

dd if=/usr/local/share/u-boot/u-boot-khadis-edge-v/idbloader.img of=/path/to/sdcarddevice seek=64 conv=sync
dd if=/usr/local/share/u-boot/u-boot-khadis-edge-v/u-boot.itb of=/path/to/sdcarddevice seek=16384 bs=512 conv=sync

Now you can build your port.

Install dependencies:
make build-depends-list | cut -c 12- | xargs pkg install -A -y

Build it:
make install

Please make your own u-boot port for this board. It makes bringing up a board pretty easy.

I'm not able to compile this port anymore on my workstation amd64 :

Code:
# cd /usr/ports/sysutils/u-boot-khadas-edge-v
# make


what could be the problem ? it happens also with a lot of u-boot-* ports.

thanks.
 
I have seen errors where Linux uuidgen was broken on FreeBSD u-boot ports. It has been fixed though.

I don't see the same error here. It looks like an ARCH problem.Please check your compile machines env settings.

include/linux/byteorder/little_endian.h:87:18: error: use of undeclared identifier '__be16'
 
I have seen errors where Linux uuidgen was broken on FreeBSD u-boot ports. It has been fixed though.

Is there a way to see if in my system it is broken ?

I don't see the same error here. It looks like an ARCH problem.Please check your compile machines env settings.

Code:
# env

SSH_AUTH_SOCK=/var/run/user/1001/ssh-agent.socket
MM_CHARSET=UTF-8
LANG=C.UTF-8
XDG_CURRENT_DESKTOP=LXDE
USER=marietto
DESKTOP_SESSION=LXDE
XDG_MENU_PREFIX=lxde-
OLDPWD=/home/marietto
XDG_CONFIG_HOME=/home/marietto/.config
HOME=/home/marietto
MPD_HOST=/home/marietto/.config/mpd/socket
DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/dbus-F7umH6rba7,guid=03e69b17d18bdb369701681768ac0840
_=/usr/bin/env
XDG_CONFIG_DIRS=/usr/local/etc/xdg
WINDOWPATH=9
XDG_DATA_DIRS=/usr/local/share
_LXSESSION_PID=3942
XDG_CACHE_HOME=/home/marietto/.cache
XDG_DATA_HOME=/home/marietto/.local/share
BLOCKSIZE=K
MAIL=/var/mail/marietto
LOGNAME=marietto
VISUAL=nano
SAL_USE_VCLPLUGIN=gtk
PATH=/bhyve:/home/marietto/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/bin:/sbin
XDG_RUNTIME_DIR=/var/run/user/1001
SHELL=/usr/local/bin/zsh
LESSKEY=/home/marietto/.config/less/keys
KEYTIMEOUT=1
LESSHISTFILE=/home/marietto/.config/less/history
EDITOR=nano
XDG_SESSION_COOKIE=marietto-1756104768.218998-1025553342
PWD=/home/marietto
XAUTHORITY=/home/marietto/.Xauthority
SHLVL=2
DISPLAY=:0
TERM=xterm

[marietto@marietto /usr/ports/sysutils/u-boot-khadas-edge-v]==> sudo env

LANG=C.UTF-8
XDG_CURRENT_DESKTOP=LXDE
PATH=/bhyve:/home/marietto/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/bin:/sbin
XAUTHORITY=/home/marietto/.Xauthority
DISPLAY=:0
TERM=xterm
MAIL=/var/mail/root
LOGNAME=root
USER=root
HOME=/root
SHELL=/usr/local/bin/zsh
SUDO_COMMAND=/usr/bin/env
SUDO_USER=marietto
SUDO_UID=1001
SUDO_GID=1001
SUDO_HOME=/home/marietto
SUDO_TTY=/dev/pts/1
 
Sorry I can't help much. Everything looks ok.

What about make.conf ? Make sure you dont have one. Compiler searches in multiple places for the file.

When I have port problems I delete tree and start over. Backing up my custom generated ports first.
 
Sorry I can't help much. Everything looks ok.

What about make.conf ? Make sure you dont have one. Compiler searches in multiple places for the file.

When I have port problems I delete tree and start over. Backing up my custom generated ports first.

ok. I deleted the ports tree and I've restarted. But the same error happened again. But since I want to compile a port for arm64 (u-boot-khadas),shouldn't I configure the cross compilation variables for aarch64 ?
 
Back
Top