From: Christophe GUIBOUT <[email protected]>

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 <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
(cherry picked from commit 88b8b94bd2d052bca29d27bd5cd00eddb0f5999d)
Signed-off-by: Steve Sakoman <[email protected]>
---
 .../initrdscripts/initramfs-framework/init          | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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
 
 # 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
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#142658): 
https://lists.openembedded.org/g/openembedded-core/message/142658
Mute This Topic: https://lists.openembedded.org/mt/76933908/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to