Skip to contentSkip to conversation

linux target name might be not equal linux file name

PATCH New Waldemar Brodkorb 3 participants 4 messages Jul 10, 2014 – Jul 11, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 linux target name might be not equal linux file name

For example the upcoming qemu-xtensa patch is using this feature, where the target is called "zImage", but the resulting kernel name is "Image.elf".

---
Changes v2 -> v3:
- no change
Changes v1 -> v2:
- add comment about default value (suggested by Arnout)
- reorder default value for LINUX_TARGET_NAME (suggested by Arnout)

---
 linux/Config.in |    7 +++++++
 linux/linux.mk  |   10 +++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
linux/Config.in +7 -0
index 0a13b13..1c316ae 100644
@@ -244,6 +244,13 @@ config BR2_LINUX_KERNEL_IMAGE_TARGET_NAME
 	  Specify the kernel make target to build the kernel that you
 	  need.
 
+config BR2_LINUX_KERNEL_IMAGE_NAME
+	string "Kernel image name"
+	depends on BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM
+	help
+	  Specify the kernel filename. Defaults to BR2_LINUX_KERNEL_TARGET_NAME
+	  if not set.
+
 config BR2_LINUX_KERNEL_UIMAGE_LOADADDR
 	string "load address (for 3.7+ multi-platform image)"
 	depends on BR2_arm || BR2_armeb
linux/linux.mk +7 -3
index bd3f2ac..1ba3953 100644
@@ -80,7 +80,8 @@ endif
 KERNEL_DTBS = $(addsuffix .dtb,$(KERNEL_DTS_NAME))
 
 ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
-LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
+LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_NAME))
+LINUX_TARGET_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
 else
 ifeq ($(BR2_LINUX_KERNEL_UIMAGE),y)
 LINUX_IMAGE_NAME = uImage
@@ -106,6 +107,9 @@ else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ),y)
 LINUX_IMAGE_NAME = vmlinuz
 endif
 endif
+ifeq ($(LINUX_TARGET_NAME),)
+LINUX_TARGET_NAME = $(LINUX_IMAGE_NAME)
+endif
 
 LINUX_KERNEL_UIMAGE_LOADADDR=$(call qstrip,$(BR2_LINUX_KERNEL_UIMAGE_LOADADDR))
 ifneq ($(LINUX_KERNEL_UIMAGE_LOADADDR),)
@@ -259,7 +263,7 @@ endif
 define LINUX_BUILD_CMDS
 	$(if $(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),
 		cp $(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH) $(KERNEL_ARCH_PATH)/boot/dts/)
-	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME)
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_TARGET_NAME)
 	@if grep -q "CONFIG_MODULES=y" $(@D)/.config; then 	\
 		$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) modules ;	\
 	fi
@@ -332,7 +336,7 @@ endif
 $(LINUX_DIR)/.stamp_initramfs_rebuilt: $(LINUX_DIR)/.stamp_target_installed $(LINUX_DIR)/.stamp_images_installed $(BINARIES_DIR)/rootfs.cpio
 	@$(call MESSAGE,"Rebuilding kernel with initramfs")
 	# Build the kernel.
-	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME)
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_TARGET_NAME)
 	$(LINUX_APPEND_DTB)
 	# Copy the kernel image to its final destination
 	cp $(LINUX_IMAGE_PATH) $(BINARIES_DIR)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v3 1/2 linux target name might be not equal linux file name

Waldemar, All,

On 2014-07-10 22:00 +0200, Waldemar Brodkorb spake thusly:

Quoted 22 lines

For example the upcoming qemu-xtensa patch is using this feature, where the target is called "zImage", but the resulting kernel name is "Image.elf".

---
Changes v2 -> v3:
- no change
Changes v1 -> v2:
- add comment about default value (suggested by Arnout)
- reorder default value for LINUX_TARGET_NAME (suggested by Arnout)

---
 linux/Config.in |    7 +++++++
 linux/linux.mk  |   10 +++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
linux/Config.in +0 -0
index 0a13b13..1c316ae 100644

