[openwrt/openwrt] mediatek: mt7622: make sure image generation can run in parallel

LEDE Commits lede-commits at lists.infradead.org
Tue Mar 2 01:43:41 GMT 2021


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/bb98ddc47b5d7c91428bfe0ca0f469a8f518f575

commit bb98ddc47b5d7c91428bfe0ca0f469a8f518f575
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Tue Mar 2 01:41:00 2021 +0000

    mediatek: mt7622: make sure image generation can run in parallel
    
    The previous approach of referencing artifacts in follow-up artifacts
    can't work with parallel builds in the current way image.mk is built.
    Refactor things so this is not needed.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 include/image-commands.mk             |  4 ----
 target/linux/mediatek/image/mt7622.mk | 15 +++++++--------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/include/image-commands.mk b/include/image-commands.mk
index 31690883fd..10b23e027b 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -27,10 +27,6 @@ define Build/append-kernel
 	dd if=$(IMAGE_KERNEL) >> $@
 endef
 
-define Build/append-image
-	dd if=$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))-$(1) >> $@
-endef
-
 compat_version=$(if $(DEVICE_COMPAT_VERSION),$(DEVICE_COMPAT_VERSION),1.0)
 json_quote=$(subst ','\'',$(subst ",\",$(1)))
 #")')
diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk
index afda48043f..d2c1fb5b13 100644
--- a/target/linux/mediatek/image/mt7622.mk
+++ b/target/linux/mediatek/image/mt7622.mk
@@ -6,10 +6,6 @@ else
   KERNEL_LOADADDR := 0x44000000
 endif
 
-define Build/mmc-header
-	dd if=$(STAGING_DIR_IMAGE)/mt7622-header_$1.bin bs=512 count=1 of=$@ conv=notrunc
-endef
-
 define Build/bl2
 	cat $(STAGING_DIR_IMAGE)/mt7622-$1-bl2.img >> $@
 endef
@@ -19,7 +15,8 @@ define Build/bl31-uboot
 endef
 
 define Build/mt7622-gpt
-	ptgen -g -o $@ -h 4 -s 31 -a 1 -l 1024 -g \
+	cp $@ $@.tmp || true
+	ptgen -g -o $@.tmp -h 4 -s 31 -a 1 -l 1024 -g \
 		-t 0xef \
 		$(if $(findstring sdmmc,$1), \
 			-N bl2		-r	-p 512k at 512k \
@@ -33,6 +30,9 @@ define Build/mt7622-gpt
 		$(if $(findstring emmc,$1), \
 			-t 0x2e -N production	-p 980M at 40M \
 		)
+	dd if=$(STAGING_DIR_IMAGE)/mt7622-header_$1.bin bs=512 count=1 of=$@.tmp conv=notrunc
+	cat $@.tmp >> $@
+	rm $@.tmp
 endef
 
 define Device/bananapi_bpi-r64
@@ -45,11 +45,10 @@ define Device/bananapi_bpi-r64
 		     uboot-mt7622_bananapi_bpi-r64-sdmmc \
 		     e2fsprogs mkf2fs f2fsck \
 		     kmod-nls-cp437 kmod-nls-iso8859-1 kmod-vfat blockd
-  ARTIFACTS := header-emmc.bin sdcard.img
+  ARTIFACTS := sdcard.img
   IMAGES := sysupgrade.itb
   KERNEL_INITRAMFS_SUFFIX := -recovery.itb
-  ARTIFACT/header-emmc.bin	:= mt7622-gpt  emmc | mmc-header  emmc
-  ARTIFACT/sdcard.img		:= mt7622-gpt sdmmc | mmc-header sdmmc | pad-to 128k | append-image header-emmc.bin | pad-to 256k |\
+  ARTIFACT/sdcard.img		:= mt7622-gpt sdmmc | pad-to 128k | mt7622-gpt emmc | pad-to 256k |\
 				   bl2 emmc-2ddr | pad-to 512k | bl2 sdmmc-2ddr | pad-to 1M | bl31-uboot bananapi_bpi-r64-emmc | pad-to 2M |\
 				   bl31-uboot bananapi_bpi-r64-sdmmc | pad-to 6M
   KERNEL			:= kernel-bin | gzip



More information about the lede-commits mailing list