firmware-utils: mksercommfw: overhaul image creation

Move the zip compression into a build recipe. Pad the image using the
existing build recipes as well to remove duplicate functionality

Change the code to append header and footer in two steps. Allow to use a
fixed filename as the netgear update image does.

Use a fixed timestamp within the zip archive to make the images
reproducible.

Due to the changes we are now compatible to the gnu89 c standard used by
default on the buildbots and we don't need to force a more recent
standard anymore.

Beside all changes, the footer still looks wrong in compare to the
netgear update image.

Signed-off-by: Mathias Kresin <dev@kresin.me>
This commit is contained in:
Mathias Kresin
2019-01-12 20:18:52 +01:00
parent 18c9faa032
commit 26a016731d
4 changed files with 129 additions and 275 deletions

View File

@@ -2,17 +2,22 @@
# MT76x8 Profiles
#
DEVICE_VARS += SERCOMM_KERNEL_OFFSET SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER
DEVICE_VARS += SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER
define Build/mksercommfw
define Build/sercom-seal
$(STAGING_DIR_HOST)/bin/mksercommfw \
$@ \
$(SERCOMM_KERNEL_OFFSET) \
$(SERCOMM_HWID) \
$(SERCOMM_HWVER) \
$(SERCOMM_SWVER)
-i $@ \
-b $(SERCOMM_HWID) \
-r $(SERCOMM_HWVER) \
-v $(SERCOMM_SWVER) \
$(1)
endef
define Build/sercom-footer
$(call Build/sercom-seal,-f)
endef
define Device/tplink
TPLINK_FLASHLAYOUT :=
TPLINK_HWID :=
@@ -116,14 +121,14 @@ define Device/netgear_r6120
IMAGE_SIZE := $(ralink_default_fw_size_16M)
DEVICE_TITLE := Netgear AC1200 R6120
DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci
SERCOMM_KERNEL_OFFSET := 0x90000
SERCOMM_HWID := CGQ
SERCOMM_HWVER := A001
SERCOMM_SWVER := 0x0040
IMAGES += factory.img
IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE)| append-rootfs | pad-rootfs
IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.img := $$(IMAGE/default) | mksercommfw
IMAGE/factory.img := pad-extra 576k | $$(IMAGE/default) | \
sercom-footer | pad-to 128 | zip R6120.bin | sercom-seal
endef
TARGET_DEVICES += netgear_r6120