mediatek: fix, clean and unify SD card image generation
authorDaniel Golle <daniel@makrotopia.org>
Fri, 26 May 2023 09:26:49 +0000 (10:26 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Fri, 26 May 2023 13:31:36 +0000 (14:31 +0100)
Make sure sub-images on the SD card are size-checked, allow
generating SD card without squashfs and/or initramfs.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
target/linux/mediatek/image/filogic.mk
target/linux/mediatek/image/mt7622.mk
target/linux/mediatek/image/mt7623.mk

index 72adb490666414e490235c410fd7fed5a5dc0d07..fac72a1b371fd7e9f751dce71f2541f731333c2d 100644 (file)
@@ -119,8 +119,9 @@ define Device/bananapi_bpi-r3
                                   pad-to 52M | bl31-uboot bananapi_bpi-r3-emmc |\
                                   pad-to 56M | mt7986-gpt emmc |\
                                $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
-                                  pad-to 64M | append-image squashfs-sysupgrade.itb | check-size | gzip \
-                               )
+                                  pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\
+                               ) \
+                                 gzip
   IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
   KERNEL                       := kernel-bin | gzip
   KERNEL_INITRAMFS := kernel-bin | lzma | \
index 12e819ed5454a363290c73bad95dd8d462c6a8f3..92824ff24a6f77564c5b0a3ba063d7f2b45e18f3 100644 (file)
@@ -88,9 +88,10 @@ define Device/bananapi_bpi-r64
                                   pad-to 40960k | bl31-uboot bananapi_bpi-r64-emmc |\
                                   pad-to 43008k | bl2 snand-2ddr |\
                                   pad-to 43520k | bl31-uboot bananapi_bpi-r64-snand |\
-                               $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
-                                  pad-to 46080k | append-image squashfs-sysupgrade.itb | check-size | gzip \
-                               )
+                               $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS), \
+                                  pad-to 46080k | append-image squashfs-sysupgrade.itb | check-size |\
+                               ) \
+                                 gzip
   IMAGE_SIZE := $$(shell expr 45 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
   KERNEL                       := kernel-bin | gzip
   KERNEL_INITRAMFS             := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
index 1645ecd545075608cfa6516ba7f86113521c122d..5828c4d763d937929f75f0d07f1674e3750db7a2 100644 (file)
@@ -96,6 +96,7 @@ define Device/bananapi_bpi-r2
   KERNEL := kernel-bin | gzip
   KERNEL_INITRAMFS_SUFFIX := -recovery.itb
   KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd
+  IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
   IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
   ARTIFACT/preloader.bin := mt7623-mbr emmc |\
                            pad-to 2k | append-preloader $$(UBOOT_TARGET)
@@ -105,10 +106,10 @@ define Device/bananapi_bpi-r2
                            pad-to $$(UBOOT_OFFSET) | append-bootloader $$(UBOOT_TARGET) |\
                            pad-to 4092k | mt7623-mbr emmc |\
                            $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\
-                           pad-to 4M | append-image-stage initramfs-recovery.itb |\
+                           pad-to 4M | append-image-stage initramfs-recovery.itb | check-size 48m |\
                            ) \
                            $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
-                           pad-to 48M | append-image squashfs-sysupgrade.itb |\
+                           pad-to 48M | append-image squashfs-sysupgrade.itb | check-size |\
                            ) \
                            gzip
   ARTIFACTS := u-boot.bin preloader.bin sdcard.img.gz
@@ -129,6 +130,7 @@ define Device/unielec_u7623-02
   UBOOT_TARGET := mt7623a_unielec_u7623
   UBOOT_IMAGE := u-boot-mtk.bin
   UBOOT_PATH := $(STAGING_DIR_IMAGE)/$$(UBOOT_TARGET)-$$(UBOOT_IMAGE)
+  IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
   IMAGES := sysupgrade.itb
   KERNEL := kernel-bin | gzip
   KERNEL_INITRAMFS_SUFFIX := -recovery.itb
@@ -140,10 +142,10 @@ define Device/unielec_u7623-02
   ARTIFACT/emmc.img.gz := mt7623-mbr sdmmc |\
                            pad-to $$(UBOOT_OFFSET) | append-bootloader $$(UBOOT_TARGET) |\
                            $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\
-                           pad-to 4M | append-image-stage initramfs-recovery.itb |\
+                           pad-to 4M | append-image-stage initramfs-recovery.itb | check-size 48m |\
                            ) \
                            $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
-                           pad-to 48M | append-image squashfs-sysupgrade.itb |\
+                           pad-to 48M | append-image squashfs-sysupgrade.itb | check-size |\
                            ) \
                            gzip | append-metadata
   ARTIFACT/scatter.txt := scatterfile emmc.img.gz