ath79: Add support for OpenMesh MR1750 v2
[openwrt/openwrt.git] / include / image-commands.mk
index 438f1e87e4d267276c2d0c23fdf5711b7dbd0ff1..3beec80c8b3f7bb7c45cc9610bce25cab2914154 100644 (file)
@@ -291,8 +291,12 @@ endef
 # Convert a raw image into a $1 type image.
 # E.g. | qemu-image vdi
 define Build/qemu-image
-       qemu-img convert -f raw -O $1 $@ $@.new
-       @mv $@.new $@
+       if command -v qemu-img; then \
+               qemu-img convert -f raw -O $1 $@ $@.new; \
+               mv $@.new $@; \
+       else \
+               echo "WARNING: Install qemu-img to create VDI/VMDK images" >&2; exit 1; \
+       fi
 endef
 
 define Build/qsdk-ipq-factory-nand
@@ -394,10 +398,17 @@ define Build/tplink-v2-image
 endef
 
 define Build/uImage
-       mkimage -A $(LINUX_KARCH) \
-               -O linux -T kernel \
-               -C $(1) -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
-               -n '$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION))' -d $@ $@.new
+       mkimage \
+               -A $(LINUX_KARCH) \
+               -O linux \
+               -T kernel \
+               -C $(word 1,$(1)) \
+               -a $(KERNEL_LOADADDR) \
+               -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
+               -n '$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION))' \
+               $(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC)) \
+               $(wordlist 2,$(words $(1)),$(1)) \
+               -d $@ $@.new
        mv $@.new $@
 endef