diff mbox

[V2] Add Xen 4.6

Message ID 1457483717-17947-1-git-send-email-alistair.francis@xilinx.com
State Changes Requested
Headers show

Commit Message

Alistair Francis March 9, 2016, 12:35 a.m. UTC
Add support to compile Xen 4.6 and Xen tools.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
---
V2:
 - Lots of fixups pointed out by Arnout Vandecappelle

 package/Config.in     |  1 +
 package/xen/Config.in | 36 ++++++++++++++++++++++++++++++++++++
 package/xen/xen.hash  |  2 ++
 package/xen/xen.mk    | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 85 insertions(+)
 create mode 100644 package/xen/Config.in
 create mode 100644 package/xen/xen.hash
 create mode 100644 package/xen/xen.mk

Comments

Arnout Vandecappelle March 27, 2016, 12:54 p.m. UTC | #1
On 03/09/16 01:35, Alistair Francis wrote:
> Add support to compile Xen 4.6 and Xen tools.
>
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> ---
> V2:
>   - Lots of fixups pointed out by Arnout Vandecappelle
>
>   package/Config.in     |  1 +
>   package/xen/Config.in | 36 ++++++++++++++++++++++++++++++++++++
>   package/xen/xen.hash  |  2 ++
>   package/xen/xen.mk    | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>   4 files changed, 85 insertions(+)
>   create mode 100644 package/xen/Config.in
>   create mode 100644 package/xen/xen.hash
>   create mode 100644 package/xen/xen.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index d916154..37be762 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1656,6 +1656,7 @@ endif
>   	source "package/tpm-tools/Config.in"
>   	source "package/unscd/Config.in"
>   	source "package/util-linux/Config.in"
> +	source "package/xen/Config.in"
>   endmenu
>
>   menu "Text editors and viewers"
> diff --git a/package/xen/Config.in b/package/xen/Config.in
> new file mode 100644
> index 0000000..4235f48
> --- /dev/null
> +++ b/package/xen/Config.in
> @@ -0,0 +1,36 @@
> +config BR2_PACKAGE_XEN
> +	bool "xen"
> +	# Xen only supports these architectures
> +	depends on BR2_arm || BR2_aarch64 || BR2_i386 || BR2_x86_64
> +	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2
> +	depends on BR2_USE_WCHAR # libglib2, util-linux
> +	select BR2_PACKAGE_LIBAIO
> +	select BR2_PACKAGE_LIBGLIB2
> +	select BR2_PACKAGE_NCURSES
> +	select BR2_PACKAGE_OPENSSL
> +	select BR2_PACKAGE_PIXMAN
> +	select BR2_PACKAGE_YAJL
> +	help
> +	  This builds the Xen hypervisor and toolstack.

  There should be an empty line here.

> +	  http://www.xenproject.org/
> +
> +if BR2_PACKAGE_XEN
> +
> +config BR2_PACKAGE_XEN_HYPERVISOR
> +	bool "Build the Xen hypervisor"
> +	default y
> +	help
> +	  The Xen binaries are avaliable in ./usr/lib/xen/

  No . in the beginning of the path, it's the absolute path on the target.

> +	  See http://wiki.xenproject.org/wiki/Getting_Started for using the Xen hypervisor.

  Wrap at 72 columns (where the tab counts for 8).

> +
> +config BR2_PACKAGE_XEN_TOOLS
> +	bool "Build the Xen tools"
> +	depends on !BR2_STATIC_LIBS # dtc (libfdt)
> +	select BR2_PACKAGE_DTC
> +	select BR2_PACKAGE_UTIL_LINUX
> +	select BR2_PACKAGE_UTIL_LINUX_LIBUUID

  It also seems to need:

	select BR2_PACKAGE_ARGP_STANDALONE if !BR2_TOOLCHAIN_USES_GLIBC