linux/Config.in config BR2_LINUX_KERNEL_IMAGE_TARGET_NAME · line 252

Quoted 9 lines
linux/Config.in +6 -0
@@ -244,6 +244,13 @@ config BR2_LINUX_KERNEL_IMAGE_TARGET_NAME
 	  Specify the kernel make target to build the kernel that you
 	  need.
 
+config BR2_LINUX_KERNEL_IMAGE_NAME
+	string "Kernel image name"
+	depends on BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM
+	help
+	  Specify the kernel filename. Defaults to BR2_LINUX_KERNEL_TARGET_NAME
+	  if not set.

I would rephrase this to:

The filename of the kernel image, if it is different from the make target (above). Only Xtensa uses a filename different from the make target.

If unsure, leave it empty.

Quoted 18 lines
linux/Config.in +0 -0
 config BR2_LINUX_KERNEL_UIMAGE_LOADADDR
 	string "load address (for 3.7+ multi-platform image)"
 	depends on BR2_arm || BR2_armeb
linux/linux.mk +2 -1
index bd3f2ac..1ba3953 100644
@@ -80,7 +80,8 @@ endif
 KERNEL_DTBS = $(addsuffix .dtb,$(KERNEL_DTS_NAME))
 
 ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
-LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
+LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_NAME))
+LINUX_TARGET_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
 else
 ifeq ($(BR2_LINUX_KERNEL_UIMAGE),y)
 LINUX_IMAGE_NAME = uImage

linux/linux.mk else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ),y) · line 112

Quoted 6 lines
linux/linux.mk +3 -0
@@ -106,6 +107,9 @@ else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ),y)
 LINUX_IMAGE_NAME = vmlinuz
 endif
 endif
+ifeq ($(LINUX_TARGET_NAME),)
+LINUX_TARGET_NAME = $(LINUX_IMAGE_NAME)
+endif

I'm confused. Above, you state that if BR2_LINUX_KERNEL_IMAGE_NAME is empty, it defaults to BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM.

But here, you are doing exactly the opposite, that is set LINUX_TARGET_NAME (derived from BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM) with the value of LINUX_IMAGE_NAME, which is derived from the new option you added above, BR2_LINUX_KERNEL_IMAGE_NAME.

Should that not be:

    ifeq ($(LINUX_IMAGE_NAME),)
    LINUX_IMAGE_NAME = $(LINUX_TARGET_NAME)
    endif

But I may have missed something... ;-)

Regards,
Yann E. MORIN.

Quoted 27 lines
linux/linux.mk +2 -2
 LINUX_KERNEL_UIMAGE_LOADADDR=$(call qstrip,$(BR2_LINUX_KERNEL_UIMAGE_LOADADDR))
 ifneq ($(LINUX_KERNEL_UIMAGE_LOADADDR),)
@@ -259,7 +263,7 @@ endif
 define LINUX_BUILD_CMDS
 	$(if $(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),
 		cp $(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH) $(KERNEL_ARCH_PATH)/boot/dts/)
-	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME)
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_TARGET_NAME)
 	@if grep -q "CONFIG_MODULES=y" $(@D)/.config; then 	\
 		$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) modules ;	\
 	fi
@@ -332,7 +336,7 @@ endif
 $(LINUX_DIR)/.stamp_initramfs_rebuilt: $(LINUX_DIR)/.stamp_target_installed $(LINUX_DIR)/.stamp_images_installed $(BINARIES_DIR)/rootfs.cpio
 	@$(call MESSAGE,"Rebuilding kernel with initramfs")
 	# Build the kernel.
-	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME)
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_TARGET_NAME)
 	$(LINUX_APPEND_DTB)
 	# Copy the kernel image to its final destination
 	cp $(LINUX_IMAGE_PATH) $(BINARIES_DIR)
Signature · 6 lines
1.7.10.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH v3 1/2 linux target name might be not equal linux file name

Hi Yann,
Yann E. MORIN wrote,

Quoted 76 lines

Waldemar, All,

