meta-quanta: gbs: fix the config json issue

Since the fan hwmon sysfs path may change, if the hwmon path of config
json is already replaced by fan-table-init.sh, it would never change
in rw partition. Add config-sku.json to make sure the correct fan hwmon
sysfs path is replaced

(From meta-quanta rev: fb6723490cc9cbc8fd806cdd6d795e7feca4173b)

Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: Ic4ae24f3311a1ced845b60bddf247cef6b3c1e1e
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config-sku.json
similarity index 99%
rename from meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json
rename to meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config-sku.json
index d28a182..f2997ef 100644
--- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json
+++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config-sku.json
@@ -1,6 +1,6 @@
 {
     "version": "R03",
-    "sensors" : [
+    "sensors": [
         {
             "name": "fan0",
             "type": "fan",
@@ -102,7 +102,7 @@
             "timeout": 0
         }
     ],
-    "zones" : [
+    "zones": [
         {
             "id": 0,
             "minThermalOutput": 0.0,
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
index 5706a73..68b699e 100644
--- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
+++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
@@ -1,5 +1,11 @@
 #!/bin/bash
 
+FAN_TABLE_SKU_FILE="/usr/share/swampd/config-sku.json"
+FAN_TABLE_FILE="/usr/share/swampd/config.json"
+
+# determine sku
+cp $FAN_TABLE_SKU_FILE $FAN_TABLE_FILE
+
 # wait for fan dbus
 mapper wait /xyz/openbmc_project/sensors/fan_tach/fan0
 mapper wait /xyz/openbmc_project/sensors/fan_tach/fan1
@@ -12,9 +18,8 @@
 # generate fan table writePath
 Fan_0_To_4_Hwmon="$(ls -la /sys/class/hwmon |grep pwm |  head -n 1| tail -n +1|cut -d '/' -f 9)"
 
-if [[ "$Fan_0_To_4_Hwmon" != "" ]]
-then
-     sed -i "s/Fan_0_To_4_Hwmon/$Fan_0_To_4_Hwmon/g" /usr/share/swampd/config.json
+if [[ "$Fan_0_To_4_Hwmon" != "" ]]; then
+     sed -i "s/Fan_0_To_4_Hwmon/$Fan_0_To_4_Hwmon/g" $FAN_TABLE_FILE
 fi
 
 # start read margin temp wait
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
index f87a493..4f21d3b 100644
--- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
+++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
@@ -1,11 +1,11 @@
 FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:"
-SRC_URI_append_gbs = " file://config.json"
+SRC_URI_append_gbs = " file://config-sku.json"
 SRC_URI_append_gbs = " file://fan-table-init.sh"
 SRC_URI_append_gbs = " file://fan-default-speed.sh"
 SRC_URI_append_gbs = " file://phosphor-pid-control.service"
 SRC_URI_append_gbs = " file://fan-reboot-control.service"
 
-FILES_${PN}_append_gbs = " ${datadir}/swampd/config.json"
+FILES_${PN}_append_gbs = " ${datadir}/swampd/config-sku.json"
 FILES_${PN}_append_gbs = " ${bindir}/fan-default-speed.sh"
 FILES_${PN}_append_gbs = " ${bindir}/fan-table-init.sh"
 
@@ -20,8 +20,8 @@
     install -m 0755 ${WORKDIR}/fan-table-init.sh ${D}/${bindir}
 
     install -d ${D}${datadir}/swampd
-    install -m 0644 -D ${WORKDIR}/config.json \
-        ${D}${datadir}/swampd/config.json
+    install -m 0644 -D ${WORKDIR}/config-sku.json \
+        ${D}${datadir}/swampd/config-sku.json
 
     install -d ${D}${systemd_system_unitdir}
     install -m 0644 ${WORKDIR}/phosphor-pid-control.service \