[Skiboot] [PATCH 4/4] init: Test device tree for binary kernel
Michael Neuling
mikey at neuling.org
Mon Mar 7 13:27:34 AEDT 2016
Test device tree for binary kernel in /kernel-binary-base. Use this
if found and assume it's stripped from the elf.
This can reduce the boot time since the kernel no longer needs to
relocate itself.
An example of how to do this using mambo is given with the follow
skiboot.tcl patch and these commands:
% objcopy -O binary vmlinux vmlinux.stripped
% SKIBOOT_ZIMAGE=vmlinux.stripped
diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
index d3b4120..f0f09c9 100644
--- a/external/mambo/skiboot.tcl
+++ b/external/mambo/skiboot.tcl
@@ -34,7 +34,7 @@ if { ![info exists env(SKIBOOT_ZIMAGE)] } {
mconfig payload PAYLOAD $env(SKIBOOT_ZIMAGE)
# Paylod: Memory location for a Linux style ramdisk/initrd
-mconfig payload_addr PAYLOAD_ADDR 0x20000000;
+mconfig payload_addr PAYLOAD_ADDR 0x0;
# FW: Where should ePAPR Flat Devtree Binary be loaded
mconfig epapr_dt_addr EPAPR_DT_ADDR 0x1f00000;# place at 31M
@@ -144,6 +144,7 @@ set root_node [mysim of find_device "/"]
mysim of addprop $root_node string "epapr-version" "ePAPR-1.0"
mysim of setprop $root_node "compatible" "ibm,powernv"
+mysim of addprop $root_node int "kernel-binary-base" $mconf(payload_addr)
set cpus_node [mysim of find_device "/cpus"]
mysim of addprop $cpus_node int "#address-cells" 1
Signed-off-by: Michael Neuling <mikey at neuling.org>
---
We can bikeshed the dt binding here. Should it be in /chosen? Should
we allow elf vs stripped in the dt binding? Maybe another name?
Mikey
---
core/init.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/core/init.c b/core/init.c
index 1d9ef70..048d4a1 100644
--- a/core/init.c
+++ b/core/init.c
@@ -345,6 +345,21 @@ static bool load_kernel(void)
}
}
+ if (dt_has_node_property(dt_root, "kernel-binary-base", NULL)) {
+ kernel_entry = dt_prop_get_u32(dt_root, "kernel-binary-base");
+ printf("INIT: Stripped kernel binary found at 0x%llx\n",
+ kernel_entry);
+
+ /*
+ * If the kernel is at 0, copy back what we wrote over
+ * for the null branch catcher.
+ */
+ if (kernel_entry == 0)
+ memcpy(0, zero_location, 16);
+
+ return true;
+ }
+
if (!kernel_size)
printf("Assuming kernel at %p\n", KERNEL_LOAD_BASE);
--
2.5.0
More information about the Skiboot
mailing list