mediatek: mt7623: build SD card without all filesystems
[openwrt/staging/ldir.git] / target / linux / mediatek / image / mt7623.mk
index cad3dd2b93803b75c1e3d1737fed3974f2d6b326..1645ecd545075608cfa6516ba7f86113521c122d 100644 (file)
@@ -1,4 +1,3 @@
-KERNEL_LOADADDR := 0x80008000
 DEVICE_VARS += UBOOT_TARGET UBOOT_OFFSET UBOOT_IMAGE
 
 # The bootrom of MT7623 expects legacy MediaTek headers present in
@@ -57,12 +56,7 @@ define Build/mt7623-mbr
        ptgen -o $@.tmp -h 4 -s 63 -a 0 -l 1024 \
                        -t 0x41 -N uboot        -p 1M@$(UBOOT_OFFSET) \
                        -t 0xea -N recovery     -p 40M@4M \
-               $(if $(findstring sdmmc,$1), \
-                       -t 0x2e -N production   -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@48M \
-               ) \
-               $(if $(findstring emmc,$1), \
-                       -t 0x2e -N production   -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@48M \
-               )
+                       -t 0x2e -N production   -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@48M
 
        echo -en \
                $(if $(findstring sdmmc,$1),"SDMMC_BOOT\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00") \
@@ -110,8 +104,12 @@ define Device/bananapi_bpi-r2
                            pad-to 2k | append-preloader $$(UBOOT_TARGET) |\
                            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 |\
+                           ) \
+                           $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
                            pad-to 48M | append-image squashfs-sysupgrade.itb |\
+                           ) \
                            gzip
   ARTIFACTS := u-boot.bin preloader.bin sdcard.img.gz
   SUPPORTED_DEVICES := bananapi,bpi-r2
@@ -141,8 +139,12 @@ define Device/unielec_u7623-02
 # but OpenWrt expects 'SDMM' magic for sysupgrade.
   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 |\
+                           ) \
+                           $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
                            pad-to 48M | append-image squashfs-sysupgrade.itb |\
+                           ) \
                            gzip | append-metadata
   ARTIFACT/scatter.txt := scatterfile emmc.img.gz
   ARTIFACTS := u-boot.bin scatter.txt emmc.img.gz
@@ -170,13 +172,13 @@ define Device/unielec_u7623-02-emmc-512m-legacy
   KERNEL := kernel-bin | append-dtb | uImage none
   KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none
   DEVICE_PACKAGES := kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc \
-       mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk \
+       mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci \
        partx-utils
-  IMAGES := sysupgrade-emmc.bin.gz
-  IMAGE/sysupgrade-emmc.bin.gz := append-kernel |\
-                                   pad-to 4864k | fat-recovery-fs |\
-                                   pad-to 7936k | append-rootfs |\
-                                   gzip | append-metadata
+  IMAGES := sysupgrade.bin.gz
+  IMAGE/sysupgrade.bin.gz := append-kernel |\
+                               pad-to 4864k | fat-recovery-fs |\
+                               pad-to 7936k | append-rootfs |\
+                               gzip | append-metadata
   SUPPORTED_DEVICES := unielec,u7623-02-emmc-512m
 endef
 TARGET_DEVICES += unielec_u7623-02-emmc-512m-legacy