]> code.ossystems Code Review - openembedded-core.git/commitdiff
initramfs-framework: support kernel cmdline with double quotes
authorChristophe GUIBOUT <christophe.guibout@st.com>
Thu, 10 Sep 2020 14:06:31 +0000 (14:06 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 11 Sep 2020 17:05:17 +0000 (18:05 +0100)
It avoids init to crash when kernel cmdline contains a string with
spaces inside, like that:
dyndbg="file drivers/usb/core/hub.c +pltf"

Signed-off-by: Christophe Guibout <christophe.guibout@st.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/initrdscripts/initramfs-framework/init

index c71ce0ce8ccef079168019f64a69e4ac0d60af86..567694aff71c99b5942148c6a4178543a44990af 100755 (executable)
@@ -88,12 +88,25 @@ fi
 
 # populate bootparam environment
 for p in `cat /proc/cmdline`; do
+       if [ -n "$quoted" ]; then
+               value="$value $p"
+               if [ "`echo $p | sed -e 's/\"$//'`" != "$p" ]; then
+                       eval "bootparam_${quoted}=${value}"
+                       unset quoted
+               fi
+               continue
+       fi
+
        opt=`echo $p | cut -d'=' -f1`
        opt=`echo $opt | sed -e 'y/.-/__/'`
        if [ "`echo $p | cut -d'=' -f1`" = "$p" ]; then
                eval "bootparam_${opt}=true"
        else
                value="`echo $p | cut -d'=' -f2-`"
+               if [ "`echo $value | sed -e 's/^\"//'`" != "$value" ]; then
+                       quoted=${opt}
+                       continue
+               fi
                eval "bootparam_${opt}=\"${value}\""
        fi
 done