init: Read options from a file

Grep options from a file instead of directly from /proc/cmdline
which will allow additonal sources for options.

Initially the options file is just a copy of the kernel command
line, but it may be edited at debug-init-sh or via a later
debug_takeover point or before restarting init.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
diff --git a/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh b/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
index 12c5a2f..d3b4b9f 100644
--- a/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
+++ b/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
@@ -101,10 +101,16 @@
 fsckbase=/sbin/fsck.
 fsck=$fsckbase$rwfst
 fsckopts=-a
+optfile=/run/initramfs/init-options
+
+if test ! -f $optfile
+then
+	cat /proc/cmdline > $optfile
+fi
 
 echo rofs = $rofs $rofst   rwfs = $rwfs $rwfst
 
-if grep -w debug-init-sh /proc/cmdline
+if grep -w debug-init-sh $optfile
 then
 	debug_takeover "Debug initial shell requested by command line."
 fi
@@ -118,7 +124,7 @@
 	mv /${imagebasename}* ${image%$imagebasename}
 fi
 
-if grep -w clean-rwfs-filesystem /proc/cmdline
+if grep -w clean-rwfs-filesystem $optfile
 then
 	echo "Cleaning of read-write overlay filesystem requested."
 	touch $trigger