[][mt7986: Add emmc image]
[Description]
Add mmc image, enable related kernel options and dts.
[Release-log]
N/A
Change-Id: I1727e72b19c67f971d9fab00f12ef6456dccc70d
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/4632363
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-emmc-rfb.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-emmc-rfb.dts
new file mode 100644
index 0000000..7c0f601
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-emmc-rfb.dts
@@ -0,0 +1,20 @@
+/dts-v1/;
+#include "mt7986a-rfb.dtsi"
+/ {
+ model = "MediaTek MT7986a RFB";
+ compatible = "mediatek,mt7986a-emmc-rfb";
+
+ chosen {
+ bootargs = "console=ttyS0,115200n1 loglevel=8 \
+ earlycon=uart8250,mmio32,0x11002000 \
+ root=/dev/mmcblk0p7 rootfstype=squashfs,f2fs";
+ };
+};
+
+&snand {
+ status = "disabled";
+};
+
+&spi0 {
+ status = "disabled";
+};
diff --git a/target/linux/mediatek/image/gen_mt7986_emmc_img.sh b/target/linux/mediatek/image/gen_mt7986_emmc_img.sh
new file mode 100755
index 0000000..d74068c
--- /dev/null
+++ b/target/linux/mediatek/image/gen_mt7986_emmc_img.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+OUTPUT_FILE=$1
+KERNEL_FILE=$2
+RECOVERY_FILE=$3
+ROOTFS_FILE=$4
+
+BS=512
+
+#RECOVERY_OFFSET= kernel size / BS = 20M / 512 (blocks)
+RECOVERY_OFFSET=40960
+
+#ROOTFS_OFFSET = RECOVERY_OFFSET + (RECOVERY_SIZE / BS)
+# = 40960 + (10M / 512) (blocks)
+ROOTFS_OFFSET=61440
+dd bs="$BS" of="$OUTPUT_FILE" if="$KERNEL_FILE"
+dd bs="$BS" of="$OUTPUT_FILE" if="$RECOVERY_FILE" seek="$RECOVERY_OFFSET"
+dd bs="$BS" of="$OUTPUT_FILE" if="$ROOTFS_FILE" seek="$ROOTFS_OFFSET"
+dd if=/dev/zero of="$OUTPUT_FILE" bs=128k count=1 oflag=append conv=notrunc
diff --git a/target/linux/mediatek/image/mt7986.mk b/target/linux/mediatek/image/mt7986.mk
index 36ea2eb..1720a66 100644
--- a/target/linux/mediatek/image/mt7986.mk
+++ b/target/linux/mediatek/image/mt7986.mk
@@ -25,6 +25,17 @@
endef
TARGET_DEVICES += mt7986a-ax6000-snand-rfb
+define Device/mt7986a-ax6000-emmc-rfb
+ DEVICE_VENDOR := MediaTek
+ DEVICE_MODEL := mt7986a-ax6000-emmc-rfb
+ DEVICE_DTS := mt7986a-emmc-rfb
+ DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
+ DEVICE_PACKAGES := mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc
+ IMAGES := sysupgrade-emmc.bin.gz
+ IMAGE/sysupgrade.bin.gz := sysupgrade-emmc | gzip | append-metadata
+endef
+TARGET_DEVICES += mt7986a-ax6000-emmc-rfb
+
define Device/mt7986a-ax6000-2500wan-nor-rfb
DEVICE_VENDOR := MediaTek
DEVICE_MODEL := mt7986a-ax6000-2500wan-nor-rfb
diff --git a/target/linux/mediatek/mt7986/config-5.4 b/target/linux/mediatek/mt7986/config-5.4
index 7df3763..2e27823 100644
--- a/target/linux/mediatek/mt7986/config-5.4
+++ b/target/linux/mediatek/mt7986/config-5.4
@@ -52,6 +52,7 @@
CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
CONFIG_BLK_DEV_DM=y
CONFIG_BLK_DEV_DM_BUILTIN=y
+CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_MD is not set
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_MQ_PCI=y
@@ -281,6 +282,7 @@
CONFIG_MFD_SYSCON=y
CONFIG_MIGRATION=y
CONFIG_MMC=y
+CONFIG_MMC_BLOCK=y
CONFIG_MMC_MTK=y
CONFIG_MODULES_TREE_LOOKUP=y
CONFIG_MODULES_USE_ELF_RELA=y