Building uboot image with a silent console

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Building uboot image with a silent console

Building uboot image with a silent console

Hello everyone!

In this quick example its focused on how to customize uboot code to generate an uboot image with a silent console so its speed up the flash and boot time, this may provide helpful for customers who have a bigger images or just want to have a silent console.

Note: this should not be enabled if the image is still being under test, since this will disable all communication with the debug terminal and there won't be boot messages.

Requirements:


First clone the code from the uboot repository:
$ git clone https://github.com/nxp-imx/uboot-imx -b lf-6.1.1-1.0.0
$ cd uboot-imx

After we get the code, then proceed to enable the silent console in the uboot defconfig:

$ nano configs/imx8mn_ddr4_evk_defconfig
CONFIG_SILENT_CONSOLE=y
CONFIG_SILENT_U_BOOT_ONLY=y

For this to actually work we need to create the silent environmental variable and give it a value different from "0":
$ nano include/configs/imx8mn_evk.h
"silent=1\0"      \

As specified in our Linux porting guide:
Generate an SDK from the Yocto Project build environment with the following command. To set up the Yocto Project build environment, follow the steps in the i.MX Yocto Project User's Guide (IMXLXYOCTOUG). In the following command, set Target-Machine to the machine you are building for. See Section "Build configurations" in the i.MX Yocto Project User's Guide (IMXLXYOCTOUG)

Set up the host terminal window toolchain environment:
$ source/opt/fsl-imx-xwayland/6.1.1/environment-setup-aarch64-poky-linux
$ export ARCH=arm64

Build uboot binary:
$ make distclean
$ make imx8mn_ddr4_evk_defconfig
$ make

Build ARM Trusted Firmware (ATF)
$ cd ..
$ git clone https://github.com/nxp-imx/imx-atf -b lf-6.1.1-1.0.0
$ cd imx-atf/
$ make PLAT=imx8mn bl31
In case you get the error aarch64-poky-linux-ld.bfd: unrecognized option '-Wl,-O1'
$ unset LDFLAGS

Download the DDR training & HDMI binaries
$ cd ..
$ mkdir firmware-imx
$ cd firmware-imx
$ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.19.bin
$ chmod a+x firmware-imx-8.19.bin
$ ./firmware-imx-8.19.bin
Accept EULA and the firmware will be deployed.

Download imx-mkimage and build the boot image
$ cd ..
$ git clone https://github.com/nxp-imx/imx-mkimage -b lf-6.1.1-1.0.0
$ cd imx-mkimage
$ cp ../uboot-imx/spl/u-boot-spl.bin iMX8M/
$ cp ../uboot-imx/u-boot-nodtb.bin iMX8M/
$ cp ../uboot-imx/arch/arm/dts/imx8mn-ddr4-evk.dtb iMX8M/
$ cp ../imx-atf/build/imx8mn/release/bl31.bin iMX8M/
$ cp ../firmware-imx/firmware-imx-8.19/firmware/ddr/synopsys/ddr4_* iMX8M/
$ cp ../uboot-imx/tools/mkimage iMX8M/mkimage_uboot
$ make SOC=iMX8MN flash_ddr4_evk

After this we can download our uboot image to our board, we can either use the uboot image for boot or for flashing purpose only.

We can compare the time it takes using UUU with a standard pre-built image

uuu -V -b emmc_all imx-boot-imx8mn-ddr4-evk-sd.bin-flash_ddr4_evk imx-image-full-imx8mnevk.wic

AldoG_0-1692908409933.png

It takes 485.5 seconds using normal uboot with debug console enabled.

uuu -V -b emmc_all flash.bin imx-image-full-imx8mnevk.wic

AldoG_1-1692908409934.png

It takes 477.5 seconds using silent uboot console.

Even if the speed is not greatly improved (~8 seconds), in larger files it could help to speed up flashing, even if wants to have the console silent is a good option.

Hope everyone finds this useful!
For any question regarding this document, please create a community thread and tag me if needed.

Saludos/Regards,
Aldo.

No ratings
Version history
Last update:
‎08-24-2023 01:25 PM
Updated by: