meta-quanta: gbs: add updating nvme config script

Update Present/Pwrgood GPIOs number to nvme json config and
export them before running phosphor-nvme daemon

Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: Ic9f8688b2c5f2db6c5309f023770a240b3dec816
diff --git a/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_config.json b/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_config.json
new file mode 100644
index 0000000..9a114d3
--- /dev/null
+++ b/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_config.json
@@ -0,0 +1,174 @@
+{
+    "config": [
+        {
+            "NVMeDriveIndex": 0,
+            "NVMeDriveBusID": 47,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_0_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_0_locate",
+            "NVMeDrivePresentPin": 499,
+            "NVMeDrivePwrGoodPin": 467
+        },
+        {
+            "NVMeDriveIndex": 1,
+            "NVMeDriveBusID": 46,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_1_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_1_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_1_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_1_locate",
+            "NVMeDrivePresentPin": 498,
+            "NVMeDrivePwrGoodPin": 466
+        },
+        {
+            "NVMeDriveIndex": 2,
+            "NVMeDriveBusID": 45,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_2_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_2_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_2_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_2_locate",
+            "NVMeDrivePresentPin": 497,
+            "NVMeDrivePwrGoodPin": 465
+        },
+        {
+            "NVMeDriveIndex": 3,
+            "NVMeDriveBusID": 44,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_3_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_3_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_3_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_3_locate",
+            "NVMeDrivePresentPin": 496,
+            "NVMeDrivePwrGoodPin": 464
+        },
+        {
+            "NVMeDriveIndex": 4,
+            "NVMeDriveBusID": 39,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_4_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_4_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_4_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_4_locate",
+            "NVMeDrivePresentPin": 503,
+            "NVMeDrivePwrGoodPin": 471
+        },
+        {
+            "NVMeDriveIndex": 5,
+            "NVMeDriveBusID": 38,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_5_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_5_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_5_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_5_locate",
+            "NVMeDrivePresentPin": 502,
+            "NVMeDrivePwrGoodPin": 470
+        },
+        {
+            "NVMeDriveIndex": 6,
+            "NVMeDriveBusID": 37,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_6_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_6_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_6_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_6_locate",
+            "NVMeDrivePresentPin": 501,
+            "NVMeDrivePwrGoodPin": 469
+        },
+        {
+            "NVMeDriveIndex": 7,
+            "NVMeDriveBusID": 36,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_7_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_7_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_7_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_7_locate",
+            "NVMeDrivePresentPin": 500,
+            "NVMeDrivePwrGoodPin": 468
+        },
+        {
+            "NVMeDriveIndex": 8,
+            "NVMeDriveBusID": 31,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_8_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_8_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_8_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_8_locate",
+            "NVMeDrivePresentPin": 507,
+            "NVMeDrivePwrGoodPin": 475
+        },
+        {
+            "NVMeDriveIndex": 9,
+            "NVMeDriveBusID": 30,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_9_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_9_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_9_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_9_locate",
+            "NVMeDrivePresentPin": 506,
+            "NVMeDrivePwrGoodPin": 474
+        },
+        {
+            "NVMeDriveIndex": 10,
+            "NVMeDriveBusID": 29,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_10_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_10_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_10_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_10_locate",
+            "NVMeDrivePresentPin": 505,
+            "NVMeDrivePwrGoodPin": 473
+        },
+        {
+            "NVMeDriveIndex": 11,
+            "NVMeDriveBusID": 28,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_11_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_11_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_11_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_11_locate",
+            "NVMeDrivePresentPin": 504,
+            "NVMeDrivePwrGoodPin": 472
+        },
+        {
+            "NVMeDriveIndex": 12,
+            "NVMeDriveBusID": 27,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_12_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_12_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_12_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_12_locate",
+            "NVMeDrivePresentPin": 511,
+            "NVMeDrivePwrGoodPin": 479
+        },
+        {
+            "NVMeDriveIndex": 13,
+            "NVMeDriveBusID": 26,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_13_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_13_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_13_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_13_locate",
+            "NVMeDrivePresentPin": 510,
+            "NVMeDrivePwrGoodPin": 478
+        },
+        {
+            "NVMeDriveIndex": 14,
+            "NVMeDriveBusID": 25,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_14_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_14_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_14_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_14_locate",
+            "NVMeDrivePresentPin": 509,
+            "NVMeDrivePwrGoodPin": 477
+        },
+        {
+            "NVMeDriveIndex": 15,
+            "NVMeDriveBusID": 24,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_15_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_15_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_15_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_15_locate",
+            "NVMeDrivePresentPin": 508,
+            "NVMeDrivePwrGoodPin": 476
+        }
+    ],
+    "threshold": [
+        {
+            "criticalHigh": 70,
+            "criticalLow": 0,
+            "warningHigh": 70,
+            "warningLow": 0,
+            "maxValue": 127,
+            "minValue": -128
+        }
+    ]
+}
\ No newline at end of file
diff --git a/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh b/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
new file mode 100644
index 0000000..27ca98d
--- /dev/null
+++ b/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
@@ -0,0 +1,214 @@
+#!/bin/bash
+
+TARGET_FILE_NAME="/etc/nvme/nvme_config.json"
+
+export_gpio() {
+  if [ ! -d "/sys/class/gpio/gpio$1" ]; then
+    echo $1 >/sys/class/gpio/export
+  fi
+}
+
+# Get NVMeDrivePresentPins
+# 1-0024
+
+# Get NVMeDrivePwrGoodPins
+# 1-0021
+
+if [ -d "/sys/bus/i2c/drivers/pca953x/1-0024" ]; then
+    presentPinBase="$(cat /sys/bus/i2c/drivers/pca953x/1-0024/gpio/gpiochip*/base)"
+    for i in {0..15};
+    do
+        let presentPinBase[$i]=presentPinBase+$i
+        export_gpio ${presentPinBase[$i]}
+    done
+else
+    echo "Can't find present gpio expander (addr: 0x24) !!"
+fi
+
+if [ -d "/sys/bus/i2c/drivers/pca953x/1-0021" ]; then
+    PwrGoodPinBase="$(cat /sys/bus/i2c/drivers/pca953x/1-0021/gpio/gpiochip*/base)"
+    for i in {0..15};
+    do
+        let PwrGoodPinBase[$i]=PwrGoodPinBase+$i
+        export_gpio ${PwrGoodPinBase[$i]}
+    done
+else
+    echo "Can't find powergood gpio expander (addr: 0x21) !!"
+fi
+
+cat > $TARGET_FILE_NAME << EOF1
+{
+    "config": [
+        {
+            "NVMeDriveIndex": 0,
+            "NVMeDriveBusID": 47,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_0_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_0_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[3]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[3]}
+        },
+        {
+            "NVMeDriveIndex": 1,
+            "NVMeDriveBusID": 46,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_1_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_1_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_1_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_1_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[2]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[2]}
+        },
+        {
+            "NVMeDriveIndex": 2,
+            "NVMeDriveBusID": 45,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_2_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_2_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_2_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_2_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[1]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[1]}
+        },
+        {
+            "NVMeDriveIndex": 3,
+            "NVMeDriveBusID": 44,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_3_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_3_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_3_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_3_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[0]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[0]}
+        },
+        {
+            "NVMeDriveIndex": 4,
+            "NVMeDriveBusID": 39,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_4_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_4_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_4_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_4_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[7]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[7]}
+        },
+        {
+            "NVMeDriveIndex": 5,
+            "NVMeDriveBusID": 38,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_5_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_5_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_5_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_5_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[6]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[6]}
+        },
+        {
+            "NVMeDriveIndex": 6,
+            "NVMeDriveBusID": 37,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_6_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_6_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_6_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_6_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[5]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[5]}
+        },
+        {
+            "NVMeDriveIndex": 7,
+            "NVMeDriveBusID": 36,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_7_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_7_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_7_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_7_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[4]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[4]}
+        },
+        {
+            "NVMeDriveIndex": 8,
+            "NVMeDriveBusID": 31,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_8_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_8_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_8_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_8_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[11]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[11]}
+        },
+        {
+            "NVMeDriveIndex": 9,
+            "NVMeDriveBusID": 30,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_9_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_9_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_9_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_9_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[10]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[10]}
+        },
+        {
+            "NVMeDriveIndex": 10,
+            "NVMeDriveBusID": 29,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_10_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_10_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_10_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_10_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[9]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[9]}
+        },
+        {
+            "NVMeDriveIndex": 11,
+            "NVMeDriveBusID": 28,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_11_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_11_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_11_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_11_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[8]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[8]}
+        },
+        {
+            "NVMeDriveIndex": 12,
+            "NVMeDriveBusID": 27,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_12_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_12_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_12_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_12_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[15]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[15]}
+        },
+        {
+            "NVMeDriveIndex": 13,
+            "NVMeDriveBusID": 26,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_13_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_13_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_13_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_13_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[14]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[14]}
+        },
+        {
+            "NVMeDriveIndex": 14,
+            "NVMeDriveBusID": 25,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_14_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_14_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_14_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_14_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[13]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[13]}
+        },
+        {
+            "NVMeDriveIndex": 15,
+            "NVMeDriveBusID": 24,
+            "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_15_fault",
+            "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_15_locate",
+            "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_15_locate",
+            "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_15_locate",
+            "NVMeDrivePresentPin": ${presentPinBase[12]},
+            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[12]}
+        }
+    ],
+    "threshold": [
+        {
+            "criticalHigh": 70,
+            "criticalLow": 0,
+            "warningHigh": 70,
+            "warningLow": 0,
+            "maxValue": 127,
+            "minValue": -128
+        }
+    ]
+}
+EOF1
diff --git a/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/xyz.openbmc_project.nvme.manager.service.replace b/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/xyz.openbmc_project.nvme.manager.service.replace
new file mode 100644
index 0000000..1238b4d
--- /dev/null
+++ b/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/xyz.openbmc_project.nvme.manager.service.replace
@@ -0,0 +1,19 @@
+[Unit]
+Description=NVMe management
+Wants=xyz.openbmc_project.LED.GroupManager.service xyz.openbmc_project.Inventory.Manager.service
+After=xyz.openbmc_project.LED.GroupManager.service xyz.openbmc_project.Inventory.Manager.service
+Wants=mapper-wait@-xyz-openbmc_project-control-nvme.service
+After=mapper-wait@-xyz-openbmc_project-control-nvme.service
+
+[Service]
+ExecStartPre=/usr/bin/nvme_json_rewrite.sh
+ExecStart=/usr/bin/nvme_main
+Type=dbus
+BusName=xyz.openbmc_project.nvme.manager
+SyslogIdentifier=phosphor-nvme
+Restart=always
+RestartSec=3
+StartLimitInterval=0
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file
diff --git a/meta-gbs/recipes-phosphor/sensors/phosphor-nvme_%.bbappend b/meta-gbs/recipes-phosphor/sensors/phosphor-nvme_%.bbappend
new file mode 100644
index 0000000..c3db11d
--- /dev/null
+++ b/meta-gbs/recipes-phosphor/sensors/phosphor-nvme_%.bbappend
@@ -0,0 +1,17 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+SRC_URI_append_gbs = " file://nvme_config.json"
+SRC_URI_append_gbs = " file://nvme_json_rewrite.sh"
+SRC_URI_append_gbs = " file://xyz.openbmc_project.nvme.manager.service.replace"
+
+RDEPENDS_${PN} += "bash"
+
+do_install_append_gbs() {
+        install -d ${D}/${sysconfdir}/nvme/
+        install -m 0644 ${WORKDIR}/nvme_config.json ${D}/${sysconfdir}/nvme/
+
+        install -d ${D}${bindir}
+        install -m 0755 ${WORKDIR}/nvme_json_rewrite.sh ${D}${bindir}/
+
+        install -d ${D}${systemd_system_unitdir}
+        install -m 0644 ${WORKDIR}/xyz.openbmc_project.nvme.manager.service.replace ${D}${systemd_system_unitdir}/xyz.openbmc_project.nvme.manager.service
+}