Qualcomm Robotics RB5/RB6 - Build image
In this section, we will cover how to build your own image using the Yocto Project. The Yocto Project is an open source project that has the tools and processes that enable the creation of Linux-based systems for embedded systems[1]. Yocto runs in our host computer and we define the target machine for which we are going to develop, that in our case is the Qualcomm Robotics RB5. We have two parts, the first one will show how to setup the Yocto environment in your host computer so we are ready to start developing. In the second part, we will show the steps to use Yocto and build a base Image that will be ready to flash into your QRB5. The host computer must have:
- Operating system (OS): Ubuntu 18.04 or later.
- Disk-space: 50GB
- RAM: 16GB
Setting up host machine
The following steps show how to setup your host computer with the Yocto Project[2][3]. This will allow us to have all the right tools needes to then create an Image.
1. First we need to install the dependencies of the Yocto Project in our host computer. For this, open a terminal and run the following command:
sudo apt-get install git python zstd gawk wget git-core diffstat unzip texinfo \ gcc-multilib build-essential chrpath socat cpio python python3 python3-pip \ python3-pexpect xz-utils debianutils iputils-ping
2. Now we need to create a directory to download the build metadata, run the next command:
mkdir -p ${HOME}/bin
3. Add the created directory to PATH environment variable with the following command:
export PATH=${HOME}/bin:${PATH}
4. Download the files and save them in the previously created directory runnning the command below:
curl https://storage.googleapis.com/git-repo-downloads/repo > ${HOME}/bin/repo
5. Assign the downloaded file the needed permission for execution with the next command:
chmod a+x ${HOME}/bin/repo
6. Now we are going to create a new working directory where all of the files needed to develop in Yocto are going to br stored. The next command creates the directory and then moves inside it:
mkdir oe-rpb && cd oe-rpb
7. The Yocto Project has many version releases [4], and each of them has a name assigned. For this reason, we are going to create an environment variable for the version of Yocto we want to use. Here we are working with dunfell, but the kirkstone release has also been tested.
export BRANCH="dunfell"
8. Now we are going to initialize the repository with a GitHub repository to setup the build environment. It will initialize with its latest version and it check out the specified Yocto branch.
repo init -u https://github.com/96boards/oe-rpb-manifest.git -b qcom/${BRANCH}
The output of the above command should state that the repo is initialized:
repo has been initialized in /home/user/oe-rpb
Your directory should now contain a .repo
directory where files such as the manifest will be kept.
user@desktop:~/oe-rpb$ ls -al total 12 drwxrwxr-x 3 user user 4096 ene 31 20:31 . drwxr-xr-x 38 user user 4096 ene 31 20:30 .. drwxrwxr-x 5 user user 4096 ene 31 20:31 .repo
9. The following command will pull down the metadata resources. It updates the working tree to the latest revision, synchronizing the local project directories with the remote ones.
repo sync
The above command will output the following:
remote: Enumerating objects: 910, done. remote: Counting objects: 100% (371/371), done. remote: Compressing objects: 100% (130/130), done. remote: Total 910 (delta 240), reused 335 (delta 223), pack-reused 539 Receiving objects: 100% (910/910), 181.67 KiB | 712.00 KiB/s, done. Resolving deltas: 100% (491/491), completed with 44 local objects. Fetching: 100% (17/17), done in 1m8.781s Checking out: 100% (17/17), done in 0.638s repo sync has finished successfully.
Setup environment and building
Now that our host computer has everything needed to develop in Yocto, the following steps show how to setup the build environment. The build environment will help us specify the target machine, the distribution and the type of Image we are going to build, then it will build it for us.
1. Create an environment variable for the distro you want to use. There are two possible options: rpb and rpb-wayland. Both of them include the core packages as well as typical development packages, but the rpb distro is a headless one, meaning it does not have a desktop environment to use with a monitor. On the other hand, the rpb-wayland distro includes one desktop environment with Wayland and Weston servers [5]. For this guide, we chose the rpb-wayland distro, but the rpb one has also been tested.
export DISTRO_RB5="rpb-wayland"
2. The following command setups the build environment. In here we first are specifying the target machine; Qualcomm Robotics RB5 in our case, the distribution we chose in the previous step and sources the environment.
MACHINE=qrb5165-rb5 DISTRO=${DISTRO_RB5} source setup-environment build-wayland
The above command will output the following:
Welcome to OpenEmbedded Reference Platform Build (OE RPB) For more information about OpenEmbedded see their website: http://www.openembedded.org/ Your build environment has been configured with: MACHINE = qrb5165-rb5 SDKMACHINE = x86_64 DISTRO = rpb-wayland You can now run 'bitbake <target>' Some of common targets are: rpb-console-image rpb-desktop-image rpb-weston-image core-image-base core-image-minimal
3. Now that our build environment is setup and ready, we can now build our Image. In the last output, Yocto tells us possible Images to build (common targets). For this guide, we chose the rpb-weston-image-test. The -test variant means it includes additional packages typically useful for testing and validation. (If you chose the rpb distro, the rpb-console-image-test Image was tested)
bitbake rpb-weston-image-test
4. If the building process went fine, the built files will be located in the tmp-rpb_wayland-glibc/deploy/images/qrb5165-rb5 folder.
user@desktop:~/oe-rpb/build-wayland/tmp-rpb_wayland-glibc/deploy/images/qrb5165-rb5$ ls boot-qrb5165-rb5--5.15-r0-qrb5165-rb5-20230130164642.img modules--5.15-r0-qrb5165-rb5-20230130164642.tgz rpb-weston-image-test-qrb5165-rb5-20230130164642.testdata.json boot-qrb5165-rb5.img modules-qrb5165-rb5.tgz rpb-weston-image-test-qrb5165-rb5.ext4.gz boot-qrb5165-rb5-qrb5165-rb5.img qrb5165-rb5--5.15-r0-qrb5165-rb5-20230130164642.dtb rpb-weston-image-test-qrb5165-rb5.manifest boot-sm8250-rb5-dvt--5.15-r0-qrb5165-rb5-20230130164642.img qrb5165-rb5.dtb rpb-weston-image-test-qrb5165-rb5.tar.xz boot-sm8250-rb5-dvt-qrb5165-rb5.img qrb5165-rb5-qrb5165-rb5.dtb rpb-weston-image-test-qrb5165-rb5.testdata.json Image.gz rpb-weston-image-test-qrb5165-rb5-20230130164642.rootfs.ext4.gz sm8250-rb5-dvt--5.15-r0-qrb5165-rb5-20230130164642.dtb Image.gz--5.15-r0-qrb5165-rb5-20230130164642.bin rpb-weston-image-test-qrb5165-rb5-20230130164642.rootfs.manifest sm8250-rb5-dvt.dtb Image.gz-qrb5165-rb5.bin rpb-weston-image-test-qrb5165-rb5-20230130164642.rootfs.tar.xz sm8250-rb5-dvt-qrb5165-rb5.dtb
To flash the board, you will need the boot image and rootfs. The following shows the name of the files.
Boot Image: boot-qrb5165-rb5.img Rootfs Image: rpb-weston-image-test-qrb5165-rb5-20230130164642.rootfs.ext4.gz
5. Now that everything is ready, we are ready to flash our board. First, we need a bootloader, this bootloader is not built by Yocto, instead, we need to download one from Linaro. You can download it from this link, it will automatically download a bootloader for Linux. Then, you can check our Flashing Bootloader section on how to flash it to the board. After it is done, please come back to this section.
6. With the bootloader flashed to the board, we can now flash the boot image and rootfs built by Yocto. Please check our Flashing Boot Image and Rootfs section on how to do this. You will need the boot image
boot-qrb5165-rb5.img
and rootfs
rpb-weston-image-test-qrb5165-rb5-20230130164642.rootfs.ext4.gz
for it.
7. Congratulations! You built an image in Yocto and flashed it to your board, now it is ready to use.
References
- ↑ Yocto Project. Retrieved January 30, 2023, from [1]
- ↑ 96 Board oe-rpb-manifest repository. Retrieved January 30, 2023, from [2]
- ↑ Linaro OpenEmbedded Release Notes. Retrieved January 30, 2023, from [3]
- ↑ Yocto Project releases. Retrieved February 1, 2023, from [4]
- ↑ Wayland. Retrieved January 30, 2023, from [5]