> +	help
> +	  The Xen tools can be accessed by the xl command.
> +
> +endif
> diff --git a/package/xen/xen.hash b/package/xen/xen.hash
> new file mode 100644
> index 0000000..c124b3a
> --- /dev/null
> +++ b/package/xen/xen.hash
> @@ -0,0 +1,2 @@
> +# Locally computed
> +sha256 6fa1c2431df55aa5950d248e6093b8c8c0f11c357a0adbd348a2186478e80909 xen-4.6.0.tar.gz
> diff --git a/package/xen/xen.mk b/package/xen/xen.mk
> new file mode 100644
> index 0000000..2c0a4c9
> --- /dev/null
> +++ b/package/xen/xen.mk
> @@ -0,0 +1,46 @@
> +################################################################################
> +#
> +# Xen
> +#
> +################################################################################
> +
> +XEN_VERSION = 4.6.0
> +XEN_SITE = http://bits.xensource.com/oss-xen/release/$(XEN_VERSION)
> +XEN_LICENSE = GPLv2
> +XEN_LICENSE_FILES = COPYING
> +
> +ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
> +XEN_INSTALL_IMAGES = YES
> +endif
> +
> +XEN_DEPENDENCIES += libaio libglib2 ncurses openssl pixman yajl
> +
> +XEN_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR)
> +
> +XEN_CONF_OPTS += --disable-ocamltools

  For some reason, it doesn't seem to be cross-compiling for me, it uses "gcc" 
to build. I think you need to pass TARGET_CONFIGURE_OPTS in XEN_MAKE_ENV.

> +
> +ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
> +XEN_MAKE_OPTS += dist-xen
> +
> +define XEN_INSTALL_IMAGES_CMDS
> + cp $(@D)/xen/xen $(BINARIES_DIR)

  Commands should be indented with a tab.

> +endef
> +else
> +XEN_CONF_OPTS += --disable-xen
> +endif
> +
> +ifeq ($(BR2_PACKAGE_XEN_TOOLS),y)
> +XEN_DEPENDENCIES += dtc util-linux
> +XEN_INSTALL_TARGET_OPTS += install-tools
> +XEN_MAKE_OPTS += dist-tools
> +
> +define XEN_INSTALL_INIT_SYSV
> + mv $(TARGET_DIR)/etc/init.d/xencommons $(TARGET_DIR)/etc/init.d/S50xencommons
> + mv $(TARGET_DIR)/etc/init.d/xen-watchdog $(TARGET_DIR)/etc/init.d/S50xen-watchdog
> + mv $(TARGET_DIR)/etc/init.d/xendomains $(TARGET_DIR)/etc/init.d/S60xendomains

  Same here.


  Regards,
  Arnout


