summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilton D. Miller II <miltonm@us.ibm.com>2016-03-02 15:23:22 -0600
committerMilton D. Miller II <miltonm@us.ibm.com>2016-03-07 15:22:29 -0600
commitab6183645c4717e6cf58ca9ef89e9958ba804824 (patch)
tree006abc24adfdb5e9f5565f382221d24890e49a89
parent77be704ad77d34bf8682f342ddf7731c456c9e0e (diff)
downloadtalos-openbmc-ab6183645c4717e6cf58ca9ef89e9958ba804824.tar.gz
talos-openbmc-ab6183645c4717e6cf58ca9ef89e9958ba804824.zip
init: Look for options in u-boot environment
Look in the saved u-boot environment for init options in addition to the kernel command line. This allows setting options to run in the u-boot environment instead of setting bootargs. Look at specific variables but not the whole environment so that users can setup variable to run. Look at two variables so scripts can automatically clear one on successful boot as one-time options (defer that to the full filesystem). Instead of having the full fw_setenv / fw_getenv binaries which would overflow the existing space for the initramfs, just use the busybox strings command to extract the variables. The oldest variable might get a crc32 character or flag byte if redundant environment were configured for nand but that is not expected to be these user defined variables. [1] The environment consists of a crc32, a flag byte if a redundant environment is configured, then a series of var=value strings separated by NUL bytes. The flag byte is 1 (active) or 0 (obsolete) for NOR flash, or a counter 0-255 in nand, the flag byte cycles through 0-255. Signed-off-by: Milton Miller <miltonm@us.ibm.com>
-rw-r--r--meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
index 9aa2131d2..29c72cf29 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
@@ -44,6 +44,19 @@ probe_fs_type() {
echo ${fst:=jffs2}
}
+# This fw_get_env_var is a simple but slightly broken version of fw_printenv:
+# The u-boot environemnt starts with a crc32, followed by a flag byte
+# when a redundannt environment is configured, followed by var=value\0 sets.
+# The flag byte for nand is a 1 byte counter; for nor it is a 1 or 0 byte.
+# The crc and/or nand flag byte can contain printable characters and be
+# considered part of the first string and parsed as part of the variable
+# name. In addition a variable could have a "\n" embedded in it, this code
+# would split that variable. Ignore for now, the last set var is at the end.
+
+get_fw_env_var() {
+ strings /run/fw_env | sed -ne "s/^$1=//p"
+}
+
debug_takeover() {
echo "$@"
test -n "$@" && echo Enter password to try to manually fix.
@@ -107,6 +120,8 @@ update=/run/initramfs/update
if test ! -f $optfile
then
cat /proc/cmdline > $optfile
+ get_fw_env_var openbmcinit >> $optfile
+ get_fw_env_var openbmconce >> $optfile
fi
echo rofs = $rofs $rofst rwfs = $rwfs $rwfst
OpenPOWER on IntegriCloud