Skip to contentSkip to conversation

Fix selection of bootloaders from $(BR2_EXTERNAL)

PATCH New Eric Le Bihan 4 participants 6 messages Sep 25, 2014 – Jul 12, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix selection of bootloaders from $(BR2_EXTERNAL)

If a package is based on "generic-package", pkg-generic.mk will compute the name of the Kconfig variable to use for checking if this package has been selected by the user.

Unfortunately, this mechanism does not take into account the case where a bootloader is declared in a $(BR2_EXTERNAL)/boot directory.

So, even if the bootloader has been selected, it will not be added to $(TARGETS) and will not be built.

This patch fixes this issue.

---
 package/pkg-generic.mk | 2 ++
 1 file changed, 2 insertions(+)
package/pkg-generic.mk +2 -0
index d04fd36..064d736 100644
@@ -616,6 +616,8 @@ ifeq ($(1),linux)
 $(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
 else ifneq ($$(filter boot/%,$(pkgdir)),)
 $(2)_KCONFIG_VAR = BR2_TARGET_$(2)
+else ifneq ($$(filter $(BR2_EXTERNAL)/boot/%,$(pkgdir)),)
+$(2)_KCONFIG_VAR = BR2_TARGET_$(2)
 else ifneq ($$(filter toolchain/%,$(pkgdir)),)
 $(2)_KCONFIG_VAR = BR2_$(2)
 else
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 Fix selection of bootloaders from $(BR2_EXTERNAL)

Eric Le Bihan <[email protected]> schreef:

Quoted 22 lines

If a package is based on "generic-package", pkg-generic.mk will compute the name of the Kconfig variable to use for checking if this package has been selected by the user.

Unfortunately, this mechanism does not take into account the case where a bootloader is declared in a $(BR2_EXTERNAL)/boot directory.

So, even if the bootloader has been selected, it will not be added to $(TARGETS) and will not be built.

This patch fixes this issue.

---
package/pkg-generic.mk | 2 ++

1 file changed, 2 insertions(+)
package/pkg-generic.mk +0 -0
index d04fd36..064d736 100644
@@ -616,6 +616,8 @@ ifeq ($(1),linux)
Quoted 5 lines

$(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
else ifneq ($$(filter boot/%,$(pkgdir)),) $(2)_KCONFIG_VAR = BR2_TARGET_$(2)
+else ifneq ($$(filter $(BR2_EXTERNAL)/boot/%,$(pkgdir)),) +$(2)_KCONFIG_VAR = BR2_TARGET_$(2)

filter accepts multiple patterns, so you can edit the existing block.

Also, the same problem would exist for the other
package types in this if-else structure. Granted, it's less likely that a user will add a new kernel type or toolchain type in BR2_EXTERNAL, but isn't it more logical and symmetrical to apply this change for the rest the if-else block too?

Best regards,
Thomas

#2 lore raw

PATCH 1/1 Fix selection of bootloaders from $(BR2_EXTERNAL)

Hi!

Quoted 18 lines · Thomas De Schampheleire

Eric Le Bihan <[email protected]> schreef:

Quoted 17 lines

If a package is based on "generic-package", pkg-generic.mk will compute the name of the Kconfig variable to use for checking if this package has been selected by the user.

Unfortunately, this mechanism does not take into account the case where a bootloader is declared in a $(BR2_EXTERNAL)/boot directory.

So, even if the bootloader has been selected, it will not be added to $(TARGETS) and will not be built.

This patch fixes this issue.

---
package/pkg-generic.mk | 2 ++

1 file changed, 2 insertions(+)
Quoted 12 lines
Quoted 10 lines
package/pkg-generic.mk +0 -0
index d04fd36..064d736 100644
@@ -616,6 +616,8 @@ ifeq ($(1),linux)

$(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
else ifneq ($$(filter boot/%,$(pkgdir)),) $(2)_KCONFIG_VAR = BR2_TARGET_$(2)
+else ifneq ($$(filter $(BR2_EXTERNAL)/boot/%,$(pkgdir)),) +$(2)_KCONFIG_VAR = BR2_TARGET_$(2)

filter accepts multiple patterns, so you can edit the existing block.

Thanks for the tip!

Quoted 6 lines

Also, the same problem would exist for the other
package types in this if-else structure. Granted, it's less likely that a user will add a new kernel type or toolchain type in BR2_EXTERNAL, but isn't it more logical and symmetrical to apply this change for the rest the if-else block too?

For the kernel, the matching is done on the package name ('linux'), not on the location of the Makefile. If Buildroot managed multiple kernels, using a hierarchy such as 'kernel/linux' and 'kernel/minix', then it would be logical to add a match on kernel/% or $(BR2_EXTERNAL)/kernel/%. As this is not the case, I think it would be best to keep it the way it is.

For the toolchain, it is true that a user may add a new type of toolchain building in $(BR2_EXTERNAL)/toolchain (though I can not think of one ATM). So I will update the pattern matching for this case.

I'll send an improved patch.

Best regards,
ELB

#3 lore raw

PATCH 1/1 Fix selection of bootloaders from $(BR2_EXTERNAL)

In reply to Eric Le Bihan

From: Eric Le Bihan <[email protected]>

If a package is based on "generic-package", pkg-generic.mk will compute the name of the Kconfig variable to use for checking if this package has been selected by the user.

Unfortunately, this mechanism does not take into account the case where a bootloader is declared in a $(BR2_EXTERNAL)/boot directory.

So, even if the bootloader has been selected, it will not be added to $(TARGETS) and will not be built.

This patch fixes this issue.

[Arnout: use single filter line, also apply this to toolchain]

---
v2: [Arnout]
- Use a single filter line instead of copying it for BR2_EXTERNAL (Suggested by Thomas DS)
- Add the same feature to toolchain (Suggested by Thomas DS)

---
 package/pkg-generic.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pkg-generic.mk +2 -2
index 7000975..84c76e9 100644
@@ -642,9 +642,9 @@ $$($(2)_TARGET_DIRCLEAN):		PKG=$(2)
 # kernel case, the bootloaders case, and the normal packages case.
 ifeq ($(1),linux)
 $(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
-else ifneq ($$(filter boot/%,$(pkgdir)),)
+else ifneq ($$(filter boot/% $(BR2_EXTERNAL)/boot/%,$(pkgdir)),)
 $(2)_KCONFIG_VAR = BR2_TARGET_$(2)
-else ifneq ($$(filter toolchain/%,$(pkgdir)),)
+else ifneq ($$(filter toolchain/% $(BR2_EXTERNAL)/toolchain/%,$(pkgdir)),)
 $(2)_KCONFIG_VAR = BR2_$(2)
 else
 $(2)_KCONFIG_VAR = BR2_PACKAGE_$(2)
Signature · 1 line
2.1.4
#4 lore raw

PATCH 1/1 Fix selection of bootloaders from $(BR2_EXTERNAL)

Quoted 12 lines · Arnout Vandecappelle (Essensium/Mind)

From: Eric Le Bihan <[email protected]>

If a package is based on "generic-package", pkg-generic.mk will compute the name of the Kconfig variable to use for checking if this package has been selected by the user.

Unfortunately, this mechanism does not take into account the case where a bootloader is declared in a $(BR2_EXTERNAL)/boot directory.

So, even if the bootloader has been selected, it will not be added to $(TARGETS) and will not be built.

Quoted 7 lines

This patch fixes this issue.

[Arnout: use single filter line, also apply this to toolchain]

#5 lore raw

PATCH 1/1 Fix selection of bootloaders from $(BR2_EXTERNAL)

In reply to Arnout Vandecappelle (Essensium/Mind)

Dear Arnout Vandecappelle (Essensium/Mind),

Quoted 19 lines · Arnout Vandecappelle (Essensium/Mind)

From: Eric Le Bihan <[email protected]>

If a package is based on "generic-package", pkg-generic.mk will compute the name of the Kconfig variable to use for checking if this package has been selected by the user.

Unfortunately, this mechanism does not take into account the case where a bootloader is declared in a $(BR2_EXTERNAL)/boot directory.

So, even if the bootloader has been selected, it will not be added to $(TARGETS) and will not be built.

This patch fixes this issue.

[Arnout: use single filter line, also apply this to toolchain]

Quoted 8 lines

---
v2: [Arnout]
- Use a single filter line instead of copying it for BR2_EXTERNAL (Suggested by Thomas DS)
- Add the same feature to toolchain (Suggested by Thomas DS)

---
 package/pkg-generic.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com