diff options
author | Jason M. Bills <jason.m.bills@intel.com> | 2022-01-06 23:59:39 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@intel.com> | 2022-01-06 23:59:39 +0300 |
commit | 32777eec25d2c527a62e5ffab90a3dfef35855aa (patch) | |
tree | 588a90a6fe9fb0b35c7ce23ea3bd79fa5151ccde /meta-facebook/recipes-phosphor/flash/phosphor-software-manager/bios-update.sh | |
parent | 61f1ca1b31a9a1108e9e7f71e47fdc19beb0490b (diff) | |
parent | 5cc2f81c5b66da00cad24e18b0d23442af060c3f (diff) | |
download | openbmc-32777eec25d2c527a62e5ffab90a3dfef35855aa.tar.xz |
Merge tag '0.86' of firmware.bmc.openbmc.yocto.openbmc into update
Diffstat (limited to 'meta-facebook/recipes-phosphor/flash/phosphor-software-manager/bios-update.sh')
-rwxr-xr-x | meta-facebook/recipes-phosphor/flash/phosphor-software-manager/bios-update.sh | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/meta-facebook/recipes-phosphor/flash/phosphor-software-manager/bios-update.sh b/meta-facebook/recipes-phosphor/flash/phosphor-software-manager/bios-update.sh index fd1c52b2a..4b99f0be4 100755 --- a/meta-facebook/recipes-phosphor/flash/phosphor-software-manager/bios-update.sh +++ b/meta-facebook/recipes-phosphor/flash/phosphor-software-manager/bios-update.sh @@ -20,16 +20,16 @@ set_gpio_to_bmc() echo "switch bios GPIO to bmc" if [ ! -d /sys/class/gpio/gpio$GPIO ]; then cd /sys/class/gpio - echo $GPIO > export + echo $GPIO > "export" cd gpio$GPIO else cd /sys/class/gpio/gpio$GPIO fi - direc=`cat direction` - if [ $direc == "in" ]; then + direc=$(cat direction) + if [ "$direc" == "in" ]; then echo "out" > direction fi - data=`cat value` + data=$(cat value) if [ "$data" == "0" ]; then echo 1 > value fi @@ -41,16 +41,16 @@ set_gpio_to_pch() echo "switch bios GPIO to pch" if [ ! -d /sys/class/gpio/gpio$GPIO ]; then cd /sys/class/gpio - echo $GPIO > export + echo $GPIO > "export" cd gpio$GPIO else cd /sys/class/gpio/gpio$GPIO fi - direc=`cat direction` - if [ $direc == "in" ]; then + direc=$(cat direction) + if [ "$direc" == "in" ]; then echo "out" > direction fi - data=`cat value` + data=$(cat value) if [ "$data" == "1" ]; then echo 0 > value fi @@ -65,17 +65,18 @@ echo "Bios upgrade started at $(date)" echo "Power off host server" $POWER_CMD off sleep 15 -if [ $($POWER_CMD status) != "off" ]; +if [ "$($POWER_CMD status)" != "off" ]; then echo "Host server didn't power off" echo "Bios upgrade failed" - exit -1 + exit 1 fi echo "Host server powered off" #Set ME to recovery mode echo "Set ME to recovery mode" -busctl call $IPMB_OBJ $IPMB_PATH $IPMB_INTF $IPMB_CALL $ME_CMD_RECOVER +# shellcheck disable=SC2086 +busctl call "$IPMB_OBJ" "$IPMB_PATH" "$IPMB_INTF" $IPMB_CALL $ME_CMD_RECOVER sleep 5 #Flip GPIO to access SPI flash used by host. @@ -93,11 +94,10 @@ then echo "Bios image is $IMAGE_FILE" for d in mtd6 mtd7 ; do if [ -e "/dev/$d" ]; then - mtd=`cat /sys/class/mtd/$d/name` - if [ $mtd == "pnor" ]; then + mtd=$(cat /sys/class/mtd/$d/name) + if [ "$mtd" == "pnor" ]; then echo "Flashing bios image to $d..." - flashcp -v $IMAGE_FILE /dev/$d - if [ $? -eq 0 ]; then + if flashcp -v "$IMAGE_FILE" /dev/$d; then echo "bios updated successfully..." else echo "bios update failed..." @@ -125,7 +125,8 @@ sleep 5 #Reset ME to boot from new bios echo "Reset ME to boot from new bios" -busctl call $IPMB_OBJ $IPMB_PATH $IPMB_INTF $IPMB_CALL $ME_CMD_RESET +# shellcheck disable=SC2086 +busctl call "$IPMB_OBJ" "$IPMB_PATH" "$IPMB_INTF" $IPMB_CALL $ME_CMD_RESET sleep 10 #Power on server @@ -134,7 +135,7 @@ $POWER_CMD on sleep 5 # Retry to power on once again if server didn't powered on -if [ $($POWER_CMD status) != "on" ]; +if [ "$($POWER_CMD status)" != "on" ]; then sleep 5 echo "Powering on server again" |