diff options
author | Christophe GUIBOUT <christophe.guibout@st.com> | 2020-09-10 14:06:31 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-09-12 14:49:00 +0100 |
commit | 909a9f5e8e6dd5c4587d42a83d849c77d88476d9 (patch) | |
tree | e6d11687805762e31225b96023d00a6eb91fba9a | |
parent | 33efd9351702e08a53e6512e235f947e4f9e914f (diff) | |
download | poky-909a9f5e8e6dd5c4587d42a83d849c77d88476d9.tar.gz |
initramfs-framework: support kernel cmdline with double quotes
It avoids init to crash when kernel cmdline contains a string with
spaces inside, like that:
dyndbg="file drivers/usb/core/hub.c +pltf"
(From OE-Core rev: 88b8b94bd2d052bca29d27bd5cd00eddb0f5999d)
Signed-off-by: Christophe Guibout <christophe.guibout@st.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | meta/recipes-core/initrdscripts/initramfs-framework/init | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/init b/meta/recipes-core/initrdscripts/initramfs-framework/init index c71ce0ce8c..567694aff7 100755 --- a/meta/recipes-core/initrdscripts/initramfs-framework/init +++ b/meta/recipes-core/initrdscripts/initramfs-framework/init | |||
@@ -88,12 +88,25 @@ fi | |||
88 | 88 | ||
89 | # populate bootparam environment | 89 | # populate bootparam environment |
90 | for p in `cat /proc/cmdline`; do | 90 | for p in `cat /proc/cmdline`; do |
91 | if [ -n "$quoted" ]; then | ||
92 | value="$value $p" | ||
93 | if [ "`echo $p | sed -e 's/\"$//'`" != "$p" ]; then | ||
94 | eval "bootparam_${quoted}=${value}" | ||
95 | unset quoted | ||
96 | fi | ||
97 | continue | ||
98 | fi | ||
99 | |||
91 | opt=`echo $p | cut -d'=' -f1` | 100 | opt=`echo $p | cut -d'=' -f1` |
92 | opt=`echo $opt | sed -e 'y/.-/__/'` | 101 | opt=`echo $opt | sed -e 'y/.-/__/'` |
93 | if [ "`echo $p | cut -d'=' -f1`" = "$p" ]; then | 102 | if [ "`echo $p | cut -d'=' -f1`" = "$p" ]; then |
94 | eval "bootparam_${opt}=true" | 103 | eval "bootparam_${opt}=true" |
95 | else | 104 | else |
96 | value="`echo $p | cut -d'=' -f2-`" | 105 | value="`echo $p | cut -d'=' -f2-`" |
106 | if [ "`echo $value | sed -e 's/^\"//'`" != "$value" ]; then | ||
107 | quoted=${opt} | ||
108 | continue | ||
109 | fi | ||
97 | eval "bootparam_${opt}=\"${value}\"" | 110 | eval "bootparam_${opt}=\"${value}\"" |
98 | fi | 111 | fi |
99 | done | 112 | done |