[openwrt/openwrt] bmips: use sercomm-pid script

LEDE Commits lede-commits at lists.infradead.org
Sun Apr 9 03:52:50 PDT 2023


noltari pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/d11a7c4d95a5ecbd2b12750be63349a3d0da2d53

commit d11a7c4d95a5ecbd2b12750be63349a3d0da2d53
Author: Álvaro Fernández Rojas <noltari at gmail.com>
AuthorDate: Sun Apr 9 10:10:28 2023 +0200

    bmips: use sercomm-pid script
    
    Make use of sercomm-pid script for generating the Sercomm PID, which avoids
    having to add an array of hex bytes for every new Sercomm device.
    
    Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
 target/linux/bmips/image/Makefile        |  8 +++++++-
 target/linux/bmips/image/bcm63xx_nand.mk | 27 +++++++--------------------
 2 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/target/linux/bmips/image/Makefile b/target/linux/bmips/image/Makefile
index 907779847d..da328f7216 100644
--- a/target/linux/bmips/image/Makefile
+++ b/target/linux/bmips/image/Makefile
@@ -194,12 +194,18 @@ define Build/cfe-sercomm-crypto
 endef
 
 define Build/cfe-sercomm-load
+	$(TOPDIR)/scripts/sercomm-pid.py \
+		--hw-version $(SERCOMM_HWVER) \
+		--sw-version $(SERCOMM_SWVER) \
+		--extra-padding-size 0x10 \
+		--pid-file $@.pid
 	$(TOPDIR)/scripts/sercomm-payload.py \
 		--input-file $@ \
 		--output-file $@.new \
-		--pid "$(SERCOMM_PID)"
+		--pid-file $@.pid
 
 	mv $@.new $@
+	rm -f $@.pid
 endef
 
 define Build/cfe-sercomm-part
diff --git a/target/linux/bmips/image/bcm63xx_nand.mk b/target/linux/bmips/image/bcm63xx_nand.mk
index b8be3016c9..89b634c8d1 100644
--- a/target/linux/bmips/image/bcm63xx_nand.mk
+++ b/target/linux/bmips/image/bcm63xx_nand.mk
@@ -5,7 +5,7 @@ DEVICE_VARS += CFE_RAM_FILE
 DEVICE_VARS += CFE_RAM_JFFS2_NAME CFE_RAM_JFFS2_PAD
 DEVICE_VARS += CFE_WFI_CHIP_ID CFE_WFI_FLASH_TYPE
 DEVICE_VARS += CFE_WFI_FLAGS CFE_WFI_VERSION
-DEVICE_VARS += SERCOMM_PID SERCOMM_FSVER
+DEVICE_VARS += SERCOMM_FSVER SERCOMM_HWVER SERCOMM_SWVER
 
 # CFE expects a single JFFS2 partition with cferam and kernel. However,
 # it's possible to fool CFE into properly loading both cferam and kernel
@@ -41,8 +41,9 @@ define Device/sercomm-nand
   IMAGES := factory.img sysupgrade.bin
   IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi |\
     cfe-sercomm-part | gzip | cfe-sercomm-load | cfe-sercomm-crypto
-  SERCOM_PID :=
   SERCOMM_FSVER :=
+  SERCOMM_HWVER :=
+  SERCOMM_SWVER :=
 endef
 
 define Device/comtrend_vr-3032u
@@ -115,16 +116,9 @@ define Device/sercomm_h500-s-lowi
   SUBPAGESIZE := 512
   VID_HDR_OFFSET := 2048
   DEVICE_PACKAGES += $(USB2_PACKAGES)
-  SERCOMM_PID := \
-    30 30 30 30 30 30 30 31 34 33 34 62 33 31 30 30 \
-    30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
-    30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
-    30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
-    30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
-    30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
-    30 30 30 30 33 33 30 35 30 30 30 30 30 30 30 30 \
-    0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   SERCOMM_FSVER := 1001
+  SERCOMM_HWVER := 1434b31
+  SERCOMM_SWVER := 3305
 endef
 TARGET_DEVICES += sercomm_h500-s-lowi
 
@@ -142,15 +136,8 @@ define Device/sercomm_h500-s-vfes
   SUBPAGESIZE := 512
   VID_HDR_OFFSET := 2048
   DEVICE_PACKAGES += $(USB2_PACKAGES)
-  SERCOMM_PID := \
-    30 30 30 30 30 30 30 31 34 32 35 38 34 62 30 30 \
-    30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
-    30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
-    30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
-    30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
-    30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
-    30 30 30 30 33 34 31 37 30 30 30 30 30 30 30 30 \
-    0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   SERCOMM_FSVER := 1001
+  SERCOMM_HWVER := 142584b
+  SERCOMM_SWVER := 3417
 endef
 TARGET_DEVICES += sercomm_h500-s-vfes




More information about the lede-commits mailing list