Create a bootable device for ARM i.MX BSPs
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 32MB;
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 unmount 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
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= 8192, size= 67584, name="bootfs", type=b
start= 75776, 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, choose the right image for your board and execute the proper command to flash bootloader. Every board (depending on the processor) has a different command to be executed:
for all i.MX6 product
sudo dd if=<u-boot-filename>.imx of=/dev/<device> bs=512 seek=2 conv=fsync
for i.MX8 products, follow this table
Device | Command to flash bootloader into /dev/<device> |
---|---|
SM-C12 |
|
Q7-C25 |
|
Q7-C26 |
|
μQ7-C72 mini |
|
μQ7-C72 nano | N/A |
SBC-C20 |
|
SBC-C43 |
|
SBC-C61 |
|
SBC-C57 |
|
SM-D18 |
|
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 xjpf <filesystem-file>.tar.bz2 --numeric-owner -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.: cp -r lib/modules/* /media/<device>2/lib/modules
Now unmount the device and you are ready to go.