From a81a002abb9f2dcbb114c97e27ac495a738c93b2 Mon Sep 17 00:00:00 2001 From: Trammell Hudson Date: Wed, 3 Aug 2016 18:10:44 -0400 Subject: [PATCH] Build and bundle the patched xen 4.6.3 kernel --- Makefile | 4 ++++ README.md | 3 ++- config/xen.config | 1 + modules/xen | 12 ++++++++++++ patches/xen-4.6.3.patch | 15 ++------------- 5 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 config/xen.config create mode 100644 modules/xen diff --git a/Makefile b/Makefile index f95ce13a..35b05c8b 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,9 @@ define define_module = # that the files are all present $(build)/$($1_dir)/.canary: $(packages)/.$1_verify tar -xf "$(packages)/$($1_tar)" -C "$(build)" + if [ -r patches/$1-$($1_version).patch ]; then \ + ( cd $(build)/$($1_dir) ; patch -p1 ) < patches/$1-$($1_version).patch; \ + fi touch "$$@" # Copy our stored config file into the unpacked directory @@ -78,6 +81,7 @@ endef $(foreach _, $(call outputs,kexec), $(eval $(call initrd_bin,$_))) $(foreach _, $(call outputs,tpmtotp), $(eval $(call initrd_bin,$_))) +$(foreach _, $(call outputs,xen), $(eval $(call initrd_bin,$_))) # hack to install busybox into the initrd initrd_bins += initrd/bin/busybox diff --git a/README.md b/README.md index 738f26f1..35151f9a 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,5 @@ Notes: * Building coreboot's cross compilers can take a while. * Currently only tested in Qemu and on a Thinkpad x230 * Booting Qubes requires patching Xen's real mode startup code; -see `patches/xen-4.6.3.patch` +see `patches/xen-4.6.3.patch` and add `no-real-mode` to start +of the Xen command line. diff --git a/config/xen.config b/config/xen.config new file mode 100644 index 00000000..c01ade29 --- /dev/null +++ b/config/xen.config @@ -0,0 +1 @@ +# Nothing diff --git a/modules/xen b/modules/xen new file mode 100644 index 00000000..f0d3fa30 --- /dev/null +++ b/modules/xen @@ -0,0 +1,12 @@ +modules += xen + +# We extract the entire Xen tree, but only use the xen/xen hypervisor +# portion since Qubes provides the rest of it. +xen_version := 4.6.3 +xen_dir := xen-$(xen_version)/xen +xen_tar := xen-$(xen_version).tar.gz +xen_url := ineed-to-find-xen/$(xen_tar) +xen_hash := 02badfce9a037bd1bd4a94210c1f6b85467746216c71795805102b514bcf1fc4 + +xen_output := xen.gz +xen_configure := diff --git a/patches/xen-4.6.3.patch b/patches/xen-4.6.3.patch index 0375ac57..22db06da 100644 --- a/patches/xen-4.6.3.patch +++ b/patches/xen-4.6.3.patch @@ -1,6 +1,6 @@ diff -u --recursive clean/xen-4.6.3/xen/arch/x86/boot/head.S xen-4.6.3/xen/arch/x86/boot/head.S --- clean/xen-4.6.3/xen/arch/x86/boot/head.S 2016-06-20 08:08:22.000000000 -0400 -+++ xen-4.6.3/xen/arch/x86/boot/head.S 2016-07-26 13:10:55.407297163 -0400 ++++ xen/arch/x86/boot/head.S 2016-07-26 13:10:55.407297163 -0400 @@ -86,6 +86,8 @@ cmp $MULTIBOOT_BOOTLOADER_MAGIC,%eax jne not_multiboot @@ -23,20 +23,9 @@ diff -u --recursive clean/xen-4.6.3/xen/arch/x86/boot/head.S xen-4.6.3/xen/arch/ 2: /* Reserve 64kb for the trampoline */ sub $0x1000,%eax -diff -u --recursive clean/xen-4.6.3/xen/arch/x86/boot/trampoline.S xen-4.6.3/xen/arch/x86/boot/trampoline.S ---- clean/xen-4.6.3/xen/arch/x86/boot/trampoline.S 2016-06-20 08:08:22.000000000 -0400 -+++ xen-4.6.3/xen/arch/x86/boot/trampoline.S 2016-07-26 11:40:55.938940922 -0400 -@@ -114,6 +114,7 @@ - - .code32 - trampoline_boot_cpu_entry: -+ jmp .Lskip_realmode // always! - cmpb $0,bootsym_rel(skip_realmode,5) - jnz .Lskip_realmode - diff -u --recursive clean/xen-4.6.3/xen/drivers/video/vga.c xen-4.6.3/xen/drivers/video/vga.c --- clean/xen-4.6.3/xen/drivers/video/vga.c 2016-06-20 08:08:22.000000000 -0400 -+++ xen-4.6.3/xen/drivers/video/vga.c 2016-07-26 13:34:03.756108517 -0400 ++++ xen/drivers/video/vga.c 2016-07-26 13:34:03.756108517 -0400 @@ -5,177 +5,691 @@ */