> +endef
> +else
> +XEN_CONF_OPTS += --disable-tools
> +endif
> +
> +$(eval $(autotools-package))
>
Alistair Francis March 28, 2016, 6:59 p.m. UTC | #2
On Sun, Mar 27, 2016 at 5:54 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 03/09/16 01:35, Alistair Francis wrote:
>>
>> Add support to compile Xen 4.6 and Xen tools.
>>
>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>> ---
>> V2:
>>   - Lots of fixups pointed out by Arnout Vandecappelle
>>
>>   package/Config.in     |  1 +
>>   package/xen/Config.in | 36 ++++++++++++++++++++++++++++++++++++
>>   package/xen/xen.hash  |  2 ++
>>   package/xen/xen.mk    | 46
>> ++++++++++++++++++++++++++++++++++++++++++++++
>>   4 files changed, 85 insertions(+)
>>   create mode 100644 package/xen/Config.in
>>   create mode 100644 package/xen/xen.hash
>>   create mode 100644 package/xen/xen.mk
>>
>> diff --git a/package/Config.in b/package/Config.in
>> index d916154..37be762 100644
>> --- a/package/Config.in
>> +++ b/package/Config.in
>> @@ -1656,6 +1656,7 @@ endif
>>         source "package/tpm-tools/Config.in"
>>         source "package/unscd/Config.in"
>>         source "package/util-linux/Config.in"
>> +       source "package/xen/Config.in"
>>   endmenu
>>
>>   menu "Text editors and viewers"
>> diff --git a/package/xen/Config.in b/package/xen/Config.in
>> new file mode 100644
>> index 0000000..4235f48
>> --- /dev/null
>> +++ b/package/xen/Config.in
>> @@ -0,0 +1,36 @@
>> +config BR2_PACKAGE_XEN
>> +       bool "xen"
>> +       # Xen only supports these architectures
>> +       depends on BR2_arm || BR2_aarch64 || BR2_i386 || BR2_x86_64
>> +       depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS
>> +       depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2
>> +       depends on BR2_USE_WCHAR # libglib2, util-linux
>> +       select BR2_PACKAGE_LIBAIO
>> +       select BR2_PACKAGE_LIBGLIB2
>> +       select BR2_PACKAGE_NCURSES
>> +       select BR2_PACKAGE_OPENSSL
>> +       select BR2_PACKAGE_PIXMAN
>> +       select BR2_PACKAGE_YAJL
>> +       help
>> +         This builds the Xen hypervisor and toolstack.
>
>
>  There should be an empty line here.
>
>> +         http://www.xenproject.org/
>> +
>> +if BR2_PACKAGE_XEN
>> +
>> +config BR2_PACKAGE_XEN_HYPERVISOR
>> +       bool "Build the Xen hypervisor"
>> +       default y
>> +       help
>> +         The Xen binaries are avaliable in ./usr/lib/xen/
>
>
>  No . in the beginning of the path, it's the absolute path on the target.
>
>> +         See http://wiki.xenproject.org/wiki/Getting_Started for using
>> the Xen hypervisor.
>
>
>  Wrap at 72 columns (where the tab counts for 8).
>
>> +
>> +config BR2_PACKAGE_XEN_TOOLS
>> +       bool "Build the Xen tools"
>> +       depends on !BR2_STATIC_LIBS # dtc (libfdt)
>> +       select BR2_PACKAGE_DTC
>> +       select BR2_PACKAGE_UTIL_LINUX
>> +       select BR2_PACKAGE_UTIL_LINUX_LIBUUID
>
>
>  It also seems to need:
>
>         select BR2_PACKAGE_ARGP_STANDALONE if !BR2_TOOLCHAIN_USES_GLIBC
>
>
>> +       help
>> +         The Xen tools can be accessed by the xl command.
>> +
>> +endif
>> diff --git a/package/xen/xen.hash b/package/xen/xen.hash
>> new file mode 100644
>> index 0000000..c124b3a
>> --- /dev/null
>> +++ b/package/xen/xen.hash
>> @@ -0,0 +1,2 @@
>> +# Locally computed
>> +sha256 6fa1c2431df55aa5950d248e6093b8c8c0f11c357a0adbd348a2186478e80909
>> xen-4.6.0.tar.gz
>> diff --git a/package/xen/xen.mk b/package/xen/xen.mk
>> new file mode 100644
>> index 0000000..2c0a4c9
>> --- /dev/null
>> +++ b/package/xen/xen.mk
>> @@ -0,0 +1,46 @@
>>
>> +################################################################################
>> +#
>> +# Xen
>> +#
>>
>> +################################################################################
>> +
>> +XEN_VERSION = 4.6.0
>> +XEN_SITE = http://bits.xensource.com/oss-xen/release/$(XEN_VERSION)
>> +XEN_LICENSE = GPLv2
>> +XEN_LICENSE_FILES = COPYING
>> +
>> +ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
>> +XEN_INSTALL_IMAGES = YES
>> +endif
>> +
>> +XEN_DEPENDENCIES += libaio libglib2 ncurses openssl pixman yajl
>> +
>> +XEN_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR)
>> +
>> +XEN_CONF_OPTS += --disable-ocamltools
>
>
>  For some reason, it doesn't seem to be cross-compiling for me, it uses
> "gcc" to build. I think you need to pass TARGET_CONFIGURE_OPTS in
> XEN_MAKE_ENV.

I see the same problem. I tried using TARGET_CONFIGURE_OPTS in
XEN_MAKE_ENV but it still uses GCC.

The configure scripts detects an AArch64 target correctly, but it
still uses GCC. Any other ideas?

Thanks,

Alistair

