[openwrt/openwrt] kernel: fix CopyImage function with Per Device Rootfs
LEDE Commits
lede-commits at lists.infradead.org
Sun Jul 7 09:30:25 PDT 2024
ansuel pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/7bffb3f72bbfa06db5c61351f074533ac2d035a4
commit 7bffb3f72bbfa06db5c61351f074533ac2d035a4
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Sun Jul 7 18:24:24 2024 +0200
kernel: fix CopyImage function with Per Device Rootfs
Some target define custom kernel images with KERNEL_INITRAMFS_NAME to
reference .elf variant of vmlinux.
With Per Device Rootfs, the expected format is
image.suffix.extension.ROOTFS_ID, while in CopyImage we are currently
generating images with image.suffix.ROOTFS_ID.extension making some
target failing.
Fix CopyImage function to correctly follow the expected pattern.
Fixes: 97fd059e7e6a ("image: respect TARGET_PER_DEVICE_ROOTFS for initramfs")
Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
include/kernel-defaults.mk | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 84d686cafc..46045b0ed7 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -136,14 +136,16 @@ ifeq ($(LINUX_KARCH),x86_64)
IMAGES_DIR:=../../x86/boot
endif
+# $1: image suffix
+# $2: Per Device Rootfs ID
define Kernel/CopyImage
- cmp -s $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug || { \
- $(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)$(1); \
- $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf; \
- $(CP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug; \
+ cmp -s $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug$(2) || { \
+ $(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)$(1)$(2); \
+ $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf$(2); \
+ $(CP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug$(2); \
$(foreach k, \
$(if $(KERNEL_IMAGES),$(KERNEL_IMAGES),$(filter-out vmlinux dtbs,$(KERNELNAME))), \
- $(CP) $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/$(IMAGES_DIR)/$(k) $(KERNEL_BUILD_DIR)/$(k)$(1); \
+ $(CP) $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/$(IMAGES_DIR)/$(k) $(KERNEL_BUILD_DIR)/$(k)$(1)$(2); \
) \
}
endef
@@ -188,7 +190,7 @@ else
+$(call locked,$(if $(2),$(CP) $(LINUX_DIR)$(2)/.config* $(LINUX_DIR) && touch $(LINUX_DIR)/.config && )\
rm -rf $(LINUX_DIR)/usr/initramfs_data.cpio* $(LINUX_DIR)/.config.prev && \
$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all) && \
- { $(call Kernel/CopyImage,-initramfs$(2)) },gen-initramfs)
+ { $(call Kernel/CopyImage,-initramfs,$(2)) },gen-initramfs)
endif
endef
else
More information about the lede-commits
mailing list