diff options
author | Lei YU <mine260309@gmail.com> | 2018-07-20 10:11:27 +0300 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2018-08-20 09:28:24 +0300 |
commit | a08c9960fe35080ef918321baf745105886dae92 (patch) | |
tree | 2bb254a166dea196c0427f598ea0026578b2f9e1 /meta-phosphor/common/recipes-phosphor/initrdscripts | |
parent | 6f2e372ddf5272905c21921d1a82325d55537ac0 (diff) | |
download | openbmc-a08c9960fe35080ef918321baf745105886dae92.tar.xz |
obmc-init: Add factory reset support
In obmc-init.sh, there is "clean-rwfs-filesystem" that clean the rwfs
during boot, but it backs up the files in whitelist, so it is not a
*real* factory reset.
Add a new "factory-reset" option, and when it exists, erase the rwfs
without restoring files in whitelist.
Tested: Set openbmconce=factory-reset in u-boot env, and verify the rwfs
is erased during boot without restore;
Set openbmconce=clean-rwfs-filesystem in u-boot env, and verify
that rwfs is erased with whitelist restored.
Change-Id: Ifdc76da46fe273e9c942f30444173e51f8106fcc
Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor/initrdscripts')
-rw-r--r-- | meta-phosphor/common/recipes-phosphor/initrdscripts/files/obmc-init.sh | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/initrdscripts/files/obmc-init.sh b/meta-phosphor/common/recipes-phosphor/initrdscripts/files/obmc-init.sh index afa8ac1e3..305b2dd65 100644 --- a/meta-phosphor/common/recipes-phosphor/initrdscripts/files/obmc-init.sh +++ b/meta-phosphor/common/recipes-phosphor/initrdscripts/files/obmc-init.sh @@ -281,6 +281,15 @@ then touch $trigger fi +if grep -w factory-reset $optfile +then + echo "Factory reset requested." + touch $trigger + do_save=--no-save-files +else + do_save=--save-files +fi + if test "x$force_rwfst_jffs2" = xy -a $rwfst != jffs2 -a ! -f $trigger then echo "Converting read-write overlay filesystem to jffs2 forced." @@ -294,15 +303,20 @@ then debug_takeover "Flash update requested but $update missing!" elif test -f $trigger -a ! -s $trigger then - echo "Saving selected files from read-write overlay filesystem." - $update --no-restore-files + if [ $do_save = "--save-files" ] + then + echo "Saving selected files from read-write overlay filesystem." + else + echo "No files will be selected for save." + fi + $update --no-restore-files $do_save echo "Clearing read-write overlay filesystem." flash_eraseall /dev/$rwfs echo "Restoring saved files to read-write overlay filesystem." touch $trigger $update --no-save-files --clean-saved-files else - $update --clean-saved-files + $update --clean-saved-files $do_save fi rwfst=$(probe_fs_type $rwdev) |