vpnor: Add patch location

Look for the requested partition in the designated patch location
(/usr/local/share/pnor/). If the partition is not found there,
continue with the existing logic of looking in the other partition
directories.
This allows users to use patches in the virtual pnor implementation.

Resolves openbmc/openbmc#1551

Change-Id: I7f27dfc9cd69a3f8ab88cb6fa77b2c1096e32841
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/pnor_partition.cpp b/pnor_partition.cpp
index ba0ac20..1d5ca12 100644
--- a/pnor_partition.cpp
+++ b/pnor_partition.cpp
@@ -69,6 +69,14 @@
 
     fs::path partitionFilePath;
 
+    // Check if partition exists in patch location
+    partitionFilePath = context->paths.patch_loc;
+    partitionFilePath /= partition->data.name;
+    if (fs::is_regular_file(partitionFilePath))
+    {
+        return partitionFilePath.string();
+    }
+
     switch (partition->data.user.data[1] &
             (PARTITION_PRESERVED | PARTITION_READONLY))
     {