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 am33-yocto-dunfell-5.10.100_08.02.00.24-v1.0
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.02.00.24-config_var01.txt
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/tisdk/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
Build GUI demo image
$ MACHINE=am335x-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=am335x-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/am335x-var-som/var-default-image-am335x-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 NAND, 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/boot/MLO-nand /opt/images/Yocto/boot/u-boot.img-nand /opt/images/Yocto/boot/var-som-am33.dtb /opt/images/Yocto/boot/zImage /opt/images/Yocto/rootfs.ubi
Being the image designed to burn eMMCs, in order to burn the NAND, the following override is required
echo 'RECOVERY_SD_NAME="VAR_RECOVERY_TARGET_ROOTFS_TYPE ?= "ubi"' >> conf/local.conf
The var-default-image is not suitable for NANDs of 256 MB.
It's possible to further customize the image var-recovery-image, providing a dedicate image for the NAND and reducing the final image size. For example
echo 'VAR_RECOVERY_TARGET_ROOTFS ?= "var-thin-image"' >> conf/local.conf echo 'VAR_RECOVERY_IMAGE_ROOTFS_MAXSIZE ?= "${@eval('3700*1024')}"' >> conf/local.conf
By default, the image will be named var-recovery-image-am335x-var-som.wic.zst. It can be overridden adding the RECOVERY_SD_NAME variable to local.conf. For example:
echo 'RECOVERY_SD_NAME="am33__yocto-dunfell-5.10.100_08.02.00.24-v1.0"' >> conf/local.conf
Build the image:
$ MACHINE=am335x-var-som bitbake var-recovery-image
Write it to an SD card:
$ sudo umount /dev/sdX*
$ zstdcat arago-tmp-external-arm-glibc/deploy/images/am335x-var-som/var-recovery-image-am335x-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/am335x-var-som/am33__yocto-dunfell-5.10.100_08.02.00.24-v1.0.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.