summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/common/recipes-phosphor/flash
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2017-08-22 14:18:39 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-08-28 16:58:03 +0000
commitbaf8452e08a9871218e92d878051c48d090e775b (patch)
tree199a4ea064883674388e9afa1a1840c513cd97a4 /meta-phosphor/common/recipes-phosphor/flash
parent71af5d6bb167260f585cf89704e2de128f1c2da6 (diff)
downloadtalos-openbmc-baf8452e08a9871218e92d878051c48d090e775b.tar.gz
talos-openbmc-baf8452e08a9871218e92d878051c48d090e775b.zip
obmc-flash-bmc: Set boot env variables with info of new image
When an image is updated, update the env variables to indicate u-boot and kernel the ubi information to find the new image. Store their current values to the alternate env variable before updating in case the there chips switch due to a failure, there is a pointer to an existing version. Update the env variable if the volume was succesfully updated, create the ubiblock after the successful volume update. Change-Id: Ia6e3eb133a6535b5de6ecbba4af262c63f2dc140 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor/flash')
-rw-r--r--meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc29
1 files changed, 26 insertions, 3 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
index 4be758584..c6879cf79 100644
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
+++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
@@ -76,7 +76,15 @@ ubi_block() {
block="/dev/ubiblock${ubidevid}"
if [ ! -e "$block" ]; then
ubiblock --create "/dev/ubi${ubidevid}"
+ if [ $? != 0 ]; then
+ echo "Unable to create ubiblock ${name}:${ubidevid}"
+ return 1
+ fi
fi
+ copy_env_var_to_alt ubiblock
+ ubi_setenv "ubiblock=$(echo "${ubidevid}" | sed 's/_/,/')"
+ copy_env_var_to_alt root
+ ubi_setenv "root=${block}"
}
ubi_updatevol() {
@@ -84,6 +92,14 @@ ubi_updatevol() {
ubidevid="${vol#ubi}"
img="/tmp/images/${version}/${imgfile}"
ubiupdatevol "/dev/ubi${ubidevid}" "${img}"
+ if [ $? != 0 ]; then
+ echo "Unable to update volume ${name}!"
+ return 1
+ fi
+ if [[ "${name}" =~ "kernel" ]]; then
+ copy_env_var_to_alt kernelname
+ ubi_setenv "kernelname=${name}"
+ fi
}
ubi_remove() {
@@ -139,7 +155,15 @@ remount_ubi() {
done
}
+# Read the current env variable and set it on the alternate boot env
+copy_env_var_to_alt() {
+ varName=$1
+ value="$(fw_printenv -n "${varName}")"
+ fw_setenv -c /etc/alt_fw_env.config "${varName}" "${value}"
+}
+
ubi_setenv() {
+ variable=$1
varName="${variable%=*}"
value="${variable##*=}"
fw_setenv "$varName" "$value"
@@ -171,8 +195,8 @@ case "$1" in
imgfile="image-rofs"
imgsize="16MiB"
ubi_ro
- ubi_block
ubi_updatevol
+ ubi_block
;;
ubikernel)
reqmtd="$(echo "$2" | cut -d "+" -f 1)"
@@ -189,8 +213,7 @@ case "$1" in
ubi_remove
;;
ubisetenv)
- variable="$2"
- ubi_setenv
+ ubi_setenv "$2"
;;
ubiremount)
remount_ubi
OpenPOWER on IntegriCloud