ramips: consolidate seama image build code

Create a common template which has the required image build code
defined. Add some new variables to pass individual parts to the seama
recipes.

Signed-off-by: Mathias Kresin <dev@kresin.me>
This commit is contained in:
Mathias Kresin 2018-12-29 19:25:00 +01:00
parent d3bf5ff9bc
commit 7c1332d95f
5 changed files with 31 additions and 57 deletions

View File

@ -9,6 +9,7 @@ include $(INCLUDE_DIR)/image.mk
DEVICE_VARS += DTS IMAGE_SIZE NETGEAR_BOARD_ID NETGEAR_HW_ID
DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR
DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
loadaddr-y := 0x80000000
loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000
@ -29,6 +30,21 @@ define Device/Default
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
endef
define Device/seama
SEAMA_MTDBLOCK := 2
IMAGES += factory.bin
# 64 bytes offset:
# - 28 bytes seama_header
# - 36 bytes of META data (4-bytes aligned)
IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs
IMAGE/sysupgrade.bin := \
$$(IMAGE/default) | seama | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := \
$$(IMAGE/default) | pad-rootfs -x 64 | seama | seama-seal | check-size $$$$(IMAGE_SIZE)
SEAMA_SIGNATURE :=
endef
define Build/patch-dtb
$(call Image/BuildDTB,../dts/$(DTS).dts,$@.dtb)
$(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
@ -86,12 +102,15 @@ define Build/poray-header
endef
define Build/seama
$(STAGING_DIR_HOST)/bin/seama -i $@ $(1)
$(STAGING_DIR_HOST)/bin/seama -i $@ \
-m "dev=/dev/mtdblock/$(SEAMA_MTDBLOCK)" -m "type=firmware"
mv $@.seama $@
endef
define Build/seama-seal
$(call Build/seama,-s $@.seama $(1))
$(STAGING_DIR_HOST)/bin/seama -i $@ -s $@.seama \
-m "signature=$(SEAMA_SIGNATURE)"
mv $@.seama $@
endef
define Build/wrg-header

View File

@ -135,20 +135,11 @@ endef
TARGET_DEVICES += db-wrt01
define Device/dch-m225
$(Device/seama)
DTS := DCH-M225
BLOCKSIZE := 4k
IMAGES += factory.bin
SEAMA_SIGNATURE := wapn22_dlink.2013gui_dap1320b
IMAGE_SIZE := 6848k
IMAGE/sysupgrade.bin := \
append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs | \
seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := \
append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \
append-rootfs | pad-rootfs -x 64 | \
seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
seama-seal -m "signature=wapn22_dlink.2013gui_dap1320b" | \
check-size $$$$(IMAGE_SIZE)
DEVICE_TITLE := D-Link DCH-M225
DEVICE_PACKAGES := kmod-sound-core kmod-sound-mt7620 kmod-i2c-ralink
endef

View File

@ -93,21 +93,12 @@ endef
TARGET_DEVICES += 11acnas
define Device/dir-860l-b1
$(Device/seama)
DTS := DIR-860L-B1
BLOCKSIZE := 64k
IMAGES += factory.bin
SEAMA_SIGNATURE := wrgac13_dlink.2013gui_dir860lb
KERNEL := kernel-bin | patch-dtb | relocate-kernel | lzma | uImage lzma
IMAGE_SIZE := $(ralink_default_fw_size_16M)
IMAGE/sysupgrade.bin := \
append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs | \
seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := \
append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \
append-rootfs | pad-rootfs -x 64 | \
seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
seama-seal -m "signature=wrgac13_dlink.2013gui_dir860lb" | \
check-size $$$$(IMAGE_SIZE)
DEVICE_TITLE := D-Link DIR-860L B1
DEVICE_PACKAGES := kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-basic
endef

View File

@ -262,21 +262,12 @@ endef
TARGET_DEVICES += dir-600-b1
define Device/dir-610-a1
$(Device/seama)
DTS := DIR-610-A1
BLOCKSIZE := 4k
IMAGES += factory.bin
SEAMA_SIGNATURE := wrgn59_dlob.hans_dir610
KERNEL := $(KERNEL_DTB)
IMAGE_SIZE := $(ralink_default_fw_size_4M)
IMAGE/sysupgrade.bin := \
append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs | \
seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := \
append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \
append-rootfs | pad-rootfs -x 64 | \
seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
seama-seal -m "signature=wrgn59_dlob.hans_dir610" | \
check-size $$$$(IMAGE_SIZE)
DEVICE_TITLE := D-Link DIR-610 A1
DEVICE_PACKAGES := kmod-ledtrig-netdev kmod-ledtrig-timer
endef

View File

@ -18,20 +18,11 @@ endef
TARGET_DEVICES += br-6475nd
define Device/cy-swr1100
$(Device/seama)
DTS := CY-SWR1100
BLOCKSIZE := 64k
KERNEL := $(KERNEL_DTB)
IMAGES += factory.bin
IMAGE/sysupgrade.bin := \
append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs | \
seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := \
append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \
append-rootfs | pad-rootfs -x 64 | \
seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
seama-seal -m "signature=wrgnd10_samsung_ss815" | \
check-size $$$$(IMAGE_SIZE)
SEAMA_SIGNATURE := wrgnd10_samsung_ss815
DEVICE_TITLE := Samsung CY-SWR1100
DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig
endef
@ -39,20 +30,11 @@ TARGET_DEVICES += cy-swr1100
define Device/dir-645
$(Device/seama)
DTS := DIR-645
BLOCKSIZE := 4k
KERNEL := $(KERNEL_DTB)
IMAGES += factory.bin
IMAGE/sysupgrade.bin := \
append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs | \
seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := \
append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \
append-rootfs | pad-rootfs -x 64 | \
seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
seama-seal -m "signature=wrgn39_dlob.hans_dir645" | \
check-size $$$$(IMAGE_SIZE)
SEAMA_SIGNATURE := wrgn39_dlob.hans_dir645
DEVICE_TITLE := D-Link DIR-645
DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig
endef