[openwrt/openwrt] mediatek: merge trx helpers in image/mt7622.mk

LEDE Commits lede-commits at lists.infradead.org
Sun Mar 3 06:38:25 PST 2024


dangole pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/882d20e25b574024442284c433d26f33cbac76f9

commit 882d20e25b574024442284c433d26f33cbac76f9
Author: INAGAKI Hiroshi <musashino.open at gmail.com>
AuthorDate: Sun Aug 27 17:29:12 2023 +0900

    mediatek: merge trx helpers in image/mt7622.mk
    
    Merge similar helpers of trx image generation, "buffalo-kernel-trx" and
    "trx-nand".
    
    Signed-off-by: INAGAKI Hiroshi <musashino.open at gmail.com>
    (cherry picked from commit d0929006f2290307f6b9ba37d221f44a145d8d1b)
---
 target/linux/mediatek/image/mt7622.mk | 42 +++++++++++++++--------------------
 1 file changed, 18 insertions(+), 24 deletions(-)

diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk
index 8f29843f3c..2a5e60989f 100644
--- a/target/linux/mediatek/image/mt7622.mk
+++ b/target/linux/mediatek/image/mt7622.mk
@@ -6,19 +6,24 @@ define Image/Prepare
 	echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark
 endef
 
-define Build/buffalo-kernel-trx
+define Build/buffalo-trx
 	$(eval magic=$(word 1,$(1)))
-	$(eval dummy=$(word 2,$(1)))
+	$(eval kern_bin=$(if $(1),$(IMAGE_KERNEL),$@))
+	$(eval rtfs_bin=$(word 2,$(1)))
+	$(eval apnd_bin=$(word 3,$(1)))
 	$(eval kern_size=$(if $(KERNEL_SIZE),$(KERNEL_SIZE),0x400000))
 
-	$(if $(dummy),touch $(dummy))
+	$(if $(rtfs_bin),touch $(rtfs_bin))
 	$(STAGING_DIR_HOST)/bin/otrx create $@.new \
 		$(if $(magic),-M $(magic),) \
-		-f $@ \
-		$(if $(dummy),\
+		-f $(kern_bin) \
+		$(if $(rtfs_bin),\
 			-a 0x20000 \
 			-b $$(( $(subst k, * 1024,$(kern_size)) )) \
-			-f $(dummy),)
+			-f $(rtfs_bin),) \
+		$(if $(apnd_bin),\
+			-A $(apnd_bin) \
+			-a 0x20000)
 	mv $@.new $@
 endef
 
@@ -51,19 +56,6 @@ define Build/mt7622-gpt
 	rm $@.tmp
 endef
 
-define Build/trx-nand
-	# kernel: always use 4 MiB (-28 B or TRX header) to allow upgrades even
-	#	  if it grows up between releases
-	# root: UBI with one extra block containing UBI mark to trigger erasing
-	#	rest of partition
-	$(STAGING_DIR_HOST)/bin/otrx create $@.new \
-		-M 0x32504844 \
-		-f $(IMAGE_KERNEL) -a 0x20000 -b 0x400000 \
-		-f $@ \
-		-A $(KDIR)/ubi_mark -a 0x20000
-	mv $@.new $@
-endef
-
 define Device/bananapi_bpi-r64
   DEVICE_VENDOR := Bananapi
   DEVICE_MODEL := BPi-R64
@@ -122,13 +114,15 @@ define Device/buffalo_wsr-2533dhp2
   IMAGES += factory.bin factory-uboot.bin
   KERNEL_INITRAMFS := kernel-bin | lzma | \
 	fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | \
-	buffalo-kernel-trx
-  IMAGE/factory.bin := append-ubi | trx-nand | \
+	buffalo-trx
+  IMAGE/factory.bin := append-ubi | \
+	buffalo-trx 0x32504844 $$$$@ $(KDIR)/ubi_mark | \
 	buffalo-enc WSR-2533DHP2 $$(BUFFALO_TAG_VERSION) -l | \
 	buffalo-tag-dhp WSR-2533DHP2 JP JP | buffalo-enc-tag -l | buffalo-dhp-image
-  IMAGE/factory-uboot.bin := append-ubi | trx-nand
-  IMAGE/sysupgrade.bin := append-kernel | \
-	buffalo-kernel-trx 0x32504844 $(KDIR)/tmp/$$(DEVICE_NAME).null | \
+  IMAGE/factory-uboot.bin := append-ubi | \
+	buffalo-trx 0x32504844 $$$$@ $(KDIR)/ubi_mark
+  IMAGE/sysupgrade.bin := \
+	buffalo-trx 0x32504844 $(KDIR)/tmp/$$(DEVICE_NAME).null | \
 	sysupgrade-tar kernel=$$$$@ | append-metadata
   DEVICE_PACKAGES := kmod-mt7615-firmware swconfig
 endef




More information about the lede-commits mailing list