>
>> +
>> +ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
>> +XEN_MAKE_OPTS += dist-xen
>> +
>> +define XEN_INSTALL_IMAGES_CMDS
>> + cp $(@D)/xen/xen $(BINARIES_DIR)
>
>
>  Commands should be indented with a tab.
>
>> +endef
>> +else
>> +XEN_CONF_OPTS += --disable-xen
>> +endif
>> +
>> +ifeq ($(BR2_PACKAGE_XEN_TOOLS),y)
>> +XEN_DEPENDENCIES += dtc util-linux
>> +XEN_INSTALL_TARGET_OPTS += install-tools
>> +XEN_MAKE_OPTS += dist-tools
>> +
>> +define XEN_INSTALL_INIT_SYSV
>> + mv $(TARGET_DIR)/etc/init.d/xencommons
>> $(TARGET_DIR)/etc/init.d/S50xencommons
>> + mv $(TARGET_DIR)/etc/init.d/xen-watchdog
>> $(TARGET_DIR)/etc/init.d/S50xen-watchdog
>> + mv $(TARGET_DIR)/etc/init.d/xendomains
>> $(TARGET_DIR)/etc/init.d/S60xendomains
>
>
>  Same here.
>
>
>  Regards,
>  Arnout
>
>
>> +endef
>> +else
>> +XEN_CONF_OPTS += --disable-tools
>> +endif
>> +
>> +$(eval $(autotools-package))
>>
>
>
> --
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Arnout Vandecappelle March 29, 2016, 7:25 p.m. UTC | #3
On 03/28/16 20:59, Alistair Francis wrote:
> On Sun, Mar 27, 2016 at 5:54 AM, Arnout Vandecappelle<arnout@mind.be>  wrote:
[snip]
>> >  For some reason, it doesn't seem to be cross-compiling for me, it uses
>> >"gcc" to build. I think you need to pass TARGET_CONFIGURE_OPTS in
>> >XEN_MAKE_ENV.
> I see the same problem. I tried using TARGET_CONFIGURE_OPTS in
> XEN_MAKE_ENV but it still uses GCC.
>
> The configure scripts detects an AArch64 target correctly, but it
> still uses GCC. Any other ideas?

  Try passing CROSS_COMPILE in XEN_MAKE_ENV.

  You may also need to set XEN_TARGET_ARCH, AFAICS it is not derived automatically.

  Regards,
  Arnout

[snip]
Alistair Francis March 29, 2016, 11:37 p.m. UTC | #4
> -----Original Message-----
> From: Arnout Vandecappelle [mailto:arnout@mind.be]
> Sent: Tuesday, 29 March 2016 12:26 PM
> To: Alistair Francis <alistai@xilinx.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>;
> buildroot@buildroot.org; maxime.ripard@free-electrons.com
> Subject: Re: [PATCH V2] Add Xen 4.6
>
> On 03/28/16 20:59, Alistair Francis wrote:
> > On Sun, Mar 27, 2016 at 5:54 AM, Arnout Vandecappelle<arnout@mind.be>
> wrote:
> [snip]
> >> >  For some reason, it doesn't seem to be cross-compiling for me, it uses
> >> >"gcc" to build. I think you need to pass TARGET_CONFIGURE_OPTS in
> >> >XEN_MAKE_ENV.
> > I see the same problem. I tried using TARGET_CONFIGURE_OPTS in
> > XEN_MAKE_ENV but it still uses GCC.
> >
> > The configure scripts detects an AArch64 target correctly, but it
> > still uses GCC. Any other ideas?
>
>   Try passing CROSS_COMPILE in XEN_MAKE_ENV.
>
>   You may also need to set XEN_TARGET_ARCH, AFAICS it is not derived
> automatically.

Sorry for the poorly formatted reply, I am sending this from my work email.

I managed to get it to use aarch64-buildroot-linux-gnu-gcc using the
CROSS_COMPILE=$(TARGET_CROSS) option , but now I see a lot of
errors as apparently that version of GCC doesn't understand a lot of the
command line options.

Any idea why that would be? The GCC version is 4.9.3 which should be new enough.

Thanks,

Alistair

