Build U-Boot from source code¶
Toolchain Installation for Out of Debian Builds¶
To install the toolchain, follow the Debian Flexbuild Toolchain installation guide.
Build U-Boot Out of Flexbuild Tree¶
Obtain sources:
Configure compilation environment:
Cleanup everything:
Select configuration:
Build U-Boot:
Download and install Arm-none-eabi cross-compiler required to build OEI and SM
wget https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi.tar.xz
sudo tar -xf arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi.tar.xz -C /opt
Build Boot Image¶
The final boot image contains multiple firmware files, as explained by NXP in IMX_LINUX_USERS_GUIDE.pdf (Search for "How to build imx-boot image by using imx-mkimage").
The following procedure builds the final image:
Create imx-boot-tools directory:
Download imx_mkimage:
Download DDR firmware:
wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.26-d4c33ab.bin
chmod +x firmware-imx-8.26-d4c33ab.bin
./firmware-imx-8.26-d4c33ab.bin
rm firmware-imx-8.26-d4c33ab.bin
cp firmware-imx-8.26-d4c33ab/firmware/ddr/synopsys/* imx-mkimage/iMX95
Download ELE firmware:
wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-ele-imx-1.3.0-17945fc.bin
chmod +x firmware-ele-imx-1.3.0-17945fc.bin
./firmware-ele-imx-1.3.0-17945fc.bin
rm firmware-ele-imx-1.3.0-17945fc.bin
cp firmware-ele-imx-1.3.0-17945fc/mx95a0-ahab-container.img imx-mkimage/iMX95
Download and build ATF:
git clone https://github.com/varigit/imx-atf -b f_v2.12_6.12.20-2.0.0_var01
cd imx-atf
source
unset CFLAGS
unset LDFLAGS
unset AS
unset LD
make PLAT=imx95 bl31
cp build/imx95/release/bl31.bin ../imx-mkimage/iMX95
cd ..
Download and build OEI DDR Image and OEI TCM Image:
git clone https://github.com/varigit/imx-oei -b lf-6.12.20-2.0.0_var01
cd imx-oei
export OEI_CROSS_COMPILE=/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-
make really-clean
make board=mx95lp5 DEBUG=1 oei=ddr
cp build/mx95lp5/ddr/oei-m33-ddr.bin ../imx-mkimage/iMX95
make board=mx95lp5 DEBUG=0 oei=tcm
cp build/mx95lp5/tcm/oei-m33-tcm.bin ../imx-mkimage/iMX95
cd ..
Download and build SM:
git clone https://github.com/varigit/imx-sm -b lf-6.12.20-2.0.0_var01
cd imx-sm
export SM_CROSS_COMPILE=/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-
make really-clean
make -j $(nproc --all) config=mx95evk cfg
make -j $(nproc --all) config=mx95evk img
cp build/mx95evk/m33_image.bin ../imx-mkimage/iMX95
cd ..
Copy U-Boot binaries:
Build boot image:
cd imx-mkimage
make clean
make SOC=iMX95 flash_a55 REV=A0 OEI=YES LPDDR_TYPE=lpddr5 LPDDR_FUNC=train
mv iMX95/flash.bin iMX95/flash.bin
Install the Built U-Boot on an SD Card¶
sudo dd if=iMX95/flash.bin of=/dev/sdX bs=1K seek=32 conv=fsync
(Replace /dev/sdX with the correct device)
If you want to use our recovery SD card to flash the built U-Boot to NAND flash/eMMC, then copy it to the appropriate location in the SD card:
And eject the SD card gracefully from host machine.
Note: If you manually upgrade an existing U-Boot, and you have an old environment saved, it is a good idea to reset your environment to the new default (see Environment handling commands)