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 22.04 64-bit and is up to date:
$ sudo apt-get update && sudo apt-get dist-upgrade
For Ubuntu 22.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.
Download Yocto Kirkstone 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-kirkstone-6.1.46_09.01.00.08-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 22.04 -w $(pwd)
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-09.01.00.08-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/build $ . conf/setenv
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 deploy-ti/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-kirkstone-6.1.46_09.01.00.08-v1.0__android-14_09.02.00-v1.0"' >> 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 deploy-ti/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 deploy-ti/images/am62x-var-som/am62__yocto-kirkstone-6.1.46_09.01.00.08-v1.0__android-14_09.02.00-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.
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 |