diff --git a/meta-facebook/meta-fuji/recipes-utils/openbmc-utils/files/wedge_us_mac.sh b/meta-facebook/meta-fuji/recipes-utils/openbmc-utils/files/wedge_us_mac.sh new file mode 100644 index 000000000000..3e34cb005324 --- /dev/null +++ b/meta-facebook/meta-fuji/recipes-utils/openbmc-utils/files/wedge_us_mac.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright 2020-present Facebook. All Rights Reserved. +# +# This program file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +# Get output from bic-util +bic_output=$(bic-util scm --read_mac) + +# Check if the read was successful and output matches with our format +match=$(echo "$bic_output" | grep -c 'MAC address: [0-9a-f][0-9a-f]:') +if [ "$match" = "1" ]; then + # Mac address: xx:xx:xx:xx:xx:xx + echo "$bic_output" | cut -d ' ' -f 3 + exit 0 +else + echo "Cannot find out the microserver MAC" 1>&2 + exit 1 +fi + diff --git a/meta-facebook/meta-fuji/recipes-utils/openbmc-utils/openbmc-utils_%.bbappend b/meta-facebook/meta-fuji/recipes-utils/openbmc-utils/openbmc-utils_%.bbappend index 52313269d5c1..20527c3f743d 100644 --- a/meta-facebook/meta-fuji/recipes-utils/openbmc-utils/openbmc-utils_%.bbappend +++ b/meta-facebook/meta-fuji/recipes-utils/openbmc-utils/openbmc-utils_%.bbappend @@ -41,6 +41,7 @@ SRC_URI += "file://setup-gpio.sh \ file://dump_pim_serials.sh \ file://switch_pim_mux_to_fpga.sh \ file://reinit_all_pim.sh \ + file://wedge_us_mac.sh \ " OPENBMC_UTILS_FILES += " \ @@ -64,6 +65,7 @@ OPENBMC_UTILS_FILES += " \ dump_pim_serials.sh \ switch_pim_mux_to_fpga.sh \ reinit_all_pim.sh \ + wedge_us_mac.sh \ " DEPENDS_append = " update-rc.d-native"