X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=include%2Fimage-commands.mk;h=41a5e1198a95a098aef1ff6931f37ee917d721dc;hb=fc16df9fdd596d1a3f5c3be897dc0cf69c84c469;hp=0c13f30fef6c9587723b936016d7be929cbc2e63;hpb=43417aef846c76f30183c436055afc7d10b8b690;p=openwrt%2Fstaging%2Fhauke.git diff --git a/include/image-commands.mk b/include/image-commands.mk index 0c13f30fef..41a5e1198a 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -133,6 +133,8 @@ define Build/append-md5sum-ascii-salted rm $@.salted endef +UBI_NAND_SIZE_LIMIT = $(IMAGE_SIZE) - ($(NAND_SIZE)*20/1024 + 4*$(BLOCKSIZE)) + define Build/append-ubi sh $(TOPDIR)/scripts/ubinize-image.sh \ $(if $(UBOOTENV_IN_UBI),--uboot-env) \ @@ -146,6 +148,8 @@ define Build/append-ubi $(UBINIZE_OPTS) cat $@.tmp >> $@ rm $@.tmp + $(if $(and $(IMAGE_SIZE),$(NAND_SIZE)),\ + $(call Build/check-size,$(UBI_NAND_SIZE_LIMIT))) endef define Build/ubinize-kernel @@ -215,7 +219,7 @@ endef define Build/check-size @imagesize="$$(stat -c%s $@)"; \ - limitsize="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \ + limitsize="$$(($(call exp_units,$(if $(1),$(1),$(IMAGE_SIZE)))))"; \ [ $$limitsize -ge $$imagesize ] || { \ $(call ERROR_MESSAGE, WARNING: Image file $@ is too big: $$imagesize > $$limitsize); \ rm -f $@; \ @@ -226,6 +230,11 @@ define Build/copy-file cat "$(1)" > "$@" endef +define Build/dlink-sge-image + $(STAGING_DIR_HOST)/bin/dlink-sge-image $(1) $@ $@.enc + mv $@.enc $@ +endef + define Build/edimax-header $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1) @mv $@.new $@ @@ -307,7 +316,7 @@ define Build/fit $(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \ $(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \ $(if $(DEVICE_DTS_LOADADDR),-s $(DEVICE_DTS_LOADADDR)) \ - $(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtb)) \ + $(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \ -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \ -A $(LINUX_KARCH) -v $(LINUX_VERSION) PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\ @@ -384,10 +393,17 @@ define Build/kernel-bin endef define Build/linksys-image - $(TOPDIR)/scripts/linksys-image.sh \ + let \ + size="$$(stat -c%s $@)" \ + pad="$(call exp_units,$(PAGESIZE))" \ + offset="256" \ + pad="(pad - ((size + offset) % pad)) % pad"; \ + dd if=/dev/zero bs=$$pad count=1 | tr '\000' '\377' >> $@ + printf ".LINKSYS.01000409%-15s%08X%-8s%-16s" \ "$(call param_get_default,type,$(1),$(DEVICE_NAME))" \ - $@ $@.new - mv $@.new $@ + "$$(cksum $@ | cut -d ' ' -f1)" \ + "0" "K0000000F0246434" >> $@ + dd if=/dev/zero bs=192 count=1 >> $@ endef define Build/lzma @@ -399,6 +415,15 @@ define Build/lzma-no-dict @mv $@.new $@ endef +define Build/moxa-encode-fw + $(TOPDIR)/scripts/moxa-encode-fw.py \ + --input $@ \ + --output $@ \ + --magic $(MOXA_MAGIC) \ + --hwid $(MOXA_HWID) \ + --buildid 00000000 +endef + define Build/netgear-chk $(STAGING_DIR_HOST)/bin/mkchkimg \ -o $@.new \ @@ -410,7 +435,7 @@ endef define Build/netgear-dni $(STAGING_DIR_HOST)/bin/mkdniimg \ - -B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \ + -B $(NETGEAR_BOARD_ID) -v $(shell cat $(VERSION_DIST)| sed -e 's/[[:space:]]/-/g').$(firstword $(subst -, ,$(REVISION))) \ $(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \ -r "$(1)" \ -i $@ -o $@.new @@ -423,7 +448,9 @@ define Build/netgear-encrypted-factory --output-file $@ \ --model $(NETGEAR_ENC_MODEL) \ --region $(NETGEAR_ENC_REGION) \ - --version V1.0.0.0.$(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \ + $(if $(NETGEAR_ENC_HW_ID_LIST),--hw-id-list "$(NETGEAR_ENC_HW_ID_LIST)") \ + $(if $(NETGEAR_ENC_MODEL_LIST),--model-list "$(NETGEAR_ENC_MODEL_LIST)") \ + --version V1.0.0.0.$(shell cat $(VERSION_DIST)| sed -e 's/[[:space:]]/-/g').$(firstword $(subst -, ,$(REVISION))) \ --encryption-block-size 0x20000 \ --openssl-bin "$(STAGING_DIR_HOST)/bin/openssl" \ --key 6865392d342b4d212964363d6d7e7765312c7132613364316e26322a5a5e2538 \ @@ -450,8 +477,8 @@ endef define Build/pad-offset let \ size="$$(stat -c%s $@)" \ - pad="$(subst k,* 1024,$(word 1, $(1)))" \ - offset="$(subst k,* 1024,$(word 2, $(1)))" \ + pad="$(call exp_units,$(word 1, $(1)))" \ + offset="$(call exp_units,$(word 2, $(1)))" \ pad="(pad - ((size + offset) % pad)) % pad" \ newsize='size + pad'; \ dd if=$@ of=$@.new bs=$$newsize count=1 conv=sync @@ -581,6 +608,7 @@ define Build/tplink-v2-image endef define Build/uImage + $(if $(UIMAGE_TIME),SOURCE_DATE_EPOCH="$(UIMAGE_TIME)") \ mkimage \ -A $(LINUX_KARCH) \ -O linux \ @@ -612,7 +640,7 @@ endef define Build/zyxel-ras-image let \ - newsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \ + newsize="$(call exp_units,$(RAS_ROOTFS_SIZE))"; \ $(STAGING_DIR_HOST)/bin/mkrasimage \ -b $(RAS_BOARD) \ -v $(RAS_VERSION) \