From 6a64b362a166ac77a61f26f8c45e20db725fdcf4 Mon Sep 17 00:00:00 2001 From: Andrew Doran Date: Mon, 4 Dec 2023 10:31:25 -0800 Subject: [PATCH] detect meru as a BMC-lite platform Summary: We should automate this with platforms.json somehow but no time right now. Test Plan: Build & unit test: ``` 0 ~/local/openbmc/tools/flashy $ ./build.sh && ./build_dev.sh && go test ./... ok github.com/facebook/openbmc/tools/flashy (cached) ok github.com/facebook/openbmc/tools/flashy/checks_and_remediations/bletchley (cached) ? github.com/facebook/openbmc/tools/flashy/flash_procedure [no test files] ok github.com/facebook/openbmc/tools/flashy/checks_and_remediations/common (cached) ok github.com/facebook/openbmc/tools/flashy/checks_and_remediations/galaxy100 (cached) ok github.com/facebook/openbmc/tools/flashy/checks_and_remediations/wedge100 (cached) ok github.com/facebook/openbmc/tools/flashy/checks_and_remediations/yamp (cached) ? github.com/facebook/openbmc/tools/flashy/lib/logger [no test files] ? github.com/facebook/openbmc/tools/flashy/utilities [no test files] ? github.com/facebook/openbmc/tools/flashy/tests [no test files] ok github.com/facebook/openbmc/tools/flashy/install (cached) ok github.com/facebook/openbmc/tools/flashy/lib/fileutils (cached) ok github.com/facebook/openbmc/tools/flashy/lib/flash (cached) ok github.com/facebook/openbmc/tools/flashy/lib/flash/flashcp (cached) ok github.com/facebook/openbmc/tools/flashy/lib/flash/flashutils (cached) ok github.com/facebook/openbmc/tools/flashy/lib/flash/flashutils/devices (cached) ok github.com/facebook/openbmc/tools/flashy/lib/step (cached) ok github.com/facebook/openbmc/tools/flashy/lib/utils (cached) ok github.com/facebook/openbmc/tools/flashy/lib/validate (cached) ok github.com/facebook/openbmc/tools/flashy/lib/validate/image (cached) ok github.com/facebook/openbmc/tools/flashy/lib/validate/partition (cached) ``` Reviewed By: cjcon90 Differential Revision: D51814249 fbshipit-source-id: 45a3f7735178dd8aa5e44f3c5715e317b646d0a7 --- tools/flashy/lib/utils/system.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/flashy/lib/utils/system.go b/tools/flashy/lib/utils/system.go index 6cbcb89e20a2..54298ce78e4a 100644 --- a/tools/flashy/lib/utils/system.go +++ b/tools/flashy/lib/utils/system.go @@ -368,14 +368,19 @@ var IsLFOpenBMC = func() (bool) { // IsBMCLite check whether the system is running BMC-lite // For S368275. Make this beautiful later. var IsBMCLite = func() (bool) { - const magic = "fbdarwin" + magics := []string{"fbdarwin", "meru"} issueBuf, err := fileutils.ReadFile(etcIssueFilePath) if err != nil { return false } - return strings.Contains(string(issueBuf), magic) + for _, magic := range magics { + if strings.Contains(string(issueBuf), magic) { + return true; + } + } + return false } // CheckOtherFlasherRunning return an error if any other flashers are running.