I'm trying to install UEFI firmware on the KHADAS EDGE-V based on Rockchip RK3399,but it does not boot

Hello to everyone.

I’m trying to install UEFI firmware on the KHADAS EDGE-V based on Rockchip RK3399,but it does not work : the HDMI screen connected to the board does not turn on.

What I want to do is to use it for booting FreeBSD 14.x on the KHADAS EDGE-V.

To be able to achieve the goal,I’ve started a thread on the FreeBSD forums,here :

Basically this is what I did.

First of all,I’ve got all the necessary files here :

Then. I created this “script” to use with fdisk /dev/sdi :


label: gpt
label-id: 6265BE94-368D-4AF4-B4B7-A866CF8B2CD9
device: /dev/sdi
unit: sectors
first-lba: 34
last-lba: 249737182
sector-size: 512

/dev/sdi1 : start= 64, size= 8000, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=c98ecab1-1b4a-4a5f-90be-47f303afb025, name="loader1"

/dev/sdi2 : start= 8064, size= 128, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=c9e72325-f04a-42f2-ba21-765a84c4a97a, name="reserved1"

/dev/sdi3 : start= 8192, size= 8192, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=b4a7ee44-049c-4812-b226-77ed60c6b485, name="reserved2"

/dev/sdi4 : start= 16384, size= 8192, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=0a69dc2c-c328-4de5-a161-f39e6f3279d0, name="loader2"

/dev/sdi5 : start= 24576, size= 8192, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=3e9f170a-c378-4c58-a703-2bc18c596f5e, name="atf"

/dev/sdi6 : start= 32768, size= 102400, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=2fb46bfd-b0d7-454a-a156-39f7a7a06ff8, name="efi esp"

and I’ve applied that layout to the disk. And then I did :

dd if=idbloader.img of=/dev/sdi1
dd if=RK3399_SDK_UEFI.img of=/dev/sdi4
dd if=trust.img of=/dev/sdi5

How to “dd” sdi6 ? The file README does not talk about it at all. It does not even specify what’s the content that should be copied inside there. I dd’ed the EFI partition that’s on the sd card sdk,that’s able to boot FreeBSD for sure :

Disk /dev/sdk: 183.35 GiB, 196865949696 bytes, 384503808 sectors
Disk model: MassStorageClass
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 224BEEEC-6B6B-11EF-83C6-002590EC5BF2

Dispositivo     Start      Fine   Settori   Size Tipo
/dev/sdk1       32768    135167    102400    50M EFI System
/dev/sdk2      135168 368345087 368209920 175.6G FreeBSD UFS
/dev/sdk3   368345088 384499711  16154624   7.7G FreeBSD swap

doing this :

dd if=/dev/sdk1 of=/dev/sdi6

(first I reduced 112 to 50 mb)…

This is the resulting partitions layout :

It seems it worked,but I used different values than those suggested in the table below :

I can’t use those values,otherwise I get this error :

Fixed by the user @covacat :

Anyway,something is wrong in the procedure,because when I insert the sd card inside the KHADAS-EDGE-V slot,my HDMI screen does not turn on.

Do you know if I should apply a different procedure and tools ? thanks.

Finally I’ve been able to setup a serial connection with the board with the goal to understand why it does not boot the OS if I do the installation of UEFI instead of u-boot and I’ve gathered these log messages :

Boot1: 2018-08-06, version: 1.15                                 
CPUId = 0x0                                                      
ChipType = 0x10, 218                                            
SdmmcInit=2 0                                                    
BootCapSize=100000
UserCapSize=29820MB
FwPartOffset=2000 , 100000
mmc0:cmd5,20
SdmmcInit=0 0
BootCapSize=0
UserCapSize=121942MB
FwPartOffset=2000 , 0                                                                              
run on sd0                                                                                        
StorageInit ok = 89823                                                                            
SecureMode = 0                                                                                    
SecureInit read PBA: 0x4                                                                          
SecureInit read PBA: 0x404                                                                        
SecureInit read PBA: 0x804                                                                        
SecureInit read PBA: 0xc04                                                                        
SecureInit read PBA: 0x1004                                                                        
SecureInit read PBA: 0x1404                                                                        
SecureInit read PBA: 0x1804                                                                        
SecureInit read PBA: 0x1c04                                                                        
SecureInit ret = 0, SecureMode = 0                                                                
GPT 0x3190d20 signature is wrong                                                                  
LoadTrust Addr:0x4000                                                                              
No find bl30.bin                                                                                  
No find bl32.bin                                                                                  
Load uboot, ReadLba = 2000                                                                        
Load OK, addr=0x200000, size=0xf0000                                                              
RunBL31 0x10000                                                                                    
NOTICE:  BL31: v1.3(debug):51f2096                                                                
NOTICE:  BL31: Built : 16:24:31, May  6 2019                                                      
NOTICE:  BL31: Rockchip release version: v1.1                                                      
INFO:    GICv3 with legacy support detected. ARM GICV3 driver initialized in EL3                  
INFO:    Using opteed sec cpu_context!                                                            
INFO:    boot cpu mask: 0                                                                          
INFO:    plat_rockchip_pmu_init(1181): pd status 3e                                                
INFO:    BL31: Initializing runtime services                                                      
WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE initialization. SMC`s dK
ERROR:   Error initializing runtime service opteed_fast                                            
INFO:    BL31: Preparing for EL3 exit to normal world                                              
INFO:    Entry point address = 0x200000                                                            
INFO:    SPSR = 0x3c9                                                                              
PLL at FF750000: fbdiv=112, refdiv=2, postdiv1=2, postdiv2=1, vco=1344000 khz, output=672000 khz  
Boot PLLs:                                                                                        
APLLL = 400000000                                                                                  
APLLB = 24000000                                                                                  
CPLL = 24000000                                                                                    
DPLL = 800000000                                                                                  
GPLL = 400000000                                                                                  
NPLL = 24000000                                                                                    
VPLL = 24000000                                                                                    
PLL at FF760000: fbdiv=68, refdiv=1, postdiv1=2, postdiv2=1, vco=1632000 khz, output=816000 khz    
PLL at FF760020: fbdiv=68, refdiv=1, postdiv1=2, postdiv2=1, vco=1632000 khz, output=816000 khz    
PLL at FF760080: fbdiv=100, refdiv=1, postdiv1=3, postdiv2=1, vco=2400000 khz, output=800000 khz  
PLL at FF7600A0: fbdiv=125, refdiv=1, postdiv1=3, postdiv2=1, vco=3000000 khz, output=1000000 khz  
PLL at FF760060: fbdiv=100, refdiv=1, postdiv1=3, postdiv2=1, vco=2400000 khz, output=800000 khz  
After clock init:                                                                                  
APLLL = 816000000                                                                                  
APLLB = 816000000                                                                                  
CPLL = 800000000                                                                                  
DPLL = 800000000                                                                                  
GPLL = 800000000                                                                                  
NPLL = 1000000000                                                                                  
VPLL = 24000000                                                                                    
PLL at FF760000: fbdiv=54, refdiv=1, postdiv1=1, postdiv2=1, vco=1296000 khz, output=1296000 khz  
PLL at FF760020: fbdiv=70, refdiv=1, postdiv1=1, postdiv2=1, vco=1680000 khz, output=1680000 khz
�������� : FROZEN : No more messages.

it’s not clear why it hangs. Someone has a vague idea ?