mirror of
https://github.com/openwrt/openwrt.git
synced 2025-12-21 17:04:28 +04:00
images: move append-teltonika-metadata to image-commands.mk
Move append-teltonika-metadata to image-commands.mk and unify over different targets. This method can be used to create valid "factory" images for most of Teltonika devices. Signed-off-by: Simonas Tamošaitis <simsasss@gmail.com> Link: https://github.com/openwrt/openwrt/pull/19401 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
committed by
Hauke Mehrtens
parent
715f9541e8
commit
53d8303a79
@@ -130,6 +130,33 @@ define Build/append-gl-metadata
|
||||
}
|
||||
endef
|
||||
|
||||
define Build/append-teltonika-metadata
|
||||
echo \
|
||||
'{$(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
|
||||
"metadata_version": "1.1", \
|
||||
"compat_version": "$(call json_quote,$(compat_version))", \
|
||||
"version":"$(call json_quote,$(VERSION_DIST))-$(call json_quote,$(VERSION_NUMBER))-$(call json_quote,$(REVISION))", \
|
||||
"device_code": [".*"], \
|
||||
"hwver": [".*"], \
|
||||
"batch": [".*"], \
|
||||
"serial": [".*"], \
|
||||
$(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
|
||||
$(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
|
||||
[$(call metadata_devices,$(SUPPORTED_TELTONIKA_DEVICES))]$(comma) \
|
||||
"supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
|
||||
$(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_TELTONIKA_DEVICES))]$(comma)) \
|
||||
"version_wrt": { \
|
||||
"dist": "$(call json_quote,$(VERSION_DIST))", \
|
||||
"version": "$(call json_quote,$(VERSION_NUMBER))", \
|
||||
"revision": "$(call json_quote,$(REVISION))", \
|
||||
"target": "$(call json_quote,$(TARGETID))", \
|
||||
"board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
|
||||
}, \
|
||||
"hw_support": {}, \
|
||||
"hw_mods": {$(shell i=1; for mod in $(SUPPORTED_TELTONIKA_HW_MODS); do [ $$i -gt 1 ] && echo -n ,; echo -n "\"mod$$i\": \"$$mod\""; i=$$((i+1)); done)} \
|
||||
}' | fwtool -I - $@
|
||||
endef
|
||||
|
||||
define Build/append-rootfs
|
||||
dd if=$(IMAGE_ROOTFS) >> $@
|
||||
endef
|
||||
|
||||
@@ -13,6 +13,7 @@ DEVICE_VARS += ELECOM_HWID
|
||||
DEVICE_VARS += MOXA_MAGIC MOXA_HWID
|
||||
DEVICE_VARS += OPENMESH_CE_TYPE ZYXEL_MODEL_STRING
|
||||
DEVICE_VARS += SUPPORTED_TELTONIKA_DEVICES
|
||||
DEVICE_VARS += SUPPORTED_TELTONIKA_HW_MODS
|
||||
|
||||
define Build/addpattern
|
||||
-$(STAGING_DIR_HOST)/bin/addpattern -B $(ADDPATTERN_ID) \
|
||||
@@ -153,35 +154,6 @@ define Build/teltonika-v1-header
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
metadata_json_teltonika = \
|
||||
'{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
|
||||
"metadata_version": "1.1", \
|
||||
"compat_version": "$(call json_quote,$(compat_version))", \
|
||||
"version":"$(call json_quote,$(VERSION_DIST))-$(call json_quote,$(VERSION_NUMBER))-$(call json_quote,$(REVISION))", \
|
||||
"device_code": [".*"], \
|
||||
"hwver": [".*"], \
|
||||
"batch": [".*"], \
|
||||
"serial": [".*"], \
|
||||
$(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
|
||||
$(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
|
||||
[$(call metadata_devices,$(SUPPORTED_TELTONIKA_DEVICES))]$(comma) \
|
||||
"supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
|
||||
$(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_TELTONIKA_DEVICES))]$(comma)) \
|
||||
"version_wrt": { \
|
||||
"dist": "$(call json_quote,$(VERSION_DIST))", \
|
||||
"version": "$(call json_quote,$(VERSION_NUMBER))", \
|
||||
"revision": "$(call json_quote,$(REVISION))", \
|
||||
"target": "$(call json_quote,$(TARGETID))", \
|
||||
"board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
|
||||
}, \
|
||||
"hw_support": {}, \
|
||||
"hw_mods": {} \
|
||||
}'
|
||||
|
||||
define Build/append-metadata-teltonika
|
||||
echo $(call metadata_json_teltonika) | fwtool -I - $@
|
||||
endef
|
||||
|
||||
define Build/wrgg-pad-rootfs
|
||||
$(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 64 >>$@
|
||||
endef
|
||||
@@ -3152,7 +3124,7 @@ define Device/teltonika_rut300
|
||||
IMAGE_SIZE := 15552k
|
||||
IMAGES += factory.bin
|
||||
IMAGE/factory.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \
|
||||
append-rootfs | pad-rootfs | append-metadata-teltonika | \
|
||||
append-rootfs | pad-rootfs | append-teltonika-metadata | \
|
||||
check-size $$$$(IMAGE_SIZE)
|
||||
IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \
|
||||
append-rootfs | pad-rootfs | append-metadata | \
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID
|
||||
DEVICE_VARS += RAS_BOARD RAS_ROOTFS_SIZE RAS_VERSION
|
||||
DEVICE_VARS += WRGG_DEVNAME WRGG_SIGNATURE
|
||||
DEVICE_VARS += SUPPORTED_TELTONIKA_DEVICES
|
||||
DEVICE_VARS += SUPPORTED_TELTONIKA_HW_MODS
|
||||
|
||||
define Build/netgear-fit-padding
|
||||
./netgear-fit-padding.py $@ $@.new
|
||||
@@ -52,17 +54,6 @@ define Build/append-rootfshdr
|
||||
dd if=$@.new bs=64 count=1 >> $@.$1
|
||||
endef
|
||||
|
||||
define Build/append-rutx-metadata
|
||||
echo \
|
||||
'{ \
|
||||
"device_code": [".*"], \
|
||||
"hwver": [".*"], \
|
||||
"batch": [".*"], \
|
||||
"serial": [".*"], \
|
||||
"supported_devices":["teltonika,rutx"] \
|
||||
}' | fwtool -I - $@
|
||||
endef
|
||||
|
||||
define Build/copy-file
|
||||
cat "$(1)" > "$@"
|
||||
endef
|
||||
@@ -1122,13 +1113,15 @@ define Device/teltonika_rutx10
|
||||
$(call Device/UbiFit)
|
||||
DEVICE_VENDOR := Teltonika
|
||||
DEVICE_MODEL := RUTX10
|
||||
SUPPORTED_TELTONIKA_DEVICES := teltonika,rutx
|
||||
SUPPORTED_TELTONIKA_HW_MODS := W25N02KV NAND_GD5F2GXX EG060K RUTX_V12
|
||||
SOC := qcom-ipq4018
|
||||
DEVICE_DTS_CONFIG := config@5
|
||||
KERNEL_INSTALL := 1
|
||||
BLOCKSIZE := 128k
|
||||
PAGESIZE := 2048
|
||||
FILESYSTEMS := squashfs
|
||||
IMAGE/factory.ubi := append-ubi | qsdk-ipq-factory-nand | append-rutx-metadata
|
||||
IMAGE/factory.ubi := append-ubi | qsdk-ipq-factory-nand | append-teltonika-metadata
|
||||
DEVICE_PACKAGES := kmod-btusb
|
||||
endef
|
||||
# Missing DSA Setup
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
include ./common-tp-link.mk
|
||||
|
||||
DEFAULT_SOC := mt7628an
|
||||
DEVICE_VARS += SUPPORTED_TELTONIKA_DEVICES
|
||||
DEVICE_VARS += SUPPORTED_TELTONIKA_HW_MODS
|
||||
|
||||
define Build/creality_wb-01-factory
|
||||
mv $@ $(dir $@)factory.bin
|
||||
@@ -42,25 +44,6 @@ define Build/ravpower-wd009-factory
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/append-teltonika-metadata
|
||||
$(eval model_id=$(word 1,$(1)))
|
||||
$(eval hw_mods=$(subst $(space),$(comma),$(wordlist 2,$(words $(1)),$(1))))
|
||||
|
||||
echo \
|
||||
'{ \
|
||||
"metadata_version": "1.1", \
|
||||
"compat_version": "1.0", \
|
||||
"version": "OpenWrt", \
|
||||
"device_code": [".*"], \
|
||||
"hwver": [".*"], \
|
||||
"batch": [".*"], \
|
||||
"serial": [".*"], \
|
||||
"supported_devices":["teltonika,$(model_id)"], \
|
||||
"hw_support": { }, \
|
||||
"hw_mods": { $(hw_mods) } \
|
||||
}' | fwtool -I - $@
|
||||
endef
|
||||
|
||||
define Device/7links_wlr-12xx
|
||||
IMAGE_SIZE := 7872k
|
||||
DEVICE_VENDOR := 7Links
|
||||
@@ -700,6 +683,8 @@ define Device/teltonika_rut9x1
|
||||
DEVICE_MODEL := RUT951
|
||||
DEVICE_ALT0_VENDOR := Teltonika
|
||||
DEVICE_ALT0_MODEL := RUT901
|
||||
SUPPORTED_TELTONIKA_DEVICES := teltonika,rut9m
|
||||
SUPPORTED_TELTONIKA_HW_MODS := 2c7c_6005 TLA2021 CH343 esim ala440
|
||||
IMAGE_SIZE := 15424k
|
||||
BLOCKSIZE := 64k
|
||||
DEVICE_PACKAGES := uqmi kmod-mt76x2 kmod-usb2 kmod-usb-ohci \
|
||||
@@ -707,8 +692,7 @@ define Device/teltonika_rut9x1
|
||||
kmod-i2c-mt7628 kmod-usb-net-cdc-ether
|
||||
IMAGES += factory.bin
|
||||
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
|
||||
append-rootfs | pad-rootfs | check-size | append-teltonika-metadata rut9m \
|
||||
"mod1":"2c7c_6005" "mod2":"TLA2021" "mod3":"CH343" "mod4":"esim" "mod5":"ala440"
|
||||
append-rootfs | pad-rootfs | check-size | append-teltonika-metadata
|
||||
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-metadata
|
||||
endef
|
||||
TARGET_DEVICES += teltonika_rut9x1
|
||||
@@ -718,6 +702,8 @@ define Device/teltonika_rut9x6
|
||||
DEVICE_MODEL := RUT956
|
||||
DEVICE_ALT0_VENDOR := Teltonika
|
||||
DEVICE_ALT0_MODEL := RUT906
|
||||
SUPPORTED_TELTONIKA_DEVICES := teltonika,rut9m
|
||||
SUPPORTED_TELTONIKA_HW_MODS := 2c7c_6005 TLA2021 CH343 esim ala440
|
||||
IMAGE_SIZE := 15424k
|
||||
BLOCKSIZE := 64k
|
||||
DEVICE_PACKAGES := uqmi kmod-mt76x2 kmod-usb2 kmod-usb-ohci \
|
||||
@@ -725,8 +711,7 @@ define Device/teltonika_rut9x6
|
||||
kmod-hwmon-mcp3021 kmod-scsi-core kmod-usb-storage kmod-usb-acm kmod-usb-net-cdc-ether
|
||||
IMAGES += factory.bin
|
||||
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
|
||||
append-rootfs | pad-rootfs | check-size | append-teltonika-metadata rut9m \
|
||||
"mod1":"2c7c_6005" "mod2":"TLA2021" "mod3":"CH343" "mod4":"esim" "mod5":"ala440"
|
||||
append-rootfs | pad-rootfs | check-size | append-teltonika-metadata
|
||||
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-metadata
|
||||
endef
|
||||
TARGET_DEVICES += teltonika_rut9x6
|
||||
@@ -1407,11 +1392,12 @@ define Device/teltonika_rut200
|
||||
DEVICE_VENDOR := Teltonika
|
||||
DEVICE_MODEL := RUT200
|
||||
DEVICE_VARIANT := v1-v4
|
||||
SUPPORTED_TELTONIKA_DEVICES := teltonika,rut2m
|
||||
IMAGE_SIZE := 15424k
|
||||
BLOCKSIZE := 64k
|
||||
DEVICE_PACKAGES +=kmod-mt76x2 kmod-usb2 kmod-usb-ohci kmod-usb-serial-option kmod-usb-net-cdc-ether
|
||||
IMAGES += factory.bin
|
||||
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-teltonika-metadata rut2m
|
||||
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-teltonika-metadata
|
||||
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-metadata
|
||||
endef
|
||||
TARGET_DEVICES += teltonika_rut200
|
||||
@@ -1420,11 +1406,12 @@ define Device/teltonika_rut241
|
||||
DEVICE_VENDOR := Teltonika
|
||||
DEVICE_MODEL := RUT241
|
||||
DEVICE_VARIANT := v1-v4
|
||||
SUPPORTED_TELTONIKA_DEVICES := teltonika,rut2m
|
||||
IMAGE_SIZE := 15424k
|
||||
BLOCKSIZE := 64k
|
||||
DEVICE_PACKAGES += uqmi kmod-mt76x2 kmod-usb2 kmod-usb-ohci kmod-usb-serial-option
|
||||
IMAGES += factory.bin
|
||||
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-teltonika-metadata rut2m
|
||||
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-teltonika-metadata
|
||||
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-metadata
|
||||
endef
|
||||
TARGET_DEVICES += teltonika_rut241
|
||||
|
||||
Reference in New Issue
Block a user