[Buildroot] [PATCH 1/1] boot/mxs-bootlets: add support for zImage with appended DTB

Yann E. MORIN yann.morin.1998 at free.fr
Thu Jan 11 15:26:08 UTC 2024


Laurent, All,

On 2024-01-11 13:19 +0000, Laurent Badel via buildroot spake thusly:
> When building a zImage with appended DTB, buildroot creates a copy of
> the zImage named zImage.$(LINUX_DTS_NAME). mxs-bootlets.mk does not
> take this into consideration and instead passes the original zImage
> (without DTB appended) to elftosb to generate the SB file. Thus,
> make sure that the correct zImage is used in this process.
> 
> Note: this patch only supports a single DTS specified in the
> configuration, because there is no obvious use case for multiple DTS's
> with mxs-bootlets. If multiple DTS's are configured, only the first one
> will be used.

That's a bit unfortunate that we have to rely on the ordering.

So, if using two or more DTS in cunjunction with mxs-bootlets does not
make sense, should that be forbidden? I.e. would we need something like
the following (code slightly elided for brevity):

    ifeq ($(BR2_TARGET_MXS_BOOTLETS_LINUX),y)
    ifeq ($(BR2_BOOT_MXS_BOOTLETS),y)
    ifneq ($(words $(LINUX_DTS_NAME)),1)
    $(error More than one DTS specified; mxs-bootlets can only use one)
    endif
    endif
    define MXS_BOOTLETS_BUILD_LINUX_PREP
        ...
    endef
    MXS_BOOTLETS_ZIMAGE_NAME = zImage$(....)
    define MXS_BOOTLETS_SED_LINUX
        ...
    endif
    endif

(See below the name of the variable.)

> Signed-off-by: Laurent Badel <laurentbadel at eaton.com>
> ---
>  boot/mxs-bootlets/mxs-bootlets.mk | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/boot/mxs-bootlets/mxs-bootlets.mk b/boot/mxs-bootlets/mxs-bootlets.mk
> index adc22767..2003b23f 100644
> --- a/boot/mxs-bootlets/mxs-bootlets.mk
> +++ b/boot/mxs-bootlets/mxs-bootlets.mk
> @@ -65,9 +65,10 @@ define MXS_BOOTLETS_BUILD_LINUX_PREP
>  	BOARD=$(MXS_BOOTLETS_BOARD) CROSS_COMPILE="$(TARGET_CROSS)" \
>  		$(MAKE1) -C $(@D) linux_prep
>  endef
> +ZIMAGE_NAME=zImage$(if $(BR2_LINUX_KERNEL_APPENDED_DTB),.$(notdir $(firstword $(LINUX_DTS_NAME))))

The namespace is global, so the variable names have to be manually
scopped with the name of the package they apply to, in this case:

    MXS_BOOTLETS_ZIMAGE_NAME

Regards,
Yann E. MORIN.

>  define MXS_BOOTLETS_SED_LINUX
>  	sed -i 's,[^ *]linux_prep.*;,\tlinux_prep="$(@D)/linux_prep/output-target/linux_prep";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
> -	sed -i 's,[^ *]zImage.*;,\tzImage="$(LINUX_DIR)/arch/arm/boot/zImage";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
> +	sed -i 's,[^ *]zImage.*;,\tzImage="$(LINUX_DIR)/arch/arm/boot/$(ZIMAGE_NAME)";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
>  endef
>  endif
>  
> -- 
> 2.17.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list