From 194ff4f1f5d44b12e9cb06ddafa6adb20174a13c Mon Sep 17 00:00:00 2001 From: Dave Cobbley Date: Wed, 22 Aug 2018 21:40:54 -0400 Subject: [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 Signed-off-by: Brad Bishop --- .../recipes-phosphor/socupdate/files/socupdate.sh | 129 +++++++++++++++++++++ .../recipes-phosphor/socupdate/socupdate.bb | 13 +++ 2 files changed, 142 insertions(+) create mode 100644 meta-qualcomm/meta-centriq2400-rep/recipes-phosphor/socupdate/files/socupdate.sh create mode 100644 meta-qualcomm/meta-centriq2400-rep/recipes-phosphor/socupdate/socupdate.bb (limited to 'meta-qualcomm/meta-centriq2400-rep/recipes-phosphor/socupdate') diff --git a/meta-qualcomm/meta-centriq2400-rep/recipes-phosphor/socupdate/files/socupdate.sh b/meta-qualcomm/meta-centriq2400-rep/recipes-phosphor/socupdate/files/socupdate.sh new file mode 100644 index 000000000..67d706339 --- /dev/null +++ b/meta-qualcomm/meta-centriq2400-rep/recipes-phosphor/socupdate/files/socupdate.sh @@ -0,0 +1,129 @@ +#!/bin/sh -e +# SOC update tool, need two parameter(soc update file name and TFTP ip) + +if [ ! -n "$1" -o ! -n "$2" ] ;then + echo "Please enter SOC-ImageName and TFTP-IP." + echo "Format: socupdate.sh FileName IP" + echo "Example: socupdate.sh 0ACJAXXX.ROM 192.168.1.1" + exit +fi + +echo "SOC update start." + +echo "Check BMC status." +checkbmc='gpioutil -p Q4' +if $checkbmc = "1"; then + echo "BMC is ready." +else + echo "BMC isn't ready." + exit +fi + +echo "Check SOC image does it exist." +cd /tmp/ +FILEEXIST=0 +if [ -f "/tmp/$1" ]; then + GETFILE=`du -k $1 | awk '{print $1}'` + if [ "$GETFILE" -eq "65536" ]; then + FILEEXIST=1 + echo "SOC image is exist." + else + FILEEXIST=0 + fi +fi + +if [ $FILEEXIST -eq 0 ]; then + echo "Get SOC image from TFTP server." + echo "Please wait a few minutes." + tftp -g -r $1 $2 & + sleep 2 + LENGTH=0 + ERRCOUNT=0 + while true + do + echo -ne "\r[" + usleep 500000 + while [ $LENGTH -le 30 ] + do + usleep 500000 + echo -n ">" + LENGTH=$(($LENGTH+1)) + if [ -f "/tmp/$1" ]; then + GETFILE=`du -k $1 | awk '{print $1}'` + if [ $GETFILE -eq 65536 ]; then + echo -en "\r" + echo -en "--- Image download completed --- \n" + usleep 1000000 + break 2 + fi + else + ERRCOUNT=$(($ERRCOUNT+1)) + if [ $ERRCOUNT -le 10 ]; then + echo -en "\r" + echo -en "SOC-ImageName or TFTP-IP is ERROR. \n" + usleep 500000 + exit + fi + fi + done + echo -n "]" + LENGTH=0 + usleep 500000 + echo -en "\r " + done +fi +sleep 3 + +echo "Switch the host SPI bus to BMC." +cmd='gpioutil -p C7 -v 1' +if $cmd 1>/dev/null 2>&1; then + echo "Switch completed." +else + echo "Switch failed." +fi +echo "Load the ASpeed SMC driver" +echo 1e630000.flash-controller > /sys/bus/platform/drivers/aspeed-smc/bind +sleep 2 +chassisstate=$(obmcutil chassisstate | awk -F. '{print $NF}') +echo "---Current Chassisstate $chassisstate---" +if [ "$chassisstate" == 'On' ]; +then + echo "---Chassis on turning it off---" + obmcutil chassisoff + sleep 10 +fi + +echo "Flashcp to update SOC." +echo "Please wait a few minutes." +flashcp -v /tmp/$1 /dev/mtd6 +sleep 3 + +echo "Switch the host SPI bus to HOST." +cmd1='gpioutil -p C7 -v 0' +if $cmd1 1>/dev/null 2>&1; then + echo "Switch completed." +else + echo "Switch failed." +fi +echo "unLoad the ASpeed SMC driver" +echo 1e630000.flash-controller > /sys/bus/platform/drivers/aspeed-smc/unbind +echo -ne "SOC update steps is complete.\n" +if [ "$chassisstate" == 'On' ]; +then + echo "5 sec later will be power-on." + echo "If wantn't power-on, please CTRL + C leave script." + WAITSEC=5 + while [ $WAITSEC -ge 0 ] + do + echo -n "Countdown seconds:$WAITSEC" + sleep 1 + echo -en "\r" + WAITSEC=$(($WAITSEC-1)) + if [ $WAITSEC -eq 0 ]; then + echo -en "\r" + echo -en "--- Power-on --- \n" + obmcutil chassison + break 1 + fi + done +fi diff --git a/meta-qualcomm/meta-centriq2400-rep/recipes-phosphor/socupdate/socupdate.bb b/meta-qualcomm/meta-centriq2400-rep/recipes-phosphor/socupdate/socupdate.bb new file mode 100644 index 000000000..45f69d335 --- /dev/null +++ b/meta-qualcomm/meta-centriq2400-rep/recipes-phosphor/socupdate/socupdate.bb @@ -0,0 +1,13 @@ +SUMMARY = "Qualcomm SOC update" +DESCRIPTION = "" +HOMEPAGE = "" +PR = "r1" + +inherit obmc-phosphor-license + +SRC_URI += "file://socupdate.sh" + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/socupdate.sh ${D}${bindir}/socupdate.sh +} -- cgit v1.2.3