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

you have the sizes wrong (have to subtract start from end)
this is the correct data
1 64 8000
2 8064 128
3 8192 8192
4 16384 8192
5 24576 8192
6 32768 229376

this is pos/start/size and start and size are in sectors

It worked,thanks. What about the type of partition to choose inside the layout file ? This is how it looks right now :

(0FC63DAF-8483-4772-8E79-3D69D8477DE4 and C12A7328-F81F-11D2-BA4B-00A0C93EC93B) added by me without being sure they are correct.

Code:
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=07D35DA3-2E74-11F0-832C-F1B721F986A1, name="loader1"

/dev/sdi2 : start=     8064, size=    128, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=07D35DA3-2E74-11F0-832C-F1B721F986A1, name="reserved1"

/dev/sdi3 : start=     8192, size=   8192, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=07D35DA3-2E74-11F0-832C-F1B721F986A1, name="reserved2"

/dev/sdi4 : start=    16384, size=   8192, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=07D35DA3-2E74-11F0-832C-F1B721F986A1, name="loader2"

/dev/sdi5 : start=    24576, size=   8192, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=07D35DA3-2E74-11F0-832C-F1B721F986A1, name="atf"

/dev/sdi6 : start=    32768, size= 229376, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=07D35DA3-2E74-11F0-832C-F1B721F986A1, name="efi esp"
 
except the last one they don't really matter or should not matter. their role is to have a clue of the offsets where to write various stuff but they contain raw data no filesystem whatsoever.
the last should be efi/esp
 
This is how the sd card looks like :

Code:
Disk /dev/sdi: 119.08 GiB, 127865454592 bytes, 249737216 sectors
Disk model: STORAGE DEVICE
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: 6265BE94-368D-4AF4-B4B7-A866CF8B2CD9

Dispositivo Start   Fine Settori  Size Tipo
/dev/sdi1      64   8063    8000  3.9M Linux filesystem
/dev/sdi2    8064   8191     128   64K Linux filesystem
/dev/sdi3    8192  16383    8192    4M Linux filesystem
/dev/sdi4   16384  24575    8192    4M Linux filesystem
/dev/sdi5   24576  32767    8192    4M Linux filesystem
/dev/sdi6   32768 262143  229376  112M EFI System

well,I didn't yet create the root partition of FreeBSD. But I've just tried if the UEFI logo/menu appeared. Unfortunately it didn't. What should be the content of the "112M" EFI System ? According with the README it should be empty. But it can't be empty,I suppose..
 
that should contain what you usually have under /boot/efi but it should work without it / empty one
if you dd-ed the parts correctly it should boot. it may help if you have a serial console connected too
 
It does not boot. Something is not good here :

Code:
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=07D35DA3-2E74-11F0-832C-F1B721F986A1, name="loader1"

/dev/sdi2 : start=        8064, size=         128, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=07D35DA3-2E74-11F0-832C-F1B721F986A1, name="reserved1"

/dev/sdi3 : start=        8192, size=        8192, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=07D35DA3-2E74-11F0-832C-F1B721F986A1, name="reserved2"

/dev/sdi4 : start=       16384, size=        8192, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=07D35DA3-2E74-11F0-832C-F1B721F986A1, name="loader2"

/dev/sdi5 : start=       24576, size=        8192, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=07D35DA3-2E74-11F0-832C-F1B721F986A1, name="atf"

/dev/sdi6 : start=       32768, size=      102400, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=F028C4EA-C962-43E6-AB36-CCEBB9EA180E, name ="efi esp"

maybe because uuid from sdi1 to sdi5 are the same ? I'm not able to change them.
 
Are u sure ? According with this table :

Code:
1              64            8063   3.9 MiB     FFFF  loader1   <-- Rk3399Pkg/Tools/Bin/idbloader.bin
2            8064            8191   64.0 KiB    FFFF  reserved1
3            8192           16383   4.0 MiB     FFFF  reserved2
4           16384           24575   4.0 MiB     FFFF  loader2   <-- RK3399_SDK_UEFI.img
5           24576           32767   4.0 MiB     FFFF  atf       <-- Rk3399Pkg/Tools/Bin/trust.img
6           32768          262143   112.0 MiB   EF00  efi esp

partition 1 is important,right ?
 
if you dd-ed the parts correctly it should boot. it may help if you have a serial console connected too

How ? I did this :

Code:
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 ? 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 :

Code:
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 :

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

(first I reduced 112 to 50 mb)...
 
