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-22 23:34:40 +0100 |
| commit | fe87efd92011883cdf2e7fca40f8d1120de7f4ec (patch) | |
| tree | 2b6cc4804b286a6b89d57ea25fd5964f5061ba58 | |
| parent | 99d2fe86386096504ca82853dd54757729f9b3d8 (diff) | |
| download | poky-fe87efd92011883cdf2e7fca40f8d1120de7f4ec.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: 16bad6260a6a25b2ec25c7eb0dfe526db56f166e)
Signed-off-by: Christophe Guibout <christophe.guibout@st.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 88b8b94bd2d052bca29d27bd5cd00eddb0f5999d)
Signed-off-by: Steve Sakoman <steve@sakoman.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 |
