Yocto Build Release
Introduction
This guide walks through the process for building Variscite's reference Yocto image from source code. It is derived from TI's guide Overview Building the SDK
Installing required packages
To learn more, please see Variscite's Docker Build Environment guide.
If you are using docker, you can skip this section.
Please make sure your host PC is running Ubuntu 18.04/20.04 64-bit and is up to date:
$ sudo apt-get update && sudo apt-get dist-upgrade
For Ubuntu 18.04/20.04 64-bit:
$ sudo dpkg --add-architecture i386 $ sudo apt update && sudo apt install build-essential autoconf \ automake bison \ flex libssl-dev bc u-boot-tools \ diffstat \ texinfo gawk chrpath dos2unix \ wget unzip socat doxygen libc6:i386 \ libncurses5:i386 libstdc++6:i386 \ libz1:i386 g++-multilib \ git python3-distutils python3-apt
For Ubuntu 20.04 and older:
$ sudo apt install python
For Ubuntu 22.04 and newer,:
$ sudo apt install python-is-python3
By default Ubuntu uses “dash” as the default shell for /bin/sh. You must reconfigure to use bash by running the following command:
$ sudo dpkg-reconfigure dash
Be sure to select “No” when you are asked to use dash as the default system shell.
Install Toolchains to home directory
$ cd ~ $ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz && \ tar -Jxvf gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz -C $HOME && \ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz && \ tar -Jxvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz -C $HOME
Download Yocto Dunfell and setup environment
Download the latest source code (recommended):
$ git clone https://github.com/varigit/oe-layersetup ~/var-ti-yocto
or
Download a release tag:
$ git clone https://github.com/varigit/oe-layersetup ~/var-ti-yocto -b am62-yocto-dunfell-5.10.168_08.06.00.42-v1.5
To learn more, please see Variscite's Docker Build Environment guide.
If you choose to use docker, launch a new container with the host build directory mounted to /workdir/build and the toolchains mounted to the home directory:
$ cd ~/var-ti-yocto
$ ~/var-host-docker-containers/run.sh -u 20.04 -w $(pwd) $(for dir in ~/gcc-arm*; do echo -n "-v $dir:/home/vari/$(basename $dir) "; done)
Follow the remaining steps to build an image, replacing the path ~/var-ti-yocto/build with /workdir/build.
- Download the source code dependencies
$ cd ~/var-ti-yocto $ ./oe-layertool-setup.sh -f configs/variscite/processor-sdk-08.06.00.42-config_var01.txt
Fetch the core-secdev-k3 Security Dev Tool:
$ cd ~/var-ti-yocto/build $ git clone https://git.ti.com/git/security-development-tools/core-secdev-k3 -b master core-secdev-k3 $ cd core-secdev-k3 && \ git checkout bba9cabaeee96f7f287385188ff289b46769a4bf && \ cd ../
Next, setup the environment. The above commands are only required for the very first build setup: whenever restarting a newer build session (from a different terminal or in a different time), you can skip the full setup and just run:
$ cd ~/var-ti-yocto/build $ . conf/setenv $ export TOOLCHAIN_PATH_ARMV7=$HOME/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf && \ export TOOLCHAIN_PATH_ARMV8=$HOME/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu && \ export TI_SECURE_DEV_PKG_K3=`pwd`/core-secdev-k3
Build GUI demo image
$ MACHINE=am62x-var-som bitbake var-default-image
Build thin demo image
This image is based on var-default-image, but the size is strongly reduced removing the biggest packages (mainly LTP, multimedia, Qt5)
$ MACHINE=am62x-var-som bitbake var-thin-image
Create a bootable SD card
The wic image fully supports booting from an SD card. Use the command below to write it to an SD card:
$ sudo umount /dev/sdX* $ zstdcat arago-tmp-external-arm-glibc/deploy/images/am62x-var-som/var-default-image-am62x-var-som.wic.zst | sudo dd of=/dev/sdX bs=1M && sync
Replace sdX with the right device name. This can be obtained by "dmesg" command on your host Linux PC, after the SD card reader is inserted.
Create a Recovery SD card
As mentioned above, the wic image only supports booting from an SD card. To flash an image to eMMC, Variscite provides an image var-recovery-image, which inherits var-default-image and adds the following files needed for installing to eMMC:
/usr/bin/install_yocto.sh /usr/bin/echos.sh /opt/images/Yocto/ /opt/images/Yocto/boot /opt/images/Yocto/boot/u-boot.img /opt/images/Yocto/boot/tiboot3.bin /opt/images/Yocto/boot/tispl.bin /opt/images/Yocto/boot/uEnv.txt /opt/images/Yocto/rootfs.tar.zst
By default, the image will be named var-recovery-image-am62x-var-som.wic.zst. It can be overridden adding the RECOVERY_SD_NAME variable to local.conf. For example:
echo 'RECOVERY_SD_NAME="am62-yocto-dunfell-5.10.168_08.06.00.42-v1.5"' >> conf/local.conf
Build the image:
$ MACHINE=am62x-var-som bitbake var-recovery-image
Write it to an SD card:
$ sudo umount /dev/sdX*
$ zstdcat arago-tmp-external-arm-glibc/deploy/images/am62x-var-som/var-recovery-image-am62x-var-som.wic.zst | sudo dd of=/dev/sdX bs=1M && sync
Or, if the image name was overridden with RECOVERY_SD_NAME:
$ zstdcat arago-tmp-external-arm-glibc/deploy/images/am62x-var-som/am62-yocto-dunfell-5.10.168_08.06.00.42-v1.5.wic.zst | sudo dd of=/dev/sdX bs=1M && sync
Replace sdX with the right device name. This can be obtained by "dmesg" command on your host Linux PC, after the SD card reader is inserted.
Recovery SD card and eMMC partition table
The Recovery SD card and eMMC partition table is as follows:
Device | Boot | Start (Sectors) | End (Sectors) | Start (MB) | Sectors | Size | Type |
---|---|---|---|---|---|---|---|
/dev/mmcblk1p1 | * | 2048 | 83967 | 1 | 81920 | 40 | W95 FAT32 (LBA) |
U-Boot Env | 88064 | 90111 | 43 | 2048 | 1 | U-Boot Raw | |
/dev/mmcblk1p2 | 90112 | 15239167 | 44 | 15149056 | 7397 | Linux |