Skip to content

Instantly share code, notes, and snippets.

@pgwipeout
Last active November 6, 2020 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgwipeout/6fdbd4a8659ac3ad1afbc0078853a66d to your computer and use it in GitHub Desktop.
Save pgwipeout/6fdbd4a8659ac3ad1afbc0078853a66d to your computer and use it in GitHub Desktop.
Procedure to build a rockchip compatible image from scratch.
sudo gdisk <file> or /dev/<target>
o // to create new gpt
y
x // expert menu
l // change sector alignment
64
m // return to main menu
n // create new partition
1
64 // start at sector 64
34815 // end at sector 34815 (16mb minimum aligned to 2048 sectors)
8300 // linux data, default, can just hit return here
x // return to expert menu and reset sector alignment to 2048
l
2048
m // return to main menu
n // create efi partition
2
34816 // default, just hit return here
128M // go to 128M from start
EF00 // EFI partition type
n // create boot partition
3
<num> // default, just hit return here
256M // minimum
8300 // default
n
4
<num> // default start
<num> // default, go to end
8300 // default, linux
c // change partition names
1
u-boot
c
2
efi
c
3
boot
c
4
recovery
w // write the table and exit
Now, at this point, the procedure changes if this is an image or an actual device.
If it's an image, you need to mount it
sudo losetup -f -P <image> // mount as a loop device to the first available, with partitions
losetup | grep <image> // find the loop device assigned
Partitioning is the same for either, the only thing that changes is the device name.
sudo mkfs.fat -F 32 /dev/<loop device>p2 or /dev/<target>2 // partition 2 is /boot/efi
sudo mkfs.ext4 /dev/<loop device>p3 or /dev/<target>3 // partition 3 is /boot
sudo mkfs.ext4 /dev/<loop device>p4 or /dev/<target>4 // partition 4 is recovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment