Skip to contentSkip to conversation

linux: do not install images in subdirectories

PATCH New Thomas Petazzoni 2 participants 7 messages Apr 2, 2020 – Apr 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 linux: do not install images in subdirectories

The Linux kernel image is typically found in arch/ARCH/boot/, which is why LINUX_IMAGE_PATH is defined as:

LINUX_IMAGE_PATH = $(LINUX_ARCH_PATH)/boot/$(LINUX_IMAGE_NAME)

However, on MIPS, some kernel image types are available from arch/mips/boot/compressed, or even at the top-level directory. For such cases, LINUX_IMAGE_NAME might be set (using BR2_LINUX_KERNEL_IMAGE_NAME) to values such as:

compressed/vmlinux.bin.z

or

../../../uzImage.bin

Except that the line:

  $(INSTALL) -m 0644 -D $(LINUX_IMAGE_PATH) $(1)/$(notdir $(LINUX_IMAGE_NAME))

will lead to such images be installed in:

  $(TARGET_DIR)/boot/compressed/vmlinux.bin.z
  $(BINARIES_DIR)/compressed/vmlinux.bin.z

and:

  $(TARGET_DIR)/boot/../../../uzImage.bin
  $(BINARIES_DIR)/../../../uzImage.bin

which of course is completely bogus.

So let's install them under their name, not their full relative path to arch/ARCH/boot/.

---
 linux/linux.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux/linux.mk +1 -1
index b2ceeecafb..3d9052a337 100644
@@ -496,7 +496,7 @@ else
 # Otherwise, just install the unique image generated by the kernel
 # build process.
 define LINUX_INSTALL_IMAGE
-	$(INSTALL) -m 0644 -D $(LINUX_IMAGE_PATH) $(1)/$(LINUX_IMAGE_NAME)
+	$(INSTALL) -m 0644 -D $(LINUX_IMAGE_PATH) $(1)/$(notdir $(LINUX_IMAGE_NAME))
 endef
 endif
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 linux: adjust BR2_LINUX_KERNEL_IMAGE_NAME help text

The help text of BR2_LINUX_KERNEL_IMAGE_NAME is somewhat incomplete, in the sense that it assumes just a filename can be passed, while it can be a relative path, such as 'compressed/vmlinux.bin.z'. So make it clear that such paths are relative to arch/ARCH/boot/.

Also, drop the part about this being only useful for Xtensa as this is not true: on MIPS it might be needed as well for some specific image types.

---
 linux/Config.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
linux/Config.in +4 -4
index 86b5092b8a..ddf0264d33 100644
@@ -338,10 +338,10 @@ config BR2_LINUX_KERNEL_IMAGE_NAME
 	string "Kernel image name"
 	depends on BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM
 	help
-	  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. Defaults to
-	  BR2_LINUX_KERNEL_IMAGE_TARGET_NAME.
+	  The filename of the kernel image, if it is different from
+	  the make target (above). Defaults to
+	  BR2_LINUX_KERNEL_IMAGE_TARGET_NAME. If specified, the
+	  filename is relative to arch/ARCH/boot/.
 
 	  If unsure, leave it empty.
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 linux: adjust BR2_LINUX_KERNEL_IMAGE_NAME help text

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

The help text of BR2_LINUX_KERNEL_IMAGE_NAME is somewhat incomplete, in the sense that it assumes just a filename can be passed, while it can be a relative path, such as 'compressed/vmlinux.bin.z'. So make it clear that such paths are relative to arch/ARCH/boot/.

Quoted 7 lines

Also, drop the part about this being only useful for Xtensa as this is not true: on MIPS it might be needed as well for some specific image types.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 2/2 linux: adjust BR2_LINUX_KERNEL_IMAGE_NAME help text

In reply to Thomas Petazzoni
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

The help text of BR2_LINUX_KERNEL_IMAGE_NAME is somewhat incomplete, in the sense that it assumes just a filename can be passed, while it can be a relative path, such as 'compressed/vmlinux.bin.z'. So make it clear that such paths are relative to arch/ARCH/boot/.

Quoted 7 lines

Also, drop the part about this being only useful for Xtensa as this is not true: on MIPS it might be needed as well for some specific image types.

Committed to 2020.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/2 linux: do not install images in subdirectories

In reply to Thomas Petazzoni
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

The Linux kernel image is typically found in arch/ARCH/boot/, which is why LINUX_IMAGE_PATH is defined as:

LINUX_IMAGE_PATH = $(LINUX_ARCH_PATH)/boot/$(LINUX_IMAGE_NAME)

However, on MIPS, some kernel image types are available from arch/mips/boot/compressed, or even at the top-level directory. For such cases, LINUX_IMAGE_NAME might be set (using BR2_LINUX_KERNEL_IMAGE_NAME) to values such as:

compressed/vmlinux.bin.z

Quoted 7 lines

or

../../../uzImage.bin

Except that the line:

  $(INSTALL) -m 0644 -D $(LINUX_IMAGE_PATH) $(1)/$(notdir $(LINUX_IMAGE_NAME))

This is a bit confusing, as it is because notdir was NOT used that it didn't work, so I've dropped that from the commit message and committed, thanks.

Quoted 42 lines

will lead to such images be installed in:

  $(TARGET_DIR)/boot/compressed/vmlinux.bin.z
  $(BINARIES_DIR)/compressed/vmlinux.bin.z

and:

  $(TARGET_DIR)/boot/../../../uzImage.bin
  $(BINARIES_DIR)/../../../uzImage.bin

which of course is completely bogus.

So let's install them under their name, not their full relative path to arch/ARCH/boot/.

---
 linux/linux.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux/linux.mk +1 -1
index b2ceeecafb..3d9052a337 100644
@@ -496,7 +496,7 @@ else
 # Otherwise, just install the unique image generated by the kernel
 # build process.
 define LINUX_INSTALL_IMAGE
-	$(INSTALL) -m 0644 -D $(LINUX_IMAGE_PATH) $(1)/$(LINUX_IMAGE_NAME)
+	$(INSTALL) -m 0644 -D $(LINUX_IMAGE_PATH) $(1)/$(notdir $(LINUX_IMAGE_NAME))
 endef
 endif
 
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/2 linux: do not install images in subdirectories

Quoted 7 lines · On Fri, 03 Apr 2020 00:25:05 +0200 Peter Korsgaard <[email protected]> wrote:
Quoted 3 lines

Except that the line:

  $(INSTALL) -m 0644 -D $(LINUX_IMAGE_PATH) $(1)/$(notdir $(LINUX_IMAGE_NAME))  

This is a bit confusing, as it is because notdir was NOT used that it didn't work, so I've dropped that from the commit message and committed, thanks.

Gah, indeed, I copy/pasted the line after having done my change. Stupid me. Thanks for noticing and fixing this!

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

PATCH 1/2 linux: do not install images in subdirectories

In reply to Thomas Petazzoni
Quoted 32 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

The Linux kernel image is typically found in arch/ARCH/boot/, which is why LINUX_IMAGE_PATH is defined as:

LINUX_IMAGE_PATH = $(LINUX_ARCH_PATH)/boot/$(LINUX_IMAGE_NAME)

However, on MIPS, some kernel image types are available from arch/mips/boot/compressed, or even at the top-level directory. For such cases, LINUX_IMAGE_NAME might be set (using BR2_LINUX_KERNEL_IMAGE_NAME) to values such as:

compressed/vmlinux.bin.z

or

../../../uzImage.bin

Except that the line:

  $(INSTALL) -m 0644 -D $(LINUX_IMAGE_PATH) $(1)/$(notdir $(LINUX_IMAGE_NAME))

will lead to such images be installed in:

  $(TARGET_DIR)/boot/compressed/vmlinux.bin.z
  $(BINARIES_DIR)/compressed/vmlinux.bin.z

and:

  $(TARGET_DIR)/boot/../../../uzImage.bin
  $(BINARIES_DIR)/../../../uzImage.bin
Quoted 8 lines

which of course is completely bogus.

So let's install them under their name, not their full relative path to arch/ARCH/boot/.

Committed to 2020.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard