63 lines
1.9 KiB
Diff
63 lines
1.9 KiB
Diff
|
|
From 925563a9f9ec895ffbc0c5db39f1d02258ceb1df Mon Sep 17 00:00:00 2001
|
||
|
|
From: roly <Rolyli.Li@luxshare-ict.com>
|
||
|
|
Date: Wed, 18 Dec 2024 13:59:12 +0800
|
||
|
|
Subject: [PATCH] Support webui switch bmc boot source
|
||
|
|
|
||
|
|
---
|
||
|
|
redfish-core/lib/managers.hpp | 31 ++++++++++++++++++++++++++++++-
|
||
|
|
1 file changed, 30 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
|
||
|
|
index 30395284..0680e38d 100644
|
||
|
|
--- a/redfish-core/lib/managers.hpp
|
||
|
|
+++ b/redfish-core/lib/managers.hpp
|
||
|
|
@@ -1739,6 +1739,8 @@ inline void
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
+#define MAIN_BMC_BOOT_SOURCE "/sys/devices/platform/ahb/1e620000.spi/access_primary"
|
||
|
|
+#define BACKUP_BMC_BOOT_SOURCE "/sys/devices/platform/ahb/1e620000.spi/access_backup"
|
||
|
|
/**
|
||
|
|
* @brief Set the running firmware image
|
||
|
|
*
|
||
|
|
@@ -1843,9 +1845,35 @@ inline void
|
||
|
|
messages::internalError(asyncResp->res);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
- doBMCGracefulRestart(asyncResp);
|
||
|
|
+ // doBMCGracefulRestart(asyncResp);
|
||
|
|
});
|
||
|
|
});
|
||
|
|
+
|
||
|
|
+ char cmd[256] = {0};
|
||
|
|
+ std::string currentSelector;
|
||
|
|
+ std::ifstream slotFile("/run/media/slot");
|
||
|
|
+ std::getline(slotFile, currentSelector);
|
||
|
|
+ if (currentSelector == "0")
|
||
|
|
+ {
|
||
|
|
+ memset(cmd, 0 , sizeof(cmd));
|
||
|
|
+ snprintf(cmd, sizeof(cmd), "echo 1 > %s", BACKUP_BMC_BOOT_SOURCE);
|
||
|
|
+ if(system(cmd))
|
||
|
|
+ {
|
||
|
|
+ BMCWEB_LOG_DEBUG("Set BMC boot from backup flash failed.");
|
||
|
|
+ return;
|
||
|
|
+ }
|
||
|
|
+ }
|
||
|
|
+ if (currentSelector == "1")
|
||
|
|
+ {
|
||
|
|
+ memset(cmd, 0 , sizeof(cmd));
|
||
|
|
+ snprintf(cmd, sizeof(cmd), "echo 1 > %s", MAIN_BMC_BOOT_SOURCE);
|
||
|
|
+ if(system(cmd))
|
||
|
|
+ {
|
||
|
|
+ BMCWEB_LOG_DEBUG("Set BMC boot from main flash failed.");
|
||
|
|
+ return;
|
||
|
|
+ }
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
}
|
||
|
|
|
||
|
|
inline void setDateTime(std::shared_ptr<bmcweb::AsyncResp> asyncResp,
|
||
|
|
--
|
||
|
|
2.25.1
|
||
|
|
|