i very much doubt the partitions 1-5 are necessary at all. sbcs boot methods don't care about them
UEFI-EDK2 booting seems to need some partitions for ENVIRNOMENT and VARIABLES (settings). Sometimes a third Linux-Data partition for TMP.

But I agree that trust.img is not a partition but flashed to disk sectors along with loader1.

I don't know these instructions to be correct.
 
with u-boot we always just dd to some disks offsets and it works. sometimes you see linux docs / howtos that create partitions but they don't matter
they don't have a filesystem on them even if declared 'linux-data'
if partitions were important then disk offsets would not be because loader would take the offset from the partition data
 

Previously I did :

Code:
dd if=idbloader.img of=/dev/sdi1

but this could be wrong. Shouldn't it be :

Code:
dd if=idbloader.img of=/dev/sdi

?
 
Please give a look at what he says below :


Schermata del 2025-07-31 22-12-33.png


start / end sectors are important. Ok but the values suggested there don't work. I've got an error and I've used the values calculated by covacat...,these ones :

Code:
1 64 8000
2 8064 128
3 8192 8192
4 16384 8192
5 24576 8192
6 32768 229376
 
It is also important,I think, what he said at the bottom of this page :


this :

Download firmware :
After Pack firmware,use RK AndroidTool to download firmware,file_out instead of uboot.img. Need pick Loader,Parameter,U-boot(uefi firmware),Trust in the RK AndroidTool.

