Yocto Customizing U-Boot AM62
Expression error: Unexpected >= operator. Expression error: Unexpected >= operator.
Introduction
This guide demonstrates how to patch and rebuild the VAR-SOM-AM62 U-Boot images using Yocto.
To learn how to build the U-Boot images outside of Yocto, see: Build U-Boot from source code
Before Starting
Before starting this guide, you must have the Yocto environment set and be able to build images for the VAR-SOM-AM62.
Please see: Build Yocto from source code.
The remainder of the guide assumes the Yocto working directory is ~/var-ti-yocto
Making changes in the source code
Choose one of the following three methods to customize the U-Boot source code and build it using Yocto:
Add your patches on top of the Variscite source code
Fetch the U-Boot source:
$ MACHINE= bitbake -c unpack virtual/bootloader $ mkdir -p ../local_repos/ $ cp -a arago-tmp-default-glibc/work/-oe-linux/u-boot-variscite/<uboot version>/git/. ../local_repos/ $ cd ../local_repos/ $ git reset --hard $ git clean -fdx
Next, make the desired changes to the U-Boot source code. After changing the source code, create a diff file:
$ git diff > ~/var-ti-yocto/tisdk/sources/meta-variscite-bsp-ti/recipes-bsp/u-boot/u-boot-variscite/uboot.diff
Finally, configure ~/var-ti-yocto/tisdk/sources/meta-variscite-bsp-ti/recipes-bsp/u-boot/u-boot-variscite_<u-boot version>.bb
to apply the patch by appending:
SRC_URI += "file://uboot.diff"
Use a local repository
Fetch the U-Boot source:
$ MACHINE= bitbake -c unpack virtual/bootloader $ mkdir -p ../local_repos/ $ cp -a arago-tmp-default-glibc/work/-oe-linux/u-boot-variscite/<uboot version>/git/. ../local_repos/ $ cd ../local_repos/ $ git reset --hard $ git clean -fdx
Next, make the desired changes to the U-Boot source code. After making changes in the source code you need to commit them.
For example:
$ cd /local_repos/ $ vim board/variscite//.c $ vim include/configs/.h edit and save $ git commit -a -m "my__changes"
To list all of the commits: $ git log
Get the latest commit ID: $ git rev-parse HEAD
Update the recipe to use the local repository instead of the default one:
$ cd /sources/meta-variscite-imx/recipes-bsp/u-boot/
Create a u-boot-variscite.bbappend file:
$ vim u-boot-variscite_%.bbappend
Append the following lines to it (see the previous section for listing the commits or getting the latest commit ID):
UBOOT_SRC = "git://<var-ti-yocto_directory_path>/local_repos/;protocol=file" SRCBRANCH_ = "" (or your own created branch) SRCREV_ = "The commit id you'd like to use"
Expression error: Unexpected < operator.
(If you do so, make sure to run " bitbake -c cleansstate virtual/bootloader" before rebuilding U-Boot)
Use your remote repository on GitHub
Using this method Yocto will fetch the source code from your remote repository on GitHub.
Create a GitHub account and upload your proprietary U-Boot to a new repository: You can fork our repository to your account by visiting the following link and clicking on "Fork" at the top right of the screen: https://github.com/varigit//tree/
Alternatively, you can clone the repository to your local machine, and push it later to your account.
Update the recipes to use your remote repository instead of the default one:
$ cd /sources/meta-variscite-imx/recipes-bsp/u-boot/
Create a u-boot-variscite.bbappend file:
$ vim u-boot-variscite_%.bbappend
and append the following lines to it (see the previous section for listing the commits or getting the latest commit ID):
UBOOT_SRC = "git://github.com/<your_account>/.git;protocol=git" SRCBRANCH = "" (or your own created branch) SRCREV = "The commit id you'd like to use"
Expression error: Unexpected < operator.
(If you do so, make sure to run " bitbake -c cleansstate virtual/bootloader" before rebuilding U-Boot)
Building U-Boot using Yocto
After making the desired changes to the source code following one of the methods described in the Making changes in the source code, you can build the U-Boot images by running:
$ cd ~/var-ti-yocto/tisdk/build $ . conf/setenv # Build only the U-Boot images: $ MACHINE=am62x-var-som bitbake -c deploy u-boot-variscite # tispl.bin and u-boot.img $ MACHINE=am62x-var-som bitbake -c deploy mc:k3r5:u-boot-variscite # tiboot3.bin # Optionally, you may skip building U-Boot and just build your image: $ MACHINE=am62x-var-som bitbake <image name>
The relevant output files are:
deploy-ti/images/am62x-var-som/u-boot.img deploy-ti/images/am62x-var-som/tispl.bin deploy-ti/images/am62x-var-som/tiboot3.bin
see: Build U-Boot from source code to learn how to update a running board with these images.