Create a bootable device for ARM ROCKCHIP
INDEX
Format the device
A bootable device where to flash BSP binaries needs a specific partitioned storage.
The device must have at least two partitions:
the first formatted as FAT32 and with size at least 100MB;
the second formatted as EXT4 and big enough to decompress the filesystem as explained later.
In following instructions the device will be commonly declared as /dev/<device>
.
In case of a µSD it is usually named /dev/sdx
, while in case of eMMC /dev/mmcblk*
.
The partitions associated to the device are usually named /dev/<device>1
, /dev/<device>2
, etc..
Before performing any partitioning operation, it is always necessary to umount them.
Every command listed in this page is executed as superuser
You can use many different tools to create the partitions, such as gparted
, which has a graphical interface, or sfdisk
, fdisk
on the command line.
If you want to use the command line sfdisk
tool instead, you need to:
first create a text file called devicepart.sfdisk, copying the following content inside it
start= 81920, size= 204800, name="bootfs", type=b
start= 286720, name="rootfs"
create the boot device with the commands
sfdisk --force /dev/<device> < devicepart.sfdisk
#format the first partition as FAT32
mkfs.vfat /dev/<device>1
#format the second partition as EXT4
mkfs.ext4 /dev/<device>2
An empty bootable device has now been created!
Flash the BSP inside the bootable device
In order to flash BSP Linux distribution inside the formatted bootable device, the following binaries are required:
U-Boot image
dtb file (device tree blob) file and dtbo (device tree overlay) files
Kernel image
filesystem, Linux Filesystem (Yocto Filesystem)
In the following sections you will be guided in flashing your bootable device using the pre-compiled binaries that you can find in the board page. If you want to compile binaries on your own, please follow https://secospa.atlassian.net/l/c/a0PFeQpc to generate them.
Flash u-boot
To flash the U-Boot image, you need:
idbloader.img
trust.img
uboot.img
These binaries images are created by u-boot compilation or you can download the precompiled binaries from seco-rk3399-c31_uboot_4.19.111_v1-00-00_rk2017-09_20211217.tar.gz.
These binaries can be flashed with:
dd if=./idbloader.img of=/dev/<device> seek=64
sync
dd if=./uboot.img of=/dev/<device> seek=16384
sync
dd if=./trust.img of=/dev/<device> seek=24576
sync
Flash kernel and filesystem
Choose the right binaries from the board page. You need to download a kernel and a filesystem tarball.
In the command below we suppose two device partitions, mounted respectively as /media/<device>1
and /media/<device>2
. If your situation is different, please change the path accordingly.
First, extract the filesystem inside the second partition, with the command:
tar xpf <filesystem-file>.tar -C /media/<device>2
Extract the kernel tarball provided: inside it there are 2 folders, named boot and lib. You need to copy all the content of the boot folder inside the root of the first partition of the device, e.g.: cp boot/* /media/<device>1
Copy the content of the lib/modules folder of the tarball inside the lib/modules folder inside the second partition, e.g.:
mkdir /media/<device>2/lib/modules
cp -r lib/modules/* /media/<device>2/lib/modules
Now unmount the device and you are ready to go.