gbmc-release-23.18.x: Add hacks for NERF to go to UEFIboot
NERF and Nanny is not quite ready for us to put NERF into steady state.
Add a temporary workaround until the bundle is ready (~1 week). This
commit then can be reverted
Tested:
root@jicuh16-nfd01:~# touch /run/bm-ready.flag
root@jicuh16-nfd01:~# ls /run
agetty.reload credentials media sepermit
authorized_keys cryptsetup mount systemd
avahi-daemon dbus msvfud udev
bm-ready.flag initramfs network user
bmcweb ipmi nftables
cpld0.version lock phosphor-ipmi-flash
cpld1.version log rsyslog
root@jicuh16-nfd01:~# ipmitool raw 0x2e 0x32 0x79 0x2b 0x00 0x10
79 2b 00 10 01
root@jicuh16-nfd01:~# wget -qO- localhost/redfish/v1/Systems/system/
{
"@odata.id": "/redfish/v1/Systems/system",
"@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem",
...
...
"Model": "Izumi",
"Name": "system",
"Oem": {
"Google": {
"@odata.id": "redfish/v1/Systems/system#/Oem/Google",
"@odata.type": "#GoogleBareMetalCapabilities.v1_0_0.NERFMode",
"BareMetalStatus": {
"BareMetal": "BareMetalReady"
},
"NERFStatus": {
"NERF": "UEFIboot"
}
}
},
"PCIeDevices": [
{
...
...
}
root@jicuh16-nfd01:~# journalctl -b | grep "BM mode"
...
...
Aug 04 19:08:29 jicuh16-nfd01.prod.google.com ipmid[812]: /run/bm-ready.flag exists and no done/ack flag, we must be in BM mode (WORKAROUD)
root@jicuh16-nfd01:~# ipmitool raw 0x2e 0x32 0x79 0x2b 0x00 0x10
79 2b 00 10 01
root@jicuh16-nfd01:~# journalctl -b | grep "BM mode"
...
..
Aug 04 19:08:29 jicuh16-nfd01.prod.google.com ipmid[812]: /run/bm-ready.flag exists and no done/ack flag, we must be in BM mode (WORKAROUD)
Aug 04 19:10:13 jicuh16-nfd01.prod.google.com ipmid[812]: /run/bm-drive-cleaning-done-ack.flag exists so we acked cleaning done and must be in BM mode
Google-Bug-Id: 290979503
Change-Id: I21ddef7c4836dae1b87809f831966186324bfc8b
Signed-off-by: Brandon Kim <brandonkim@google.com>
diff --git a/recipes-google/ipmi/google-ipmi-sys/0001-handler-Add-workarounds-for-NERF-to-go-BM_MODE.patch b/recipes-google/ipmi/google-ipmi-sys/0001-handler-Add-workarounds-for-NERF-to-go-BM_MODE.patch
new file mode 100644
index 0000000..bd27d90
--- /dev/null
+++ b/recipes-google/ipmi/google-ipmi-sys/0001-handler-Add-workarounds-for-NERF-to-go-BM_MODE.patch
@@ -0,0 +1,49 @@
+From 1f1ace1531857c9e3bbc41d6a0eba58b9459561f Mon Sep 17 00:00:00 2001
+From: Brandon Kim <brandonkim@google.com>
+Date: Sat, 5 Aug 2023 01:07:08 +0000
+Subject: [PATCH] handler: Add workarounds for NERF to go BM_MODE
+
+This is required until we have a new Nanny and NERF image.
+
+Google-Bug-Id: 290979503
+Signed-off-by: Brandon Kim <brandonkim@google.com>
+Change-Id: I0e5a8340048362e610e235594b27e8450c6f28c1
+---
+ handler.cpp | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/handler.cpp b/handler.cpp
+index 4046871..3ae79ab 100644
+--- a/handler.cpp
++++ b/handler.cpp
+@@ -101,21 +101,23 @@ uint8_t isBmcInBareMetalMode()
+ return static_cast<uint8_t>(BmcMode::BM_MODE);
+ }
+
++ /// TODO(b/290979503): Remove below workarounds after new Nanny is deployed
+ if (fs::exists(BM_SIGNAL_PATH, ec))
+ {
+- if (!fs::exists(bmDriveCleaningFlagPath, ec))
++ if (!fs::exists(bmDriveCleaningDoneAckFlagPath, ec))
+ {
+ std::ofstream ofs;
+- ofs.open(bmDriveCleaningFlagPath, std::ofstream::out);
++ ofs.open(bmDriveCleaningDoneAckFlagPath, std::ofstream::out);
+ ofs.close();
+ }
+
+ std::fprintf(
+ stderr,
+- "%s exists and no done/ack flag, we must be in BM cleaning mode\n",
++ "%s exists and no done/ack flag, we must be in BM mode (WORKAROUD)\n",
+ BM_SIGNAL_PATH);
+- return static_cast<uint8_t>(BmcMode::BM_CLEANING_MODE);
++ return static_cast<uint8_t>(BmcMode::BM_MODE);
+ }
++ /// TODO(b/290979503): (Up to here)
+
+ std::fprintf(
+ stderr,
+--
+2.41.0.640.ga95def55d0-goog
+
diff --git a/recipes-google/ipmi/google-ipmi-sys_%.bbappend b/recipes-google/ipmi/google-ipmi-sys_%.bbappend
index 6a1bb98..76147de 100644
--- a/recipes-google/ipmi/google-ipmi-sys_%.bbappend
+++ b/recipes-google/ipmi/google-ipmi-sys_%.bbappend
@@ -1,2 +1,5 @@
FILESEXTRAPATHS:prepend:gbmc := "${THISDIR}/${PN}:"
-SRC_URI:append:gbmc = " file://0001-Add-flags-for-bmc-modes-transitions.patch"
+SRC_URI:append:gbmc = " \
+ file://0001-Add-flags-for-bmc-modes-transitions.patch \
+ file://0001-handler-Add-workarounds-for-NERF-to-go-BM_MODE.patch \
+"