[Skiboot] [PATCH 2/2] external/mambo: Error out if kernel is too large

Russell Currey ruscur at russell.cc
Mon Mar 25 15:29:29 AEDT 2019


If you're trying to boot a gigantic kernel in mambo (which you can
reproduce by building a kernel with CONFIG_MODULES=n) you'll get
misleading errors like:

WARNING: 0: (0): [0:0]: Invalid/unsupported instr 0x00000000[INVALID]
WARNING: 0: (0):  PC(EA): 0x0000000030000010 PC(RA):0x0000000030000010 MSR: 0x9000000000000000 LR: 0x0000000000000000
WARNING: 0: (0):  numInstructions = 0
WARNING: 1: (1): [0:0]: Invalid/unsupported instr 0x00000000[INVALID]
WARNING: 1: (1):  PC(EA): 0x0000000000000E40 PC(RA):0x0000000000000E40 MSR: 0x9000000000000000 LR: 0x0000000000000000
WARNING: 1: (1):  numInstructions = 1
WARNING: 1: (1): Interrupt to 0x0000000000000E40 from 0x0000000000000E40
INFO: 1: (2): ** Execution stopped: Continuous Interrupt, Instruction caused exception,  **

So add an error to skiboot.tcl to warn the user before this happens.
Making PAYLOAD_ADDR further back is one way to do this but if there's a
less gross way to generally work around this very niche problem, I can
suggest that instead.

Signed-off-by: Russell Currey <ruscur at russell.cc>
---
 external/mambo/skiboot.tcl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
index 096f1c34..7a939bfb 100644
--- a/external/mambo/skiboot.tcl
+++ b/external/mambo/skiboot.tcl
@@ -552,6 +552,10 @@ 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)
 
+if { $payload_size > [expr $mconf(boot_load) - $mconf(payload_addr)] } {
+	error "vmlinux is too large, consider adjusting PAYLOAD_ADDR"
+}
+
 # Flatten it
 epapr::of2dtb mysim $mconf(epapr_dt_addr)
 
-- 
2.21.0



More information about the Skiboot mailing list