# 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
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