Installing Yocto to the SOM Internal Storage¶
Introduction¶
All SOMs can either boot from an SD card or from their internal storage.
The SOM internal storage: VAR-SOM-MX8X comes with eMMC, which holds U-Boot, the kernel image and an ext4 root file system.
eMMC Structure¶
0-8 MiB: Non-partitioned space, saved for U-Boot. 8 MiB-End: "rootfs" - An ext4 partition containing the root file system (including Linux image and the device tree blobs under /boot).
Installing the Yocto Binaries¶
If you followed the Create an extended SD card steps, the Yocto binaries and the flashing scripts will be included in your SD card. The flashing scripts are easy-to-use example scripts for flashing images into NAND flash / eMMC. There is also a section below describing how to flash the images manually.
Images Locations¶
Following is the directory structure on your SD card, which elaborates the files location that the below installation scripts are expecting:
Prepare the Images for Flashing to eMMC¶
Plug the bootable SD card into your host machine and mount the rootfs partition. Here we assume it is mounted on /media/rootfs. Copy all the mentioned Yocto-built binaries to the SD card:
Note: If you followed the Create an extended SD card steps, the flashing scripts and all relevant binaries are already included in your SD card, and the below commands are redundant.
Setup:
export YOCTO_IMGS_PATH=~/var-fsl-yocto/build_xwayland/tmp/deploy/images/imx8qxp-var-som
export P2_MOUNT_DIR=/media/rootfs/
sudo mkdir -p ${P2_MOUNT_DIR}/opt/images/Yocto/
eMMC images:
sudo cp ${YOCTO_IMGS_PATH}/imx-boot ${P2_MOUNT_DIR}/opt/images/Yocto/imx-boot-sd.bin
sudo cp ${YOCTO_IMGS_PATH}/fsl-image-gui-imx8qxp-var-som.tar.gz ${P2_MOUNT_DIR}/opt/images/Yocto/rootfs.tar.gz
Flashing Scripts¶
The flashing scripts are located on the SD card at /usr/bin/:
Manual Step-By-Step Flashing to eMMC¶
Flashing the eMMC requires several steps including partitioning, file system formatting and image extraction. We recommend using the provided scripts to perform this task.
Use the prepared SD card to boot the board and run the following:
Make sure the eMMC is not mounted:
Delete current data on eMMC:
for((i=1; i<=16; i++)); do [ -e ${node}p${i} ] && dd if=/dev/zero of=${node}p${i} bs=1M count=1 conv=fsync; done
dd if=/dev/zero of=${node} bs=1M count=8 conv=fsync
Create a partition table:
Format the partition:
Flash U-Boot:
Extract the rootfs archive:
mkdir -p /run/media/rootfs
mount ${node}p1 /run/media/rootfs
tar xvpf rootfs.tar.gz -C /run/media/rootfs
sync
umount /run/media/rootfs
Summary¶
We described the results of a Yocto build, how to copy it to a bootable SD card, and how to flash it to the internal storage. With the extended SD card and recovery SD card we provide an installation script located at /usr/bin/install_yocto.sh. It is safer to use it instead of flashing manually.