ath79: add and enforce image metadata

Add metadata to images and make the metdata mandatory.

Signed-off-by: Mathias Kresin <dev@kresin.me>
This commit is contained in:
Mathias Kresin 2018-05-07 22:41:04 +02:00
parent f77db1a590
commit f7ec385c13
5 changed files with 20 additions and 25 deletions

View File

@ -3,27 +3,10 @@
#
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
platform_check_image() {
local board=$(board_name)
local magic="$(get_magic_word "$1")"
local magic_long="$(get_magic_long "$1")"
[ "$#" -gt 1 ] && return 1
case "$board" in
"ubnt,unifi")
[ "$magic" != "2705" ] && {
echo "Invalid image type."
return 1
}
return 0
;;
esac
echo "Sysupgrade is not yet supported on $board."
return 1
return 0
}
platform_do_upgrade() {

View File

@ -62,8 +62,10 @@ define Device/Default
KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
COMPILE :=
SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs
IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \
append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
endef
ifeq ($(SUBTARGET),generic)

View File

@ -41,7 +41,7 @@ define Device/tplink
TPLINK_HEADER_VERSION := 1
LOADER_TYPE := gz
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade
IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade | append-metadata
endef
define Device/tplink-nolzma
@ -71,5 +71,6 @@ define Device/tl_wr1043nd_v1
DEVICE_TITLE := TP-LINK TL-WR1043N/ND v1
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
TPLINK_HWID := 0x10430001
SUPPORTED_DEVICES := tplink,tl-wr1043nd-v1 tl-wr1043nd
endef
#TARGET_DEVICES += tl_wr1043nd_v1

View File

@ -31,9 +31,9 @@ define Device/ubnt
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
IMAGE_SIZE := 7552k
UBNT_BOARD := XM
IMAGES := sysupgrade.bin factory.bin
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
IMAGES += factory.bin
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | mkubntimage-split
endef
define Device/ubnt-xm
@ -55,23 +55,27 @@ endef
define Device/ubnt_bullet-m
$(Device/ubnt-xm)
DEVICE_TITLE := Ubiquiti Bullet-M
SUPPORTED_DEVICES += bullet-m
endef
TARGET_DEVICES += ubnt_bullet-m
define Device/ubnt_rocket-m
$(Device/ubnt-xm)
DEVICE_TITLE := Ubiquiti Rocket-M
SUPPORTED_DEVICES += rocket-m
endef
TARGET_DEVICES += ubnt_rocket-m
define Device/ubnt_nano-m
$(Device/ubnt-xm)
DEVICE_TITLE := Ubiquiti Nano-M
SUPPORTED_DEVICES += nano-m
endef
TARGET_DEVICES += ubnt_nano-m
define Device/ubnt_unifi
$(Device/ubnt-bz)
DEVICE_TITLE := Ubiquiti UniFi
SUPPORTED_DEVICES += unifi
endef
TARGET_DEVICES += ubnt_unifi

View File

@ -26,6 +26,7 @@ define Device/embeddedwireless_dorin
DEVICE_TITLE := Embedded Wireless Dorin
DEVICE_PACKAGES := kmod-usb-chipidea2
IMAGE_SIZE := 16000k
SUPPORTED_DEVICES += ew-dorin
endef
TARGET_DEVICES += embeddedwireless_dorin
@ -34,6 +35,7 @@ define Device/glinet_ar150
DEVICE_TITLE := GL.iNet GL-AR150
DEVICE_PACKAGES := kmod-usb-chipidea2
IMAGE_SIZE := 16000k
SUPPORTED_DEVICES += gl-ar150
endef
TARGET_DEVICES += glinet_ar150
@ -42,6 +44,7 @@ define Device/openmesh_om5p-ac-v2
DEVICE_TITLE := OpenMesh OM5P-AC v2
DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x om-watchdog
IMAGE_SIZE := 7808k
SUPPORTED_DEVICES += om5p-acv2
endef
TARGET_DEVICES += openmesh_om5p-ac-v2
@ -56,9 +59,10 @@ define Device/netgear_wndr3800
IMAGE_SIZE := 15872k
IMAGES := sysupgrade.bin factory.img
IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs
IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size $$$$(IMAGE_SIZE)
IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size $$$$(IMAGE_SIZE)
DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-leds-reset
SUPPORTED_DEVICES += wndr3800
endef
TARGET_DEVICES += netgear_wndr3800
@ -67,5 +71,6 @@ define Device/buffalo_wzr-hp-g450h
DEVICE_TITLE := Buffalo WZR-HP-G450H
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
IMAGE_SIZE := 32256k
SUPPORTED_DEVICES += wzr-hp-g450h
endef
TARGET_DEVICES += buffalo_wzr-hp-g450h