diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2017-05-26 21:35:24 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-05-31 17:00:31 +1000 |
commit | 1c705700ab3c370e8062516c842469f3f7857f2a (patch) | |
tree | 4dc55e1601a06b635d186640c4046985e2c2c8e7 /external/mambo | |
parent | 6cad88d794e3ddab91615d361e375f55c4efbc03 (diff) | |
download | skiboot-1c705700ab3c370e8062516c842469f3f7857f2a.zip skiboot-1c705700ab3c370e8062516c842469f3f7857f2a.tar.gz skiboot-1c705700ab3c370e8062516c842469f3f7857f2a.tar.bz2 |
mambo: Allow loading multiple CPIOs
Currently we have support for loading a single CPIO and telling Linux to
use it as the initrd. But the Linux code actually supports having
multiple CPIOs contiguously in memory, between initrd-start and end, and
will unpack them all in order. That is a really nice feature as it means
you can have a base CPIO with your root filesystem, and then tack on
others as you need for various tests etc.
So expand the logic to handle SKIBOOT_INITRD, and treat it as a comma
separated list of CPIOs to load. I chose comma as it's fairly rare in
filenames, but we could make it space, colon, whatever. Or we could add
a new environment variable entirely. The code also supports trimming
whitespace from the values, so you can have "cpio1, cpio2".
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external/mambo')
-rw-r--r-- | external/mambo/skiboot.tcl | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl index 1b74c9b..f4068fa 100644 --- a/external/mambo/skiboot.tcl +++ b/external/mambo/skiboot.tcl @@ -190,13 +190,19 @@ mysim of addprop $xscom_node byte_array "compatible" $compat set cpio_start 0x80000000 set cpio_end $cpio_start if { [info exists env(SKIBOOT_INITRD)] } { - set cpio_file $env(SKIBOOT_INITRD) + + set cpios [split $env(SKIBOOT_INITRD) ","] + + foreach cpio_file $cpios { + set cpio_file [string trim $cpio_file] + set cpio_size [file size $cpio_file] + mysim mcm 0 memory fread $cpio_end $cpio_size $cpio_file + set cpio_end [expr $cpio_end + $cpio_size] + } + set chosen_node [mysim of find_device /chosen] - set cpio_size [file size $cpio_file] - set cpio_end [expr $cpio_start + $cpio_size] mysim of addprop $chosen_node int "linux,initrd-start" $cpio_start mysim of addprop $chosen_node int "linux,initrd-end" $cpio_end - mysim mcm 0 memory fread $cpio_start $cpio_size $cpio_file } # Default NVRAM is blank and will be formatted by Skiboot if no file is provided |