>
>   Regards,
>   Arnout
>
> [snip]
>
> --
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
Arnout Vandecappelle March 30, 2016, 7:30 a.m. UTC | #5
On 03/30/16 01:37, Alistair Francis wrote:
>> -----Original Message-----
>> From: Arnout Vandecappelle [mailto:arnout@mind.be]
>> Sent: Tuesday, 29 March 2016 12:26 PM
>> To: Alistair Francis <alistai@xilinx.com>
>> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>;
>> buildroot@buildroot.org; maxime.ripard@free-electrons.com
>> Subject: Re: [PATCH V2] Add Xen 4.6
>>
>> On 03/28/16 20:59, Alistair Francis wrote:
>>> On Sun, Mar 27, 2016 at 5:54 AM, Arnout Vandecappelle<arnout@mind.be>
>> wrote:
>> [snip]
>>>>>   For some reason, it doesn't seem to be cross-compiling for me, it uses
>>>>> "gcc" to build. I think you need to pass TARGET_CONFIGURE_OPTS in
>>>>> XEN_MAKE_ENV.
>>> I see the same problem. I tried using TARGET_CONFIGURE_OPTS in
>>> XEN_MAKE_ENV but it still uses GCC.
>>>
>>> The configure scripts detects an AArch64 target correctly, but it
>>> still uses GCC. Any other ideas?
>>
>>    Try passing CROSS_COMPILE in XEN_MAKE_ENV.
>>
>>    You may also need to set XEN_TARGET_ARCH, AFAICS it is not derived
>> automatically.
>
> Sorry for the poorly formatted reply, I am sending this from my work email.
>
> I managed to get it to use aarch64-buildroot-linux-gnu-gcc using the
> CROSS_COMPILE=$(TARGET_CROSS) option , but now I see a lot of
> errors as apparently that version of GCC doesn't understand a lot of the
> command line options.
>
> Any idea why that would be? The GCC version is 4.9.3 which should be new enough.

  Can you put the build log in a pastebin and post it on the list? It's 
difficult to say anything just like this...

  Did you also pass XEN_TARGET_ARCH?

  Regards,
  Arnout
Alistair Francis April 4, 2016, 11:45 p.m. UTC | #6
On Wed, Mar 30, 2016 at 12:30 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
>
>
> On 03/30/16 01:37, Alistair Francis wrote:
>>>
>>> -----Original Message-----
>>> From: Arnout Vandecappelle [mailto:arnout@mind.be]
>>> Sent: Tuesday, 29 March 2016 12:26 PM
>>> To: Alistair Francis <alistai@xilinx.com>
>>> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>;
>>> buildroot@buildroot.org; maxime.ripard@free-electrons.com
>>> Subject: Re: [PATCH V2] Add Xen 4.6
>>>
>>> On 03/28/16 20:59, Alistair Francis wrote:
>>>>
>>>> On Sun, Mar 27, 2016 at 5:54 AM, Arnout Vandecappelle<arnout@mind.be>
>>>
>>> wrote:
>>> [snip]
>>>>>>
>>>>>>   For some reason, it doesn't seem to be cross-compiling for me, it
>>>>>> uses
>>>>>> "gcc" to build. I think you need to pass TARGET_CONFIGURE_OPTS in
>>>>>> XEN_MAKE_ENV.
>>>>
>>>> I see the same problem. I tried using TARGET_CONFIGURE_OPTS in
>>>> XEN_MAKE_ENV but it still uses GCC.
>>>>
>>>> The configure scripts detects an AArch64 target correctly, but it
>>>> still uses GCC. Any other ideas?
>>>
>>>
>>>    Try passing CROSS_COMPILE in XEN_MAKE_ENV.
>>>
>>>    You may also need to set XEN_TARGET_ARCH, AFAICS it is not derived
>>> automatically.
>>
>>
>> Sorry for the poorly formatted reply, I am sending this from my work
>> email.
>>
>> I managed to get it to use aarch64-buildroot-linux-gnu-gcc using the
>> CROSS_COMPILE=$(TARGET_CROSS) option , but now I see a lot of
>> errors as apparently that version of GCC doesn't understand a lot of the
>> command line options.
>>
>> Any idea why that would be? The GCC version is 4.9.3 which should be new
>> enough.
>
>
>  Can you put the build log in a pastebin and post it on the list? It's
> difficult to say anything just like this...
>
>  Did you also pass XEN_TARGET_ARCH?

I managed to get it to work for AArch64, but now it's failing for
ARMv7. I haven't tried the x86 architectures yet.

Here is the error log: http://pastebin.com/znTSCu6s

Here is the Xen.mk I'm using: http://pastebin.com/G33WH3Z9

Thanks,

Alistair

