[Skiboot] [PATCH] skiboot.tcl: set the kernel cmdline from env vars

Oliver O'Halloran oohall at gmail.com
Fri Jun 24 15:59:49 AEST 2016

Allows the user to set the kernel command line arguments from the
environmental variables SKIBOOT_BOOTARGS and SKIBOOT_APPEND when using
mambo with skiboot.tcl. Setting BOOTARGS will override the existing
command line set by scripts, etc while APPEND will append to any existing

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
 external/mambo/skiboot.tcl | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
index 5c2c2ce21a2a..fb88b7b387d1 100644
--- a/external/mambo/skiboot.tcl
+++ b/external/mambo/skiboot.tcl
@@ -167,9 +167,10 @@ lappend compat "ibm,power8-xscom"
 set compat [of::encode_compat $compat]
 mysim of addprop $xscom_node byte_array "compatible" $compat
+set chosen_node [mysim of find_device /chosen]
 if { [info exists env(SKIBOOT_INITRD)] } {
     set cpio_file $env(SKIBOOT_INITRD)
-    set chosen_node [mysim of find_device /chosen]
     set cpio_size [file size $cpio_file]
     set cpio_start 0x80000000
     set cpio_end [expr $cpio_start + $cpio_size]
@@ -207,6 +208,17 @@ mysim memory fread $mconf(boot_load) $boot_size $mconf(boot_image)
 set payload_size [file size $mconf(payload)]
 mysim memory fread $mconf(payload_addr) $payload_size $mconf(payload)
+# apply command line argument fixups just before we flatten the DT.
+if { [info exists env(SKIBOOT_APPEND) ] } {
+	set args [mysim of getprop $chosen_node "bootargs"]
+	set extra_args $env(SKIBOOT_APPEND)
+	mysim of addprop $chosen_node string "bootargs" "$args $extra_args"
+if { [info exists env(SKIBOOT_BOOTARGS) ] } {
+	mysim of addprop $chosen_node string "bootargs" $env(SKIBOOT_BOOTARGS)
 # Flatten it
 epapr::of2dtb mysim $mconf(epapr_dt_addr)

More information about the Skiboot mailing list