On 2016-06-17 21:13, [email protected] wrote:
> From: Dmitry Voytik <[email protected]>
> 
> This patch implements a loader, that can be used to boot a Linux
> kernel in a Jailhouse cell on AArch64.
> 
> Signed-off-by: Dmitry Voytik <[email protected]>
> Signed-off-by: Antonios Motakis <[email protected]>
> [[email protected]:
>       - split foundation-v8 configuration to a separate patch
>       - small fixes in the linux loader output
>       - take kernel and dtb address using cell load command line ]
> ---
>  inmates/tools/arm64/Makefile       | 19 +++++++++++
>  inmates/tools/arm64/linux-loader.c | 66 
> ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 85 insertions(+)
>  create mode 100644 inmates/tools/arm64/linux-loader.c
> 
> diff --git a/inmates/tools/arm64/Makefile b/inmates/tools/arm64/Makefile
> index e69de29..4a72277 100644
> --- a/inmates/tools/arm64/Makefile
> +++ b/inmates/tools/arm64/Makefile
> @@ -0,0 +1,19 @@
> +#
> +# Jailhouse, a Linux-based partitioning hypervisor
> +#
> +# Copyright (c) Siemens AG, 2013-2015
> +#
> +# Authors:
> +#  Jan Kiszka <[email protected]>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2.  See
> +# the COPYING file in the top-level directory.
> +#
> +
> +include $(INMATES_LIB)/Makefile.lib
> +
> +INMATES := linux-loader.bin
> +
> +linux-loader-y := linux-loader.o
> +
> +$(eval $(call DECLARE_TARGETS,$(INMATES)))
> diff --git a/inmates/tools/arm64/linux-loader.c 
> b/inmates/tools/arm64/linux-loader.c
> new file mode 100644
> index 0000000..e8a6cac
> --- /dev/null
> +++ b/inmates/tools/arm64/linux-loader.c
> @@ -0,0 +1,66 @@
> +/*
> + * Jailhouse AArch64 support
> + *
> + * Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
> + *
> + * Authors:
> + *  Dmitry Voytik <[email protected]>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2.  See
> + * the COPYING file in the top-level directory.
> + */
> +
> +#include <inmate.h>
> +
> +/* Example memory map:
> + *     0x00000000 - 0x00003fff (16K) this binary
> + *     0x00280000                    Image
> + *     0x0fe00000                    dtb
> + */
> +
> +#define CMDLINE_BUFFER_SIZE  256
> +CMDLINE_BUFFER(CMDLINE_BUFFER_SIZE);
> +
> +struct arm64_linux_header {
> +     u32 code0;              /* Executable code */
> +     u32 code1;              /* Executable code */
> +     u64 text_offset;        /* Image load offset, little endian */
> +     u64 image_size;         /* Effective Image size, little endian */
> +     u64 flags;              /* kernel flags, little endian */
> +     u64 res2;               /* = 0, reserved */
> +     u64 res3;               /* = 0, reserved */
> +     u64 res4;               /* = 0, reserved */
> +     u32 magic;              /* 0x644d5241 Magic number, little endian,
> +                                "ARM\x64" */
> +     u32 res5;               /* reserved (used for PE COFF offset) */
> +};
> +
> +void inmate_main(void)
> +{
> +     struct arm64_linux_header *kernel;
> +     unsigned long dtb;
> +     void (*entry)(unsigned long);
> +
> +     printk("\nJailhouse ARM64 Linux bootloader\n");
> +
> +     kernel = (void *) cmdline_parse_int("kernel", 0);
> +     dtb = cmdline_parse_int("dtb", 0);
> +
> +     if (!kernel || !dtb) {
> +             printk("ERROR: command line parameters kernel and dtb"
> +                                                     " are required\n");
> +             while(1);
> +     }
> +
> +     entry = (void*)(unsigned long) kernel;
> +
> +     printk("DTB:        0x%016lx\n", dtb);
> +     printk("Image:      0x%016lx\n", kernel);
> +     printk("Image size: %lu Bytes\n", kernel->image_size);
> +     printk("entry:      0x%016lx\n", entry);
> +     if (kernel->magic != 0x644d5241)
> +             printk("WARNING: wrong Linux Image header magic: 0x%08x\n",
> +                    kernel->magic);
> +
> +     entry(dtb);
> +}
> 

How much of this is ARM64-specific, how much could be reused on 32-bit?
I'm also asking because I'd like to address that topic over there soon.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to