>
>  Regards,
>  Arnout
>
> --
> Arnout Vandecappelle      arnout dot vandecappelle at essensium dot com
> Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile)
> Essensium, Mind division . . . . . . . . . . . . . . http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium . . . . . BE 872 984 063 RPR Leuven
>
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
>
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index d916154..37be762 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1656,6 +1656,7 @@  endif
 	source "package/tpm-tools/Config.in"
 	source "package/unscd/Config.in"
 	source "package/util-linux/Config.in"
+	source "package/xen/Config.in"
 endmenu
 
 menu "Text editors and viewers"
diff --git a/package/xen/Config.in b/package/xen/Config.in
new file mode 100644
index 0000000..4235f48
--- /dev/null
+++ b/package/xen/Config.in
@@ -0,0 +1,36 @@ 
+config BR2_PACKAGE_XEN
+	bool "xen"
+	# Xen only supports these architectures
+	depends on BR2_arm || BR2_aarch64 || BR2_i386 || BR2_x86_64
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2
+	depends on BR2_USE_WCHAR # libglib2, util-linux
+	select BR2_PACKAGE_LIBAIO
+	select BR2_PACKAGE_LIBGLIB2
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_OPENSSL
+	select BR2_PACKAGE_PIXMAN
+	select BR2_PACKAGE_YAJL
+	help
+	  This builds the Xen hypervisor and toolstack.
+	  http://www.xenproject.org/
+
+if BR2_PACKAGE_XEN
+
+config BR2_PACKAGE_XEN_HYPERVISOR
+	bool "Build the Xen hypervisor"
+	default y
+	help
+	  The Xen binaries are avaliable in ./usr/lib/xen/
+	  See http://wiki.xenproject.org/wiki/Getting_Started for using the Xen hypervisor.
+
+config BR2_PACKAGE_XEN_TOOLS
+	bool "Build the Xen tools"
+	depends on !BR2_STATIC_LIBS # dtc (libfdt)
+	select BR2_PACKAGE_DTC
+	select BR2_PACKAGE_UTIL_LINUX
+	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
+	help
+	  The Xen tools can be accessed by the xl command.
+
+endif
diff --git a/package/xen/xen.hash b/package/xen/xen.hash
new file mode 100644
index 0000000..c124b3a
--- /dev/null
+++ b/package/xen/xen.hash
@@ -0,0 +1,2 @@ 
+# Locally computed
+sha256 6fa1c2431df55aa5950d248e6093b8c8c0f11c357a0adbd348a2186478e80909 xen-4.6.0.tar.gz
diff --git a/package/xen/xen.mk b/package/xen/xen.mk
new file mode 100644
index 0000000..2c0a4c9
--- /dev/null
+++ b/package/xen/xen.mk
@@ -0,0 +1,46 @@ 
+################################################################################
+#
+# Xen
+#
+################################################################################
+
+XEN_VERSION = 4.6.0
+XEN_SITE = http://bits.xensource.com/oss-xen/release/$(XEN_VERSION)
+XEN_LICENSE = GPLv2
+XEN_LICENSE_FILES = COPYING
+
+ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
+XEN_INSTALL_IMAGES = YES
+endif
+
+XEN_DEPENDENCIES += libaio libglib2 ncurses openssl pixman yajl
+
+XEN_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR)
+
+XEN_CONF_OPTS += --disable-ocamltools
+
+ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
+XEN_MAKE_OPTS += dist-xen
+
+define XEN_INSTALL_IMAGES_CMDS
+ cp $(@D)/xen/xen $(BINARIES_DIR)
+endef
+else
+XEN_CONF_OPTS += --disable-xen
+endif
+
+ifeq ($(BR2_PACKAGE_XEN_TOOLS),y)
+XEN_DEPENDENCIES += dtc util-linux
+XEN_INSTALL_TARGET_OPTS += install-tools
+XEN_MAKE_OPTS += dist-tools
+
+define XEN_INSTALL_INIT_SYSV
+ mv $(TARGET_DIR)/etc/init.d/xencommons $(TARGET_DIR)/etc/init.d/S50xencommons
+ mv $(TARGET_DIR)/etc/init.d/xen-watchdog $(TARGET_DIR)/etc/init.d/S50xen-watchdog
+ mv $(TARGET_DIR)/etc/init.d/xendomains $(TARGET_DIR)/etc/init.d/S60xendomains
+endef
+else
+XEN_CONF_OPTS += --disable-tools
+endif
+
+$(eval $(autotools-package))