-define BuildImage/mkfs
- install: mkfs-$(1)
- .PHONY: mkfs-$(1)
- mkfs-$(1): mkfs_prepare
- $(Image/mkfs/$(1))
- $(call Build/mkfs/default,$(1))
- $(call Build/mkfs/$(1),$(1))
- $(KDIR)/root.$(1): mkfs-$(1)
-
-endef
-
-# Build commands that can be called from Device/* templates
-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 '$(call toupper,$(LINUX_KARCH)) OpenWrt Linux-$(LINUX_VERSION)' -d $@ $@.new
- @mv $@.new $@
-endef
-
-define Build/netgear-chk
- $(STAGING_DIR_HOST)/bin/mkchkimg \
- -o $@.new \
- -k $@ \
- -b $(NETGEAR_BOARD_ID) \
- -r $(NETGEAR_REGION)
- mv $@.new $@
-endef
-
-define Build/lzma
- $(STAGING_DIR_HOST)/bin/lzma e $@ -lc1 -lp2 -pb2 $(1) $@.new
- @mv $@.new $@
-endef
-
-define Build/kernel-bin
- rm -f $@
- cp $^ $@
-endef
-
-define Build/patch-cmdline
- $(STAGING_DIR_HOST)/bin/patch-cmdline $@ '$(CMDLINE)'
-endef
-
-define Build/append-kernel
- dd if=$(word 1,$^) $(if $(1),bs=$(1) conv=sync) >> $@
-endef
-
-define Build/append-rootfs
- dd if=$(word 2,$^) $(if $(1),bs=$(1) conv=sync) >> $@
-endef
-
-define Build/pad-to
- dd if=$@ of=$@.new bs=$(1) conv=sync
- mv $@.new $@
-endef
-
-define Build/pad-rootfs
- $(call prepare_generic_squashfs,$@ $(1))
-endef
-
-define Build/pad-offset
- let \
- size="$$(stat -c%s $@)" \
- pad="$(word 1, $(1))" \
- offset="$(word 2, $(1))" \
- pad="(pad - ((size + offset) % pad)) % pad" \
- newsize='size + pad'; \
- dd if=$@ of=$@.new bs=$$newsize count=1 conv=sync
- mv $@.new $@
-endef
-
-define Build/check-size
- @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -gt "$$(stat -c%s $@)" ] || { \
- echo "WARNING: Image file $@ is too big" >&2; \
- rm -f $@; \
- }
-endef