$(if $(UBOOTENV_IN_UBI),--uboot-env) \
$(if $(KERNEL_IN_UBI),--kernel $(IMAGE_KERNEL)) \
$(foreach part,$(UBINIZE_PARTS),--part $(part)) \
- $(IMAGE_ROOTFS) \
+ --rootfs $(IMAGE_ROOTFS) \
$@.tmp \
-p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
$(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
rm $@.tmp
endef
+define Build/ubinize-kernel
+ cp $@ $@.tmp
+ sh $(TOPDIR)/scripts/ubinize-image.sh \
+ --kernel $@.tmp \
+ $@ \
+ -p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
+ $(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
+ $(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \
+ $(UBINIZE_OPTS)
+ rm $@.tmp
+endef
+
define Build/append-uboot
dd if=$(UBOOT_PATH) >> $@
endef
}
endef
+define Build/copy-file
+ cat "$(1)" > "$@"
+endef
+
define Build/elecom-product-header
$(eval product=$(word 1,$(1)))
$(eval fw=$(if $(word 2,$(1)),$(word 2,$(1)),$@))
)
endef
+define Build/iptime-crc32
+ $(STAGING_DIR_HOST)/bin/iptime-crc32 $(1) $@ $@.new
+ mv $@.new $@
+endef
+
+define Build/iptime-naspkg
+ $(STAGING_DIR_HOST)/bin/iptime-naspkg $(1) $@ $@.new
+ mv $@.new $@
+endef
+
define Build/jffs2
rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \
mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \
endef
# Convert a raw image into a $1 type image.
-# E.g. | qemu-image vdi
+# E.g. | qemu-image vdi <optional extra arguments to qemu-img binary>
define Build/qemu-image
if command -v qemu-img; then \
qemu-img convert -f raw -O $1 $@ $@.new; \
endef
define Build/zip
+ rm -rf $@.tmp
mkdir $@.tmp
- mv $@ $@.tmp/$(1)
+ mv $@ $@.tmp/$(word 1,$(1))
- zip -j -X \
+ $(STAGING_DIR_HOST)/bin/zip -j -X \
$(if $(SOURCE_DATE_EPOCH),--mtime="$(SOURCE_DATE_EPOCH)") \
- $@ $@.tmp/$(if $(1),$(1),$@)
+ $(wordlist 2,$(words $(1)),$(1)) \
+ $@ $@.tmp/$(if $(word 1,$(1)),$(word 1,$(1)),$$(basename $@))
rm -rf $@.tmp
endef