diff mbox

skiboot.tcl: set the kernel cmdline from env vars

Message ID 1466747989-19312-1-git-send-email-oohall@gmail.com
State Changes Requested
Headers show

Commit Message

Oliver O'Halloran June 24, 2016, 5:59 a.m. UTC
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
arguments.

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

Comments

Stewart Smith June 27, 2016, 6:17 a.m. UTC | #1
Oliver O'Halloran <oohall@gmail.com> writes:
> 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
> arguments.
>
> Signed-off-by: Oliver O'Halloran <oohall@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"
> +}

Just for consistency sake, i'd prefer SKIBOOT_BOOTARGS_APPEND

> +
> +if { [info exists env(SKIBOOT_BOOTARGS) ] } {
> +	mysim of addprop $chosen_node string "bootargs" $env(SKIBOOT_BOOTARGS)
> +}

Shouldn't this be before the append logic?
diff mbox

Patch

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)