diff options
author | Dave Cobbley <david.j.cobbley@linux.intel.com> | 2018-08-23 04:40:54 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-08-23 19:39:42 +0300 |
commit | 194ff4f1f5d44b12e9cb06ddafa6adb20174a13c (patch) | |
tree | 823835cd29daf8901a31ac14c7e6534abf199be3 /meta-mellanox/meta-msn/recipes-phosphor/initfs/files/obmc-update_all.sh | |
parent | 4feb727cd6b77a68bdaca63e121b378d814f5eaf (diff) | |
download | openbmc-194ff4f1f5d44b12e9cb06ddafa6adb20174a13c.tar.xz |
[Subtree] Bring openbmc machines to top level
The new subtree model brings the subtrees up from the openbmc-machines
layer.
Change-Id: I58a03ae1be374bc79ae1438e65e888375d12d0c0
Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-mellanox/meta-msn/recipes-phosphor/initfs/files/obmc-update_all.sh')
-rw-r--r-- | meta-mellanox/meta-msn/recipes-phosphor/initfs/files/obmc-update_all.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/meta-mellanox/meta-msn/recipes-phosphor/initfs/files/obmc-update_all.sh b/meta-mellanox/meta-msn/recipes-phosphor/initfs/files/obmc-update_all.sh new file mode 100644 index 000000000..fbcf466d6 --- /dev/null +++ b/meta-mellanox/meta-msn/recipes-phosphor/initfs/files/obmc-update_all.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# +# Script to burn entire 32MB of BMC SPI Flash +# +# Usage: +# a) Local: /run/initramfs/update_all <bmc-image-file> +# b) Remote: sshpass -p "<root-password>" ssh root@<ip> '/run/initramfs/update_all <bmc-image-file>' +# +# Assumptions: +# <bmc-image-file> is a 32MB file representing all partitions in BMC SPI Flash +# <bmc-image-file> exists on local filesystem +# /dev/mtd0 represents entire BMC SPI Flash device +# /dev/mtd5 is a JFFS2 filesystem (rwfs) partition +# /bsp/reset/bmc_upgrade is symlink pointing to proper sticky bit in CPLD +# + +if [ -f $1 ] +then + echo $0: Update BMC SPI Flash with $1 +else + echo $0: File $1 not found on target, exiting + exit +fi + +echo $0: Stopping system services +systemctl stop mlx_ipmid + +echo $0: Remounting rwfs "(/dev/mtd5)" as read-only +mount /dev/mtdblock5 /run/initramfs/rw -t jffs2 -o remount,ro + +echo $0: Unmounting rofs "(/dev/mtd4)" +umount /dev/mtdblock4 + +MAC=`fw_printenv ethaddr | sed -n "s/^ethaddr=//p"` + +echo $0: Burning SPI Flash "(/dev/mtd0)" with image "$1" +/usr/sbin/flashcp -v $1 /dev/mtd0 + +if [ -v $MAC ]; then + echo "MAC env variable not exist. Set eth0 MAC from eeprom." + MAC=`hexdump -n 6 -s 0xf0 -v -e '/1 "%02x:"' /sys/bus/i2c/devices/6-0055/eeprom`;MAC=${MAC::-1}; +else + echo "MAC env variable exist. Set eth0 MAC from env." +fi; +fw_setenv ethaddr $MAC + +echo $0: Setting bmc_upgrade sticky bit in CPLD +echo 1 > /bsp/reset/bmc_upgrade + +echo $0: Rebooting BMC +echo 0 > /bsp/reset/bmc_reset_soft + + + |