PEL: set pdbg environment variable
pdbg needs PDBG_DTB environment variable initialisation
prior to pdbg init to set correct device tree back-end.
Tested: After software update with this change verified
that pdbg is using BMC initialised DEVTREE.
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
Change-Id: I6a59a79ccd9ae1f7d5947df0905e4ba999f835ec
diff --git a/extensions/openpower-pels/entry_points.cpp b/extensions/openpower-pels/entry_points.cpp
index 3a990f8..06c2ef8 100644
--- a/extensions/openpower-pels/entry_points.cpp
+++ b/extensions/openpower-pels/entry_points.cpp
@@ -20,6 +20,8 @@
#include "manager.hpp"
#include "pldm_interface.hpp"
+#include <fmt/format.h>
+
#include <phosphor-logging/log.hpp>
#ifdef SBE_FFDC_SUPPORTED
@@ -60,6 +62,19 @@
#endif
#ifdef SBE_FFDC_SUPPORTED
+ // PDBG_DTB environment variable set to CEC device tree path
+ static constexpr auto PDBG_DTB_PATH =
+ "/var/lib/phosphor-software-manager/pnor/rw/DEVTREE";
+
+ if (setenv("PDBG_DTB", PDBG_DTB_PATH, 1))
+ {
+ // Log message and continue,
+ // This is to help continue creating PEL in raw format.
+ log<level::ERR>(
+ fmt::format("Failed to set PDBG_DTB: ({})", strerror(errno))
+ .c_str());
+ }
+
if (!pdbg_targets_init(NULL))
{
log<level::ERR>("pdbg_targets_init failed");