meta-facebook: add secondary-emmc feature
* Define a MACHINE_FEATURE that enables a secondary eMMC device.
* Add kernel and base-files support for mounting the eMMC device
using btrfs.
* Enable machine feature for Bletchley.
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I3fde3b285720c137c4e5bbbad233e4ef40b84d54
diff --git a/meta-facebook/conf/machine/include/facebook-secondary-emmc.inc b/meta-facebook/conf/machine/include/facebook-secondary-emmc.inc
new file mode 100644
index 0000000..2a63e97
--- /dev/null
+++ b/meta-facebook/conf/machine/include/facebook-secondary-emmc.inc
@@ -0,0 +1,2 @@
+MACHINE_FEATURES:append = " fb-secondary-emmc"
+MACHINEOVERRIDES:append = ":mf-fb-secondary-emmc"
diff --git a/meta-facebook/meta-bletchley/conf/machine/bletchley.conf b/meta-facebook/meta-bletchley/conf/machine/bletchley.conf
index 1d1a5b8..3d0e7aa 100644
--- a/meta-facebook/meta-bletchley/conf/machine/bletchley.conf
+++ b/meta-facebook/meta-bletchley/conf/machine/bletchley.conf
@@ -10,6 +10,7 @@
require conf/machine/include/ast2600.inc
require conf/machine/include/obmc-bsp-common.inc
require conf/machine/include/facebook-tpm2.inc
+require conf/machine/include/facebook-secondary-emmc.inc
FLASH_SIZE = "131072"
diff --git a/meta-facebook/recipes-core/base-files/base-files_%.bbappend b/meta-facebook/recipes-core/base-files/base-files_%.bbappend
new file mode 100644
index 0000000..3b94c70
--- /dev/null
+++ b/meta-facebook/recipes-core/base-files/base-files_%.bbappend
@@ -0,0 +1,8 @@
+do_install:append:mf-fb-secondary-emmc() {
+ # create eMMC mount point
+ install -m 0755 -d ${D}/mnt/data
+
+ # insert fstab entry for eMMC
+ FSTAB_EMMC="/dev/mmcblk0 /mnt/data btrfs compress=zstd,discard,nofail 0 0"
+ echo "$FSTAB_EMMC" >> ${D}${sysconfdir}/fstab
+}
diff --git a/meta-facebook/recipes-kernel/linux/files/emmc-btrfs.cfg b/meta-facebook/recipes-kernel/linux/files/emmc-btrfs.cfg
new file mode 100644
index 0000000..605c183
--- /dev/null
+++ b/meta-facebook/recipes-kernel/linux/files/emmc-btrfs.cfg
@@ -0,0 +1 @@
+CONFIG_BTRFS_FS=y
diff --git a/meta-facebook/recipes-kernel/linux/files/emmc-btrfs.scc b/meta-facebook/recipes-kernel/linux/files/emmc-btrfs.scc
new file mode 100644
index 0000000..7aeb5e3
--- /dev/null
+++ b/meta-facebook/recipes-kernel/linux/files/emmc-btrfs.scc
@@ -0,0 +1,4 @@
+define KFEATURE_DESCRIPTION "Enable BTRFS for eMMC"
+define KFEATURE_COMPATIBILITY all
+
+kconf non-hardware emmc-btrfs.cfg
diff --git a/meta-facebook/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-facebook/recipes-kernel/linux/linux-aspeed_%.bbappend
new file mode 100644
index 0000000..81d3132
--- /dev/null
+++ b/meta-facebook/recipes-kernel/linux/linux-aspeed_%.bbappend
@@ -0,0 +1,10 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+SRC_URI:append:mf-fb-secondary-emmc = " \
+ file://emmc-btrfs.scc \
+ file://emmc-btrfs.cfg \
+ "
+
+KERNEL_FEATURES:append:mf-fb-secondary-emmc = " \
+ emmc-btrfs.scc \
+ "