Skip to content

Customizing U-Boot

Introduction

This guide demonstrates how to patch and rebuild Debian U-Boot images with FlexBuild.

To build U-Boot outside of FlexBuild, see Build U-Boot from source code.

Requirements

Make sure the FlexBuild Docker environment is set up as described in Build Debian from source code.

Add Patches on Top of the Variscite Source Code

The following steps can be executed outside or inside the container.

Fetch the U-Boot source:

git clone https://github.com/varigit/uboot-imx -b lf_v2024.04_6.6.52-2.2.2_var01
cd uboot-imx
git clean -fdx

Make the desired changes to the U-Boot source code. For example:

vim drivers/net/fec_mxc.c
vim include/configs/mx7dvar_som.h

After changing the source code, commit the changes locally and generate a patch file:

git add .
git commit -e
git format-patch -1

Copy the patch to the U-Boot patch folder inside the FlexBuild directory:

mkdir -p [...]/flexbuild/patch/uboot/
cp 0001-my-changes.patch [...]/flexbuild/patch/uboot/

Build U-Boot Individually

Do not run git am or git apply manually. FlexBuild applies the patch during the U-Boot build.

Enter the Docker environment if needed:

cd [...]/flexbuild
. setup.env
bld docker
. setup.env

Build U-Boot:

bld -f sdk-var.yml -m imx7-var-som uboot

If a rebuild is required, clean the BSP build first:

bld clean-bsp
bld -f sdk-var.yml -m imx7-var-som uboot