From 8e196a62998b3167c279cdd5f21f40d4b612078b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Fri, 7 May 2021 17:58:11 +0200 Subject: [PATCH] build: kernel2minor: work around path length limit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- include/image-commands.mk | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index b394a8153e..fe0d10536b 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -204,6 +204,14 @@ define Build/jffs2 @mv $@.new $@ endef +define Build/kernel2minor + $(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 rm -f $@ cp $< $@ @@ -412,8 +420,3 @@ define Build/append-metadata fwtool -S "$@.ucert" "$@" ;\ } endef - -define Build/kernel2minor - kernel2minor -k $@ -r $@.new $(1) - mv $@.new $@ -endef