From d5d2488b7262ddb8b2ec6ec731c0da19ab8cc973 Mon Sep 17 00:00:00 2001
From: Andreas Gnau <andreas.gnau@iopsys.eu>
Date: Wed, 9 Dec 2020 15:24:44 +0100
Subject: [PATCH] brcm63xx-arm: Add extra /data partition to mount

Add extra /data partition to system_layout.json and remove manual
mounting from the wifi_bringup-script.
---
 .../base-files/etc/board-db/system_layout.json   | 16 ++++++++++++++++
 .../disc/base-files/etc/init.d/wifi_bringup      |  3 ---
 .../smarthub3/base-files/etc/init.d/wifi_bringup |  3 ---
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/iopsys-brcm63xx-arm/base-files/etc/board-db/system_layout.json b/iopsys-brcm63xx-arm/base-files/etc/board-db/system_layout.json
index a2ee165f1..a92392841 100644
--- a/iopsys-brcm63xx-arm/base-files/etc/board-db/system_layout.json
+++ b/iopsys-brcm63xx-arm/base-files/etc/board-db/system_layout.json
@@ -5,6 +5,7 @@
     "/dev/mmcblk0p4": {
 	"standby_root_mount"	: "mount /dev/mmcblk0p6",
 	"dev_links"		: "emmc_dev_links",
+	"extra_mounts"          : "emmc_extra_mounts",
 	"overlay_mount"		: "mount -t ext4 /dev/mmcblk0p9 /overlay",
 	"standby_overlay_mount"	: "mount -t ext4 /dev/mmcblk0p10 /tmp/standby_overlay",
 	"overlay_pivot"		: "yes",
@@ -14,6 +15,7 @@
     "/dev/mmcblk0p6": {
 	"standby_root_mount"	: "mount /dev/mmcblk0p4",
 	"dev_links"		: "emmc_dev_links",
+	"extra_mounts"          : "emmc_extra_mounts",
 	"overlay_mount"		: "mount -t ext4 /dev/mmcblk0p10 /overlay",
 	"standby_overlay_mount"	: "mount -t ext4 /dev/mmcblk0p9 /tmp/standby_overlay",
 	"overlay_pivot"		: "yes",
@@ -23,6 +25,7 @@
     /*  NAND based boards with squashfs */
     "/dev/ubiblock0_4": {
 	"standby_root_mount"	: "ubiblock --create /dev/ubi0_6;mount /dev/ubiblock0_6",
+	"extra_mounts"          : "ubi_extra_mounts",
 	"overlay_mount"		: "mount -t ubifs ubi0:overlayA /overlay",
 	"standby_overlay_mount"	: "mount -t ubifs ubi0:overlayB /tmp/standby_overlay",
 	"overlay_pivot"		: "yes",
@@ -31,6 +34,7 @@
 
     "/dev/ubiblock0_6": {
 	"standby_root_mount"	: "ubiblock --create /dev/ubi0_4;mount /dev/ubiblock0_4",
+	"extra_mounts"          : "ubi_extra_mounts",
 	"overlay_mount"		: "mount -t ubifs ubi0:overlayB /overlay",
 	"standby_overlay_mount"	: "mount -t ubifs ubi0:overlayA /tmp/standby_overlay",
 	"overlay_pivot"		: "yes",
@@ -40,6 +44,7 @@
     /*  NAND based boards with ubifs */
     "ubi:rootfs1": {
 	"iopsys_bank_id"	: "0",
+	"extra_mounts"          : "ubi_extra_mounts",
 	"standby_root_mount"	: "mount -t ubifs ubi0:rootfs2",
 
 	"overlay_mount"		: "mount -t ubifs ubi0:overlayA /overlay",
@@ -50,6 +55,7 @@
 
     "ubi:rootfs2": {
 	"iopsys_bank_id"	: "1",
+	"extra_mounts"          : "ubi_extra_mounts",
 	"standby_root_mount"	: "mount -t ubifs ubi0:rootfs1",
 
 	"overlay_mount"		: "mount -t ubifs ubi0:overlayB /overlay",
@@ -80,4 +86,14 @@
 	/* impossilbe to add /dev/log is an actual device */
 	//"log"	:	 "/dev/mmcblk0p13"
     },
+    "emmc_extra_mounts": [
+	{
+		"mount_command": "mount -t ext4 /dev/data /data"
+	},
+    ],
+    "ubi_extra_mounts": [
+	{
+		"mount_command": "mount -t ubifs ubi0:data /data"
+	},
+    ],
 }
diff --git a/iopsys-brcm63xx-arm/disc/base-files/etc/init.d/wifi_bringup b/iopsys-brcm63xx-arm/disc/base-files/etc/init.d/wifi_bringup
index 6bbf961dc..14141537e 100755
--- a/iopsys-brcm63xx-arm/disc/base-files/etc/init.d/wifi_bringup
+++ b/iopsys-brcm63xx-arm/disc/base-files/etc/init.d/wifi_bringup
@@ -6,9 +6,6 @@
 START=18
 
 boot() {
-	# always use the data partition as data
-	mountpoint -q /data || mount -t ubifs ubi:data /data
-
 	BOARDID=$(cat /proc/nvram/boardid)
 	NVM_FILE="${BOARDID}.nvm"
 
diff --git a/iopsys-brcm63xx-arm/smarthub3/base-files/etc/init.d/wifi_bringup b/iopsys-brcm63xx-arm/smarthub3/base-files/etc/init.d/wifi_bringup
index 6d0747859..14141537e 100755
--- a/iopsys-brcm63xx-arm/smarthub3/base-files/etc/init.d/wifi_bringup
+++ b/iopsys-brcm63xx-arm/smarthub3/base-files/etc/init.d/wifi_bringup
@@ -6,9 +6,6 @@
 START=18
 
 boot() {
-	# always use the data partition as data
-	mountpoint -q /data || mount -t ext4 /dev/data /data
-
 	BOARDID=$(cat /proc/nvram/boardid)
 	NVM_FILE="${BOARDID}.nvm"
 
-- 
GitLab