kernel: bump 5.4 to 5.4.136
[openwrt/openwrt.git] / include / image-commands.mk
index ec4f9624f54c99adfcf064d0ffc3adf57ae07bf5..fa368850388d095131245c796c0f644fa5d2eda6 100644 (file)
@@ -28,9 +28,21 @@ define Build/append-kernel
 endef
 
 define Build/append-image
-       dd if=$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))-$(1) >> $@
+       dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) >> $@
 endef
 
+ifdef IB
+define Build/append-image-stage
+       dd if=$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1) >> $@
+endef
+else
+define Build/append-image-stage
+       dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) of=$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)
+       dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) >> $@
+endef
+endif
+
+
 compat_version=$(if $(DEVICE_COMPAT_VERSION),$(DEVICE_COMPAT_VERSION),1.0)
 json_quote=$(subst ','\'',$(subst ",\",$(1)))
 #")')
@@ -186,7 +198,7 @@ define Build/elx-header
                        dd bs=20 count=1 conv=sync; \
                echo -ne "$$(printf '%08x' $$(stat -c%s $@) | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
                        dd bs=8 count=1 conv=sync; \
-               echo -ne "$$($(STAGING_DIR_HOST)/bin/mkhash md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
+               echo -ne "$$($(MKHASH) md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
                        dd bs=58 count=1 conv=sync; \
        ) > $(KDIR)/tmp/$(DEVICE_NAME).header
        $(call Build/xor-image,-p $(xor_pattern) -x)
@@ -260,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