[openwrt/openwrt] build: kernel2minor: work around path length limit

LEDE Commits lede-commits at lists.infradead.org
Sun May 30 13:53:51 PDT 2021


zorun pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/1a41b88803366fdd8eaf773c4a10e41a0e8947db

commit 1a41b88803366fdd8eaf773c4a10e41a0e8947db
Author: François Chavant <francois at chavant.info>
AuthorDate: Fri May 7 17:58:11 2021 +0200

    build: kernel2minor: work around path length limit
    
    When building for MikroTik devices the kernel2minor tool will sometimes
    fail with:
    
      Can't get lstat from kernel file!: No such file or directory.
    
    This is because kernel2minor expects paths no longer than 250 chars.
    To work around this the include/image-commands.mk has been modified
    to copy the kernel to a temporary file (/tmp/tmp.XXXXXXXXXX) before
    calling kernel2minor.
    
    Signed-off-by: François Chavant <francois at chavant.info>
    (cherry picked from commit 5a9608102b3c444d0c963255f9d016a1d5469d5d)
---
 include/image-commands.mk | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/image-commands.mk b/include/image-commands.mk
index 51e745958e..4d54a14ba4 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -240,8 +240,11 @@ define Build/jffs2
 endef
 
 define Build/kernel2minor
-	kernel2minor -k $@ -r $@.new $(1)
-	mv $@.new $@
+	$(eval temp_file := $(shell mktemp))
+	cp $@ $(temp_file)
+	kernel2minor -k $(temp_file) -r $(temp_file).new $(1)
+	mv $(temp_file).new $@
+	rm -f $(temp_file)
 endef
 
 define Build/kernel-bin



More information about the lede-commits mailing list