So,it seems that I should use the AndroidTool ? [here : https://androidmtk.com/rockchip-android-tool ]
 
Maybe back to the rkflash tool (or whatever it is called) with board attached via USB host mode.
You are already Linux-centric it seems so why not? I kinda dislike USB gadget mode but for a bricked board it works.
@Soren mentioned earlier what a wreck writing Rockchip bootrom is and he is right.. Best to use their dumb graphical tool that I don't trust one bit..

But back to this concern: This RK3399 UEFI-EDK2 build looks like a GENERIC one. An Eight year old one. I don't see that ending well.

Notice how there is a different build for every board in the RK3588 EDK2 repository.

Just like flashing a BIOS to a motherboard, the BIOS or FIRMWARE has to be suited for the board. Not get it close and it might work.
Think of EDK2 as your BIOS even on ARM.
In this case maybe you get it booting but nothing works right.
Don't waste too much time on this...
 
Maybe back to the rkflash tool (or whatever it is called) with board attached via USB host mode.
You are already Linux-centric it seems so why not? I kinda dislike USB gadget mode but for a bricked board it works.
@Soren mentioned earlier what a wreck writing Rockchip bootrom is and he is right.. Best to use their dumb graphical tool that I don't trust one bit..

But back to this concern: This RK3399 UEFI-EDK2 build looks like a GENERIC one. I don't see that ending well.

Notice how there is a different build for every board in the RK3588 EDK2 repository.

Just like flashing a BIOS to a motherboard, the BIOS or FIRMWARE has to be suited for the board. Not get it close and it might work.
Think of EDK2 as your BIOS even on ARM.
In this case maybe you get it booting but nothing works right.
Don't waste too much time on this.

When I read the words "flash" ; "firmware" ; "its own flashing tool" ; I think that the procedure refers to the flashing of the internal EMMC. But the internal EMMC of the KHADAS EDGE-V that I've bought is very small. It's only 32 GB,so even I will be able to install the RK3399 UEFI-EDK2 + FreeBSD,I can't make a great use of it. This is the reason why I didn't try to use its own proprietary tool,yet. I want / can use only the external sd card,that has a bigger amount of space available.

Don't waste too much time on this.

Mine is not only an experiment,but it is also a hope. The hope that using RK3399 UEFI-EDK2 will fix the trembling of my HDMI screen which happens when I use u-boot + Kernel for FreeBSD 14.x ;

Who knows ? Maybe using UEFI-EDK2 instead of u-boot,it will disappear...or not ?
 
it may help if you have a serial console connected too

In Linux,I tried to enable the serial console on my RockChip RK3399 to inspect what happens as soon as FreeBSD boots. This is the tutorial that I'm following :


And this is the adapter that I'm using :

Code:
Product: CP2102 USB to UART Bridge Controller
usb 1-9: Manufacturer: Silicon Lab
usb 1-9: cp210x converter now attached to ttyUSB0

I followed carefully the instructions but I'm not able to see any message inside the console.

I tried setting port 115200,1500000 and without configuring a speed. The result is the same. No messages inside the console as soon as I power on the board.

Please give a look at the pictures that I have attached.

PS : Since this is a FreeBSD place,I'm going to repeat the procedure using FreeBSD. That's right.
 

Attachments

  • 1.jpeg
    1.jpeg
    233.9 KB · Views: 142
  • 2.jpeg
    2.jpeg
    167.6 KB · Views: 142
  • 3.jpeg
    3.jpeg
    98 KB · Views: 141
  • 4.jpeg
    4.jpeg
    194.5 KB · Views: 138
From 2.JPEG you only have two wires connected for serial console. You need THREE.
You have black wire in correct spot on PIN-6 of a PI-40 Pin GPIO header but you need TX and RX too. Pin 8 and Pin 10 are used for those.
Black is ground correct?
 
Serial Console is very common on bringing up new Arm boards. Are you sure you are comprehending this? Most boards with a 40 pin header use exactly the same layout for UART.

Please feel free to ask questions but I told you earlier about wrapping tape around the dupont wires. Serial Console/UART on 40pin is a universal pinout. Once you find the right combination tape them up. Just remember in your head Black wire goes up top. That will get you by on 80% of boards. Look for PIN 1 and adjust.
From Pine64 to Rock64 the console pins are the same.
Some earlier ArmV7 boards like BananaPi and Hummingboard had dedicated pins for Serial Console instead of using GPIO header pins..
 
Serial Console is very common on bringing up new Arm boards. Are you sure you are comprehending this? Most boards with a 40 pin header use exactly the same layout for UART.

Please feel free to ask questions but I told you earlier about wrapping tape around the dupont wires. Serial Console/UART on 40pin is a universal pinout. Once you find the right combination tape them up. Just remember in your head Black wire goes up top. That will get you by on 80% of boards. Look for PIN 1 and adjust.
From Pine64 to Rock64 the console pins are the same.
Some earlier ArmV7 boards like BananaPi and Hummingboard had dedicated pins for Serial Console instead of using GPIO header pins..

aScreenshot_2025-08-03_11-18-25.jpg
 
GPIO header but you need TX and RX too. Pin 8 and Pin 10 are used for those.

What's the color generally used by TX and RX ? I want to try to connect them to pin 8 and 10.

The adapter used by the dude mentioned on the tutorial has one only wire left untouched and it's white. What is this ?
It can't be RX or TX,because they are two wires,but one wire only is left unconnected in the photo.

Black is ground correct ?

I don't know. I followed carefully the tutorial,trying to record what works. It's not easy for me to understand which colors are tied to which pins. It seems that colors change.

The tutorial said to connect black to pin 6 and brown to pin 8. Since my board is exactly the same as the board used by the dude who wrote the tutorial,it should work. Mathematic is not an opinion ? Or,like I have always thought,it can be.

Are you sure you are comprehending this ?

Bro,I don't want to be rude,but did you read the tutorial that I've linked ?. You seem to "blame" me a little bit. You seem to don't know what are the reasons why I have attached only two jumpers. You should not "blame" me if you had read the tutorial,because on that the reason is explained.
 
(For now RX Red, TX Green, just to remember myself R ed-> R x)

Source :


So,Red/RX = Pin 8 ; Green/TX = Pin 10.

BTW,as I had suspected :

There doesn't seem to be any standard or convention for RX/TX indicator colors specifically. Some boards seem to also use yellow, blue or amber, besides red and green. If it is of any relevance, it is worth noting that the human eye is most sensitive to green, so it might make sense to use green for whichever direction will have shorter bursts of bits going through - that way, the longer bursts would be red or yellow or whatever, and both colors would be perceived well enough.

Another one says :

There is a CE guideline for indicator colors:

Red - fault, alarm.
Yellow - warning, attention. (The are a some specific exceptions: "cut" indicator on RF generators is always yellow.)
Blue - working, energized, treatment in progress. (In my experience, blue LEDs catch the eye and look cool, but can be distracting sometimes.)
Green - everything else.

Serial TX and RX should be both green, or both blue, or one of each.

So,maybe :

Green/RX = Pin 8 ; Blue/TX = Pin 10.
 
Bro,I don't want to be rude,but did you read the tutorial that I've linked ?. You seem to "blame" me a little bit. You seem to don't know what are the reasons why I have attached only two jumpers. You should not "blame" me if you had read the tutorial,because on that the reason is explained.
No I don't read anything you link to. It don't interest me.
I have failed as a teacher and give myself an F-
Sorry. Time for another helper to step in.
 
Back
Top