[Buildroot] [PATCH 24/26] Improve TARGETS handling for bootloaders and kernel

Luca Ceresoli luca at lucaceresoli.net
Mon Jun 20 15:01:27 UTC 2011

Hi Thomas,

Thomas Petazzoni wrote:
> As the kernel and bootloaders do not use the normal BR2_PACKAGE_*
> Kconfig options, their target name was not automatically added to the
> global TARGETS variable. Each bootloader .mk and the linux.mk had to
> add their own target manually to TARGETS, and the package
> infrastructure was making tests on non-existing Kconfig variables.
> This commit improves the package infrastructure so that it looks at
> BR2_PACKAGE_<pkg>  for packages, BR2_BOOT_<pkg>  for bootloaders and at
> the special BR2_LINUX_KERNEL for the linux package.
> This allows to simplify a little bit the bootloaders and linux .mk
> files.
> Signed-off-by: Thomas Petazzoni<thomas.petazzoni at free-electrons.com>
> ---
> --- a/package/Makefile.package.in
> +++ b/package/Makefile.package.in
> @@ -522,10 +522,20 @@ $$($(2)_TARGET_UNINSTALL):		PKG=$(2)
>   $$($(2)_TARGET_CLEAN):			PKG=$(2)
>   $$($(2)_TARGET_DIRCLEAN):		PKG=$(2)
> +# Compute the name of the Kconfig option that correspond to the
> +# package being enabled. We handle three cases: the special Linux
> +# kernel case, the bootloaders case, and the normal packages case.
> +ifeq ($(1),linux)
> +else ifeq ($(4),boot)
> +$(2)_KCONFIG_VAR = BR2_BOOT_$(2)
> +else ifeq ($(4),package)
> +$(2)_KCONFIG_VAR = BR2_PACKAGE_$(2)
> +endif

This breaks all packages in subdirectories, such as
package/multimedia/ffmpeg, for which $(4) == "package/multimedia".

This can be fixed as:

-else ifeq ($(4),package)
+else ifeq ($(firstword $(subst /, ,$(4))),package)

or, even more simply:

-else ifeq ($(4),package)


More information about the buildroot mailing list