X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Fimage-commands.mk;h=49e438954a804f487652603d7e6682716b533c2b;hb=d826af2cbbc7ff9781d6b9fdde5866f6e6367ec6;hp=7ff4c217a345e10a2a399e56fa45bc4ff3644209;hpb=d2a7df0792020c430477abed244f5b76bb990b7f;p=librecmc%2Flibrecmc.git diff --git a/include/image-commands.mk b/include/image-commands.mk index 7ff4c217a3..49e438954a 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -11,6 +11,39 @@ define Build/uImage @mv $@.new $@ endef +define Build/buffalo-enc + $(eval product=$(word 1,$(1))) + $(eval version=$(word 2,$(1))) + $(eval args=$(wordlist 3,$(words $(1)),$(1))) + $(STAGING_DIR_HOST)/bin/buffalo-enc \ + -p $(product) -v $(version) $(args) \ + -i $@ -o $@.new + mv $@.new $@ +endef + +define Build/buffalo-enc-tag + $(call Build/buffalo-enc,'' '' -S 152 $(1)) +endef + +define Build/buffalo-tag-dhp + $(eval product=$(word 1,$(1))) + $(eval region=$(word 2,$(1))) + $(eval language=$(word 3,$(1))) + $(STAGING_DIR_HOST)/bin/buffalo-tag \ + -d 0x01000000 -w 1 \ + -a $(BUFFALO_TAG_PLATFORM) \ + -v $(BUFFALO_TAG_VERSION) -m $(BUFFALO_TAG_MINOR) \ + -b $(product) -p $(product) \ + -r $(region) -r $(region) -l $(language) \ + -I $@ -o $@.new + mv $@.new $@ +endef + +define Build/buffalo-dhp-image + $(STAGING_DIR_HOST)/bin/mkdhpimg $@ $@.new + mv $@.new $@ +endef + define Build/netgear-chk $(STAGING_DIR_HOST)/bin/mkchkimg \ -o $@.new \ @@ -29,6 +62,18 @@ define Build/netgear-dni mv $@.new $@ endef +# append a fake/empty rootfs uImage header, to fool the bootloaders +# rootfs integrity check +define Build/append-uImage-fakeroot-hdr + rm -f $@.fakeroot + $(STAGING_DIR_HOST)/bin/mkimage \ + -A $(LINUX_KARCH) -O linux -T filesystem -C none \ + -n '$(call toupper,$(LINUX_KARCH)) LEDE fakeroot' \ + -s \ + $@.fakeroot + cat $@.fakeroot >> $@ +endef + define Build/tplink-safeloader -$(STAGING_DIR_HOST)/bin/tplink-safeloader \ -B $(TPLINK_BOARD_NAME) \ @@ -59,7 +104,7 @@ define Build/fit -D $(DEVICE_NAME) -o $@.its -k $@ \ $(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \ -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ - -A $(ARCH) -v $(LINUX_VERSION) + -A $(LINUX_KARCH) -v $(LINUX_VERSION) PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new @mv $@.new $@ endef @@ -103,11 +148,11 @@ define Build/patch-cmdline endef define Build/append-kernel - dd if=$(IMAGE_KERNEL) $(if $(1),bs=$(1) conv=sync) >> $@ + dd if=$(IMAGE_KERNEL) >> $@ endef define Build/append-rootfs - dd if=$(IMAGE_ROOTFS) $(if $(1),bs=$(1) conv=sync) >> $@ + dd if=$(IMAGE_ROOTFS) >> $@ endef define Build/append-ubi @@ -172,3 +217,26 @@ define Build/sysupgrade-tar --rootfs $(call param_get_default,rootfs,$(1),$(IMAGE_ROOTFS)) \ $@ endef + +json_quote=$(subst ','\'',$(subst ",\",$(1))) +#")') +metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))")))) +metadata_json = \ + '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \ + "supported_devices":[$(call metadata_devices,$(1))], \ + "version": { \ + "dist": "$(call json_quote,$(VERSION_DIST))", \ + "version": "$(call json_quote,$(VERSION_NUMBER))", \ + "revision": "$(call json_quote,$(REVISION))", \ + "board": "$(call json_quote,$(BOARD))" \ + } \ + }' + +define Build/append-metadata + $(if $(SUPPORTED_DEVICES),echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@) +endef + +define Build/kernel2minor + kernel2minor -k $@ -r $@.new $(1) + mv $@.new $@ +endef