Skip to contentSkip to conversation

linux: fix recursively defined variable

RFC PATCH New Yann E. MORIN 2 participants 2 messages Dec 15, 2014

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 linux: fix recursively defined variable

When running 'make printvars', the output stops at the time we dump the Linux related variables, with:

linux/linux.mk:109: *** Recursive variable `LINUX_TARGET_NAME' references itself (eventually). Stop.

And that's expected, since we have:

    109 LINUX_TARGET_NAME = $(LINUX_IMAGE_NAME)
    [...]
    112 ifeq ($(LINUX_IMAGE_NAME),)
    113 LINUX_IMAGE_NAME = $(LINUX_TARGET_NAME)
    114 endif

Even though they are defined in a way that ensures they are in fact not recursively defined (the if-block ensures that), 'printvars' does dump all our variables by evaluating all of them, which in that specific case implies they are recursively defined.

Fix that by explicitly setting LINUX_IMAGE_NAME in each if-block.

Cc Peter Korsgaard <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 linux/linux.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
linux/linux.mk +4 -4
index 6740d01..36f0230 100644
@@ -82,6 +82,7 @@ KERNEL_DTBS = $(addsuffix .dtb,$(KERNEL_DTS_NAME))
 ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
 LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_NAME))
 LINUX_TARGET_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
+LINUX_IMAGE_NAME = $(LINUX_TARGET_NAME)
 else
 ifeq ($(BR2_LINUX_KERNEL_UIMAGE),y)
 LINUX_IMAGE_NAME = uImage
@@ -106,13 +107,12 @@ LINUX_IMAGE_NAME = vmlinux
 else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ),y)
 LINUX_IMAGE_NAME = vmlinuz
 endif
+# The if-else blocks above are all the image types we know of, and all
+# come from a Kconfig choice, so we know we have LINUX_IMAGE_NAME set
+# to something
 LINUX_TARGET_NAME = $(LINUX_IMAGE_NAME)
 endif
 
-ifeq ($(LINUX_IMAGE_NAME),)
-LINUX_IMAGE_NAME = $(LINUX_TARGET_NAME)
-endif
-
 LINUX_KERNEL_UIMAGE_LOADADDR = $(call qstrip,$(BR2_LINUX_KERNEL_UIMAGE_LOADADDR))
 ifneq ($(LINUX_KERNEL_UIMAGE_LOADADDR),)
 LINUX_MAKE_FLAGS += LOADADDR="$(LINUX_KERNEL_UIMAGE_LOADADDR)"
Signature · 1 line
1.9.1
#1 lore raw

RFC PATCH 1/1 linux: fix recursively defined variable

Quoted 21 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

When running 'make printvars', the output stops at the time we dump the Linux related variables, with:

linux/linux.mk:109: *** Recursive variable `LINUX_TARGET_NAME' references itself (eventually). Stop.

And that's expected, since we have:

    109 LINUX_TARGET_NAME = $(LINUX_IMAGE_NAME)
    [...]
    112 ifeq ($(LINUX_IMAGE_NAME),)
    113 LINUX_IMAGE_NAME = $(LINUX_TARGET_NAME)
    114 endif

Even though they are defined in a way that ensures they are in fact not recursively defined (the if-block ensures that), 'printvars' does dump all our variables by evaluating all of them, which in that specific case implies they are recursively defined.

Quoted 5 lines

Fix that by explicitly setting LINUX_IMAGE_NAME in each if-block.

Cc Peter Korsgaard <[email protected]>
Cc Thomas Petazzoni <[email protected]>

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard