diff mbox

mambo: Get the zImage from an environment variable

Message ID 1418604778-11081-1-git-send-email-mpe@ellerman.id.au
State Accepted
Headers show

Commit Message

Michael Ellerman Dec. 15, 2014, 12:52 a.m. UTC
Rather than hard coding /tmp/zImage.epapr, get the zImage from an environment
variable.

This is a) cleaner, and b) allows running multiple copies of the
simulator against different kernels simultaneously.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 external/mambo/skiboot.tcl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Benjamin Herrenschmidt Dec. 15, 2014, 1:40 a.m. UTC | #1
On Mon, 2014-12-15 at 11:52 +1100, Michael Ellerman wrote:
> Rather than hard coding /tmp/zImage.epapr, get the zImage from an environment
> variable.
> 
> This is a) cleaner, and b) allows running multiple copies of the
> simulator against different kernels simultaneously.

This is already what mconfig is about... ie, just set "PAYLOAD",
the /tmp one is just a fallback.

(Or did I screw something up and it doesn't work ?)

Cheers,
Ben.

> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>  external/mambo/skiboot.tcl | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
> index cc1fc362930d..4993d1857155 100644
> --- a/external/mambo/skiboot.tcl
> +++ b/external/mambo/skiboot.tcl
> @@ -25,7 +25,10 @@ mconfig boot_load MAMBO_BOOT_LOAD 0
>  mconfig boot_pc	MAMBO_BOOT_PC 0x10
>  
>  # Payload: Allow for a Linux style ramdisk/initrd
> -mconfig payload PAYLOAD /tmp/zImage.epapr
> +if { ![info exists env(SKIBOOT_ZIMAGE)] } {
> +	error "Please set SKIBOOT_ZIMAGE to the path of your zImage.epapr"
> +}
> +mconfig payload PAYLOAD $env(SKIBOOT_ZIMAGE)
>  
>  # Paylod: Memory location for a Linux style ramdisk/initrd
>  mconfig payload_addr PAYLOAD_ADDR 0x20000000;
Michael Ellerman Dec. 15, 2014, 2:01 a.m. UTC | #2
On Mon, 2014-12-15 at 12:40 +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2014-12-15 at 11:52 +1100, Michael Ellerman wrote:
> > Rather than hard coding /tmp/zImage.epapr, get the zImage from an environment
> > variable.
> > 
> > This is a) cleaner, and b) allows running multiple copies of the
> > simulator against different kernels simultaneously.
> 
> This is already what mconfig is about... ie, just set "PAYLOAD",
> the /tmp one is just a fallback.
> 
> (Or did I screw something up and it doesn't work ?)

No I have tunnel vision. I even copied the mconfig code :)

#ignore

cheers
Stewart Smith Dec. 15, 2014, 3:11 a.m. UTC | #3
Michael Ellerman <mpe@ellerman.id.au> writes:

> On Mon, 2014-12-15 at 12:40 +1100, Benjamin Herrenschmidt wrote:
>> On Mon, 2014-12-15 at 11:52 +1100, Michael Ellerman wrote:
>> > Rather than hard coding /tmp/zImage.epapr, get the zImage from an environment
>> > variable.
>> > 
>> > This is a) cleaner, and b) allows running multiple copies of the
>> > simulator against different kernels simultaneously.
>> 
>> This is already what mconfig is about... ie, just set "PAYLOAD",
>> the /tmp one is just a fallback.
>> 
>> (Or did I screw something up and it doesn't work ?)
>
> No I have tunnel vision. I even copied the mconfig code :)
>
> #ignore
>
> cheers

I liked not grabbing something in /tmp though... so merged it for that
reason. (also useful because I want to use it in a test)
diff mbox

Patch

diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
index cc1fc362930d..4993d1857155 100644
--- a/external/mambo/skiboot.tcl
+++ b/external/mambo/skiboot.tcl
@@ -25,7 +25,10 @@  mconfig boot_load MAMBO_BOOT_LOAD 0
 mconfig boot_pc	MAMBO_BOOT_PC 0x10
 
 # Payload: Allow for a Linux style ramdisk/initrd
-mconfig payload PAYLOAD /tmp/zImage.epapr
+if { ![info exists env(SKIBOOT_ZIMAGE)] } {
+	error "Please set SKIBOOT_ZIMAGE to the path of your zImage.epapr"
+}
+mconfig payload PAYLOAD $env(SKIBOOT_ZIMAGE)
 
 # Paylod: Memory location for a Linux style ramdisk/initrd
 mconfig payload_addr PAYLOAD_ADDR 0x20000000;