summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/common/recipes-phosphor/flash
diff options
context:
space:
mode:
authorEdward A. James <eajames@us.ibm.com>2017-11-09 16:03:14 -0600
committerAndrew Geissler <geissonator@yahoo.com>2017-11-28 13:49:42 +0000
commitc03b9c4a5d5f8e089297d8d4c13540d6b2c9421f (patch)
tree9ac113538f9b8edf3b576540c0415994c37c0aad /meta-phosphor/common/recipes-phosphor/flash
parent8053d428ff7f353463c25447de450056d441d5bd (diff)
downloadtalos-openbmc-c03b9c4a5d5f8e089297d8d4c13540d6b2c9421f.tar.gz
talos-openbmc-c03b9c4a5d5f8e089297d8d4c13540d6b2c9421f.zip
init: Add init script to setup /etc mount before starting systemd
Systemd requires /etc mounted and ready at init time. Previously, we were mounting /etc as an overlay from the persistant filesystem after systemd started. This caused a variety of issues with systemd and associated applications (journal, etc). This change also adds factory reset functionality. Resolves openbmc/openbmc#2542 Change-Id: Ib8a38e99df39f833026fe4475670a7ec2b9c8d4d Signed-off-by: Edward A. James <eajames@us.ibm.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor/flash')
-rw-r--r--meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb1
-rw-r--r--meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc26
-rw-r--r--meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-reset.service9
3 files changed, 10 insertions, 26 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb
index b18002230..ed8de0b33 100644
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb
+++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb
@@ -79,7 +79,6 @@ SYSTEMD_SERVICE_${PN}-updater += " \
reboot-guard-enable.service \
reboot-guard-disable.service \
obmc-flash-bmc-cleanup.service \
- obmc-flash-bmc-reset.service \
"
# Name of the mtd device where the ubi volumes should be created
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 1a206604b..40ec06824 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
@@ -59,6 +59,14 @@ findname() {
echo "${n}"
}
+# Set the u-boot env command that performs the factory reset if requested
+set_do_rwreset() {
+ if ! fw_printenv do_rwreset; then
+ fw_setenv do_rwreset "if test \"\${rwreset}\" = \"true\"; then ubi remove rwfs; ubi create rwfs 0x400000; fi"
+ fw_setenv obmc_bootcmd "ubi part obmc-ubi; run do_rwreset; ubi read \${loadaddr} \${kernelname}; bootm \${loadaddr}"
+ fi
+}
+
# Make space on flash before creating new volumes. This can be enhanced
# determine current flash usage. For now only keep a "keepmax" number of them
ubi_remove_volumes()
@@ -239,6 +247,8 @@ remount_ubi() {
fi
done
done
+
+ set_do_rwreset
}
# Read the current env variable and set it on the alternate boot env
@@ -323,19 +333,6 @@ create_vol_in_alt() {
fi
}
-factory_reset() {
- # A lock file for printenv exists on /var, which isn't mounted when this
- # function is called. We have to read the rwreset variable out of file.
- ubootmtd="$(findmtd "u-boot-env")"
- grep -q -x "rwreset=true" /dev/$ubootmtd
- if [ "$?" = "0" ]; then
- ubi_remove "rwfs"
- reqmtd="bmc"
- name="rwfs"
- ubi_rw
- fi
-}
-
case "$1" in
mtduboot)
reqmtd="$2"
@@ -396,9 +393,6 @@ case "$1" in
rebootguarddisable)
rebootguarddisable
;;
- reset)
- factory_reset
- ;;
*)
echo "Invalid argument"
exit 1
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-reset.service b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-reset.service
deleted file mode 100644
index 38dc60e0f..000000000
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-reset.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Factory reset BMC if reset enabled
-DefaultDependencies=no
-
-[Service]
-Type=oneshot
-RemainAfterExit=no
-ExecStart=/usr/bin/env obmc-flash-bmc reset
-SyslogIdentifier=obmc-flash-bmc
OpenPOWER on IntegriCloud