diff options
author | Jeremy Kerr <jeremy.kerr@au1.ibm.com> | 2014-09-12 14:26:06 +0800 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-10-30 16:50:39 +1100 |
commit | 8ae439ca855c0435e8bd84f7ffc16e505cad85f7 (patch) | |
tree | 6f0e23df1760a8b1dda46785889018070bebe01e /core | |
parent | 4797b3eee3a0fc41ff5d68408dc73ac5e6fd248e (diff) | |
download | blackbird-skiboot-8ae439ca855c0435e8bd84f7ffc16e505cad85f7.tar.gz blackbird-skiboot-8ae439ca855c0435e8bd84f7ffc16e505cad85f7.zip |
core: Add support for loading an external initramfs
Using the platform.load_resource interface, allow an external initramfs
image to be passed to the kernel.
We split the KERNEL_LOAD_BASE/KERNEL_LOAD_SIZE region in half, to allow
space for the initramfs.
Signed-off-by: Jeremy Kerr <jeremy.kerr@au.ibm.com>
Acked-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/init.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/core/init.c b/core/init.c index bd360ac0..1db79787 100644 --- a/core/init.c +++ b/core/init.c @@ -308,6 +308,29 @@ static bool load_kernel(void) return false; } +static void load_initramfs(void) +{ + size_t size; + bool loaded; + + if (!platform.load_resource) + return; + + size = INITRAMFS_LOAD_SIZE; + loaded = platform.load_resource(RESOURCE_ID_INITRAMFS, + INITRAMFS_LOAD_BASE, &size); + + if (!loaded || !size) + return; + + printf("INIT: Initramfs loaded, size: %zu bytes\n", size); + + dt_add_property_u64(dt_chosen, "linux,initrd-start", + (uint64_t)INITRAMFS_LOAD_BASE); + dt_add_property_u64(dt_chosen, "linux,initrd-end", + (uint64_t)INITRAMFS_LOAD_BASE + size); +} + void __noreturn load_and_boot_kernel(bool is_reboot) { const struct dt_property *memprop; @@ -328,6 +351,8 @@ void __noreturn load_and_boot_kernel(bool is_reboot) abort(); } + load_initramfs(); + if (!is_reboot) { /* We wait for the nvram read to complete here so we can * grab stuff from there such as the kernel arguments |