From 8e17df623a5df8eed43991a6a5691d72c3169509 Mon Sep 17 00:00:00 2001
From: Siddeswar Aluganti <salugant@codeaurora.org>
Date: Wed, 14 Apr 2021 12:04:04 -0700
Subject: [PATCH] sm8350-common: gpt-utils: Update PTN_SWAP_LIST and handle
 multiimg(oem/qti),

 * Update PTN_SWAP_LIST to reflect partition entry changes
   to BOOT LUN and handle "multiimgoem", "multiimgqti"
   partitions, similar to other BOOT LUN partitions.

Change-Id: I3fb2934c44f3c2555ef36437ae97c9a47bb874ed
---
 gpt-utils/gpt-utils.cpp | 14 +++++++-------
 gpt-utils/gpt-utils.h   |  4 +++-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/gpt-utils/gpt-utils.cpp b/gpt-utils/gpt-utils.cpp
index 7c3a9bb..d8d97b2 100644
--- a/gpt-utils/gpt-utils.cpp
+++ b/gpt-utils/gpt-utils.cpp
@@ -239,11 +239,11 @@ static int gpt_boot_chain_swap(const uint8_t *pentries_start,
         uint8_t *ptn_entry;
         uint8_t *ptn_bak_entry;
         uint8_t ptn_swap[PTN_ENTRY_SIZE];
-        //Skip the xbl partition on UFS devices. That is handled
+        //Skip the xbl, multiimgoem, multiimgqti partitions on UFS devices. That is handled
         //seperately.
-        if (gpt_utils_is_ufs_device() && !strncmp(ptn_swap_list[i],
-                                PTN_XBL,
-                                strlen(PTN_XBL)))
+        if ((gpt_utils_is_ufs_device() && !strncmp(ptn_swap_list[i],PTN_XBL,strlen(PTN_XBL)))
+            || !strncmp(ptn_swap_list[i],PTN_MULTIIMGOEM,strlen(PTN_MULTIIMGOEM))
+            || !strncmp(ptn_swap_list[i],PTN_MULTIIMGQTI,strlen(PTN_MULTIIMGQTI)))
             continue;
 
         ptn_entry = gpt_pentry_seek(ptn_swap_list[i], pentries_start,
@@ -970,9 +970,9 @@ int prepare_boot_update(enum boot_update_stage stage)
                         //of being loaded based on well known GUID'S.
                         //We take care of switching the UFS boot LUN
                         //explicitly later on.
-                        if (!strncmp(ptn_swap_list[i],
-                                                PTN_XBL,
-                                                strlen(PTN_XBL)))
+                        if (!strncmp(ptn_swap_list[i],PTN_XBL,strlen(PTN_XBL))
+                            || !strncmp(ptn_swap_list[i],PTN_MULTIIMGOEM,strlen(PTN_MULTIIMGOEM))
+                            || !strncmp(ptn_swap_list[i],PTN_MULTIIMGQTI,strlen(PTN_MULTIIMGQTI)))
                                 continue;
                         snprintf(buf, sizeof(buf),
                                         "%s/%sbak",
diff --git a/gpt-utils/gpt-utils.h b/gpt-utils/gpt-utils.h
index aea9860..3872663 100644
--- a/gpt-utils/gpt-utils.h
+++ b/gpt-utils/gpt-utils.h
@@ -80,7 +80,9 @@ extern "C" {
 #define AB_SLOT_B_SUFFIX                "_b"
 #define PTN_XBL                         "xbl"
 #define PTN_XBL_CFG                     "xbl_config"
-#define PTN_SWAP_LIST                   PTN_XBL, PTN_XBL_CFG, "sbl1", "rpm", "tz", "aboot", "abl", "hyp", "lksecapp", "keymaster", "cmnlib", "cmnlib32", "cmnlib64", "pmic", "apdp", "devcfg", "hosd", "keystore", "msadp", "mdtp", "mdtpsecapp", "dsp", "aop", "qupfw", "vbmeta", "dtbo", "imagefv", "ImageFv", "multiimgoem", "multiimgqti", "uefisecapp", "vm-bootsys", "shrm", "cpucp", "featenabler", "vbmeta_system"
+#define PTN_MULTIIMGOEM                 "multiimgoem"
+#define PTN_MULTIIMGQTI                 "multiimgqti"
+#define PTN_SWAP_LIST                   PTN_XBL, PTN_XBL_CFG, PTN_MULTIIMGOEM, PTN_MULTIIMGQTI, "sbl1", "rpm", "tz", "aboot", "abl", "hyp", "lksecapp", "keymaster", "cmnlib", "cmnlib32", "cmnlib64", "pmic", "apdp", "devcfg", "hosd", "keystore", "msadp", "mdtp", "mdtpsecapp", "dsp", "aop", "qupfw", "vbmeta", "dtbo", "imagefv", "ImageFv", "uefisecapp", "vm-bootsys", "shrm", "cpucp", "featenabler", "vbmeta_system"
 #define AB_PTN_LIST PTN_SWAP_LIST, "boot", "vendor_boot", "system", "system_ext", "product", "vendor", "odm", "modem", "bluetooth"
 #define BOOT_DEV_DIR    "/dev/block/bootdevice/by-name"
 
-- 
GitLab