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-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.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-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh')
-rwxr-xr-x | meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh b/meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh index 7a9ace30e..b7f4bc52e 100755 --- a/meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh +++ b/meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh @@ -18,7 +18,7 @@ do_flash () { OFFSET=$1 # Check the PNOR partition available - HOST_MTD=$(cat /proc/mtd | grep "pnor" | sed -n 's/^\(.*\):.*/\1/p') + HOST_MTD=$(< /proc/mtd grep "pnor" | sed -n 's/^\(.*\):.*/\1/p') if [ -z "$HOST_MTD" ]; then # If the PNOR partition is not available, then bind again driver @@ -26,7 +26,7 @@ do_flash () { echo 1e630000.spi > /sys/bus/platform/drivers/aspeed-smc/bind sleep 2 - HOST_MTD=$(cat /proc/mtd | grep "pnor" | sed -n 's/^\(.*\):.*/\1/p') + HOST_MTD=$(< /proc/mtd grep "pnor" | sed -n 's/^\(.*\):.*/\1/p') if [ -z "$HOST_MTD" ]; then echo "Fail to probe Host SPI-NOR device" @@ -35,18 +35,17 @@ do_flash () { fi echo "--- Flashing firmware to @/dev/$HOST_MTD offset=$OFFSET" - flashcp -v $IMAGE /dev/$HOST_MTD $OFFSET + flashcp -v "$IMAGE" /dev/"$HOST_MTD" "$OFFSET" } if [ $# -eq 0 ]; then - echo "Usage: $(basename $0) <BIOS image file>" + echo "Usage: $(basename "$0") <BIOS image file>" exit 0 fi IMAGE="$1" -if [ ! -f $IMAGE ]; then - echo $IMAGE +if [ ! -f "$IMAGE" ]; then echo "The image file $IMAGE does not exist" exit 1 fi @@ -70,9 +69,7 @@ fi # Switch the host SPI bus to BMC" echo "--- Switch the host SPI bus to BMC." -gpioset 0 226=0 - -if [[ $? -ne 0 ]]; then +if ! gpioset 0 226=0; then echo "ERROR: Switch the host SPI bus to BMC. Please check gpio state" exit 1 fi @@ -82,9 +79,7 @@ do_flash 0x400000 # Switch the host SPI bus to HOST." echo "--- Switch the host SPI bus to HOST." -gpioset 0 226=1 - -if [[ $? -ne 0 ]]; then +if ! gpioset 0 226=1; then echo "ERROR: Switch the host SPI bus to HOST. Please check gpio state" exit 1 fi |