aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <frediano.ziglio@huawei.com>2014-10-27 10:58:57 +0000
committerFrediano Ziglio <frediano.ziglio@huawei.com>2014-11-05 09:27:29 +0000
commit87abad55e20902dc26069bee9d79a07030bdb9cd (patch)
treed5c4abe63d4db8d13b8173e64e1bebc2eb286ce1
parentca033877b13f4a96f19a7bc318c61f13d17f5df9 (diff)
Try to embed kernel into Xenfrediano/addons
-rw-r--r--xen/arch/arm/Makefile8
-rw-r--r--xen/arch/arm/bootfdt.c9
-rw-r--r--xen/arch/arm/kernel_bin.S2
-rw-r--r--xen/arch/arm/xen.lds.S9
4 files changed, 28 insertions, 0 deletions
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 41aba2eb2c..fc5128bec5 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -46,6 +46,12 @@ obj-y += dtb.o
AFLAGS += -DCONFIG_DTB_FILE=\"$(CONFIG_DTB_FILE)\"
endif
+ifdef CONFIG_KERNEL_FILE
+obj-y += kernel_bin.o
+AFLAGS += -DCONFIG_KERNEL_FILE=\"$(CONFIG_KERNEL_FILE)\"
+CFLAGS += -DCONFIG_KERNEL_FILE=\"$(CONFIG_KERNEL_FILE)\"
+endif
+
ALL_OBJS := $(TARGET_SUBARCH)/head.o $(ALL_OBJS)
$(TARGET): $(TARGET)-syms $(TARGET).axf
@@ -99,6 +105,8 @@ xen.lds: xen.lds.S
dtb.o: $(CONFIG_DTB_FILE)
+kernel_bin.o: $(CONFIG_KERNEL_FILE)
+
.PHONY: clean
clean::
rm -f asm-offsets.s xen.lds
diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index e100233826..fff9140011 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -161,11 +161,17 @@ static void __init process_memory_node(const void *fdt, int node,
}
}
+extern u8 kernel_start[], kernel_end[];
+
static void __init process_multiboot_node(const void *fdt, int node,
const char *name,
u32 address_cells, u32 size_cells)
{
+#ifdef CONFIG_KERNEL_FILE
+ static int kind_guess = 1;
+#else
static int kind_guess = 0;
+#endif
const struct fdt_property *prop;
const __be32 *cell;
bootmodule_kind kind;
@@ -328,6 +334,9 @@ size_t __init boot_fdt_info(const void *fdt, paddr_t paddr)
panic("No valid device tree\n");
add_boot_module(BOOTMOD_FDT, paddr, fdt_totalsize(fdt), NULL);
+#ifdef CONFIG_KERNEL_FILE
+ add_boot_module(BOOTMOD_KERNEL, (paddr_t) (long) kernel_start, (paddr_t) (long) (kernel_end - kernel_start), NULL);
+#endif
device_tree_for_each_node((void *)fdt, early_scan_node, NULL);
early_print_info();
diff --git a/xen/arch/arm/kernel_bin.S b/xen/arch/arm/kernel_bin.S
new file mode 100644
index 0000000000..eaaa80a70b
--- /dev/null
+++ b/xen/arch/arm/kernel_bin.S
@@ -0,0 +1,2 @@
+ .section .kernel,#alloc
+ .incbin CONFIG_KERNEL_FILE
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 0488f3706e..2624f664ea 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -50,6 +50,7 @@ SECTIONS
__stop_bug_frames_2 = .;
*(.rodata)
*(.rodata.*)
+
_erodata = .; /* End of read-only data */
} :text
@@ -60,6 +61,14 @@ SECTIONS
*(.data.rel)
*(.data.rel.*)
CONSTRUCTORS
+#ifdef CONFIG_KERNEL_FILE
+ /* Section for the kernel blob (if any). */
+ . = ALIGN(32);
+ kernel_start = .;
+ *(.kernel)
+ kernel_end = .;
+#endif
+
} :text
. = ALIGN(SMP_CACHE_BYTES);