diff options
author | Thang Q. Nguyen <thang@os.amperecomputing.com> | 2021-11-04 11:30:27 +0300 |
---|---|---|
committer | Thang Q. Nguyen <thang@os.amperecomputing.com> | 2021-11-04 16:10:58 +0300 |
commit | dde1fede1f832f029742a1d27290cfe252ab1bc5 (patch) | |
tree | d8e4bbb3ee309dbcc4324a98682bbf444bbe8ca2 /meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils | |
parent | 5a5f33c729e6b5869362172b63595422eb84a418 (diff) | |
download | openbmc-dde1fede1f832f029742a1d27290cfe252ab1bc5.tar.xz |
meta-ampere: fix shellcheck issues
Fix all issues from the shellcheck checked on bash shells under
meta-ampere.
Tested: Verify the following features:
1. Power control (on,off, cycle, graceful shutdown, hard reset).
2. UART switching.
3. UEFI firmware update.
Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: Idabf839b7521ecadb642230cc8bb3472c787002e
Diffstat (limited to 'meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils')
-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 |