On 2014-07-10 22:00 +0200, Waldemar Brodkorb spake thusly:

Quoted 22 lines

For example the upcoming qemu-xtensa patch is using this feature, where the target is called "zImage", but the resulting kernel name is "Image.elf".

---
Changes v2 -> v3:
- no change
Changes v1 -> v2:
- add comment about default value (suggested by Arnout)
- reorder default value for LINUX_TARGET_NAME (suggested by Arnout)

---
 linux/Config.in |    7 +++++++
 linux/linux.mk  |   10 +++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
linux/Config.in +0 -0
index 0a13b13..1c316ae 100644

linux/Config.in config BR2_LINUX_KERNEL_IMAGE_TARGET_NAME · line 252

Quoted 9 lines
linux/Config.in +6 -0
@@ -244,6 +244,13 @@ config BR2_LINUX_KERNEL_IMAGE_TARGET_NAME
 	  Specify the kernel make target to build the kernel that you
 	  need.
 
+config BR2_LINUX_KERNEL_IMAGE_NAME
+	string "Kernel image name"
+	depends on BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM
+	help
+	  Specify the kernel filename. Defaults to BR2_LINUX_KERNEL_TARGET_NAME
+	  if not set.

I would rephrase this to:

The filename of the kernel image, if it is different from the make target (above). Only Xtensa uses a filename different from the make target.

If unsure, leave it empty.

Quoted 18 lines
linux/Config.in +0 -0
 config BR2_LINUX_KERNEL_UIMAGE_LOADADDR
 	string "load address (for 3.7+ multi-platform image)"
 	depends on BR2_arm || BR2_armeb
linux/linux.mk +2 -1
index bd3f2ac..1ba3953 100644
@@ -80,7 +80,8 @@ endif
 KERNEL_DTBS = $(addsuffix .dtb,$(KERNEL_DTS_NAME))
 
 ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
-LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
+LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_NAME))
+LINUX_TARGET_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
 else
 ifeq ($(BR2_LINUX_KERNEL_UIMAGE),y)
 LINUX_IMAGE_NAME = uImage

linux/linux.mk else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ),y) · line 112

Quoted 6 lines
linux/linux.mk +3 -0
@@ -106,6 +107,9 @@ else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ),y)
 LINUX_IMAGE_NAME = vmlinuz
 endif
 endif
+ifeq ($(LINUX_TARGET_NAME),)
+LINUX_TARGET_NAME = $(LINUX_IMAGE_NAME)
+endif

I'm confused. Above, you state that if BR2_LINUX_KERNEL_IMAGE_NAME is empty, it defaults to BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM.

But here, you are doing exactly the opposite, that is set LINUX_TARGET_NAME (derived from BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM) with the value of LINUX_IMAGE_NAME, which is derived from the new option you added above, BR2_LINUX_KERNEL_IMAGE_NAME.

Quoted 7 lines

Should that not be:

    ifeq ($(LINUX_IMAGE_NAME),)
    LINUX_IMAGE_NAME = $(LINUX_TARGET_NAME)
    endif

But I may have missed something... ;-)

I'm confused too now ;)
Indeed I have put in Arnout suggestion for my first patch version without modifying the help text and only done runtime testing without actually thinking if this is the correct thing.

So the new variable BR2_LINUX_KERNEL_IMAGE_NAME should be default LINUX_TARGET_NAME, if not set.

best regards
Waldemar

#3 lore raw

PATCH v3 1/2 linux target name might be not equal linux file name

In reply to Waldemar Brodkorb

Dear Waldemar Brodkorb,

Quoted 3 lines · Waldemar Brodkorb

For example the upcoming qemu-xtensa patch is using this feature, where the target is called "zImage", but the resulting kernel name is "Image.elf".

Could you improve a bit the title of your commits? The title should always be:

<area>: <short description>

Where <area> is generally the name of the package being affected. In this case, it should be:

linux: add option to explicitly specify the kernel image name

For your qemu-system-xtensa defconfig, it should be something like:

configs: add new configuration for qemu-system-xtensa

Thanks,

Thomas

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