[Buildroot] [PATCH 1/3] board/freescale/imx: Add helper to generate fw binary

Thomas Petazzoni thomas.petazzoni at bootlin.com
Tue Nov 3 22:39:34 UTC 2020


Hello Xavier,

On Tue, 28 Apr 2020 23:50:46 +0200
Xavier Roumegue <xroumegue at gmail.com> wrote:

> Hello Thomas,
> iMX8 Upstream uboot adds a custom target 'flash.bin', a bootable medium once
> written to 33k offset.
> 
> 1) On iMX8m[mqn], the (lp)ddr4 firmware, and hdmi fw for iMX8mq, have to be copied
> in the uboot build dir prior to execute the build.
> Additional SoC firmwares (system and security controllers) have to be copied
> for iMX8X and iMX8QM.
> 
> 2) (lp)ddr4 firmware is appended to uboot spl thanks to tools/imx8m_image.sh.
> 3) A config file per imx platform (*.cfg) is describing the imx mkimage parameters,
> ..i.e. loaders file paths and entry points, SoC firmwares, boot rom options,
> etc..
> 4) Final loader is uboot.itb, generated as dependency of flash.bin for iMX
> platforms, and using an its file generated by arch/arm/mach-imx/mkimage_fit_atf.sh.
> ATF, TEE images have as well to be copied to uboot build dir, and their entry
> points can be specified through environment variables.
> 
> 5) Generate 'flash.bin'
> 
> The proposed script is taking care of 2), 3) and 5), with intention to support all
> iMX8 platforms generating the mkimage config file on the fly and relying on
> buildroot recipes to copy the required firmwares in images directory.
> 
> Current proposal does not generate the uboot FIT image, but this would likely be
> an enhancement I would like to bring once 3) is achieved for all iMX8.

Thanks a lot for providing those additional details, and sorry for the
long delay. After looking into this a bit, I really think we should
leverage more what U-Boot upstream is doing, and not re-invent all this
image creation logic.

So in fact, I do like better what
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572
is doing. The only gotcha is that it uses BINDIR to point to
BINARIES_DIR, but BINDIR doesn't exist in upstream U-Boot, it seems to
be some SolidRun-specific change that we can't rely on.

But since this patch is also adding a
BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE, we can definitely add some logic
in uboot.mk to copy the i.MX firmware files within the U-Boot source
directory prior to the build. Yes, it's more logic in uboot.mk, but I
find that better than more logic in yet another custom shell script in
board/.

Do you think you could rework your patch in this direction ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


More information about the buildroot mailing list