diff --git a/include/image-commands.mk b/include/image-commands.mk index 9702d029d75..afb2dde5ba3 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -272,8 +272,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