Skip to contentSkip to conversation

Add Xen 4.6

PATCH Superseded Alistair Francis 2 participants 3 messages May 12, 2016 – Jun 13, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Add Xen 4.6

Add support to compile Xen 4.6 and Xen tools for arm32 and arm64 targets.

---
I wasn't able to get x86 targets to build correctly and I don't know enough about them to dig into it deeply.

package/Config.in | 1 +

 package/xen/Config.in | 42 ++++++++++++++++++++++++++++++++++++++
 package/xen/xen.hash  |  2 ++
 package/xen/xen.mk    | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 101 insertions(+)
 create mode 100644 package/xen/Config.in
 create mode 100644 package/xen/xen.hash
 create mode 100644 package/xen/xen.mk
package/Config.in +1 -0
index 9d668bf..a970555 100644
@@ -1684,6 +1684,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"
package/xen/Config.in new file +42 -0

42 lines not on this page · raw message

package/xen/xen.hash new file +2 -0
new file mode 100644
index 0000000..c124b3a
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 6fa1c2431df55aa5950d248e6093b8c8c0f11c357a0adbd348a2186478e80909 xen-4.6.0.tar.gz
package/xen/xen.mk new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/1 Add Xen 4.6

Hello,

Quoted 4 lines · Alistair Francis

Add support to compile Xen 4.6 and Xen tools for arm32 and arm64 targets.

Thanks a lot! I've applied your patch, with a number of changes, see below for the details!

package/xen/Config.in line 4

Quoted 10 lines
package/xen/Config.in new file +4 -0
new file mode 100644
index 0000000..52d185c
@@ -0,0 +1,42 @@
+config BR2_PACKAGE_XEN
+	bool "xen"
+	# Xen in buildroot only supports these architectures
+	depends on BR2_arm || BR2_aarch64

In fact, BR2_arm is not good enough: Xen uses the dmb instruction for memory barriers, so I've restricted the package to ARMv7.

package/xen/Config.in line 13

Quoted 9 lines
package/xen/Config.in new file +9 -0
+	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

None of these dependencies are needed for the hypervisor, they are only needed for the tools. So I've moved all of this under the tools sub-option.

Also, since I believe building with both the hypervisor and the tools disabled doesn't make much sense, I've added here:

select BR2_PACKAGE_XEN_HYPERVISOR if !BR2_PACKAGE_XEN_TOOLS

Quoted 7 lines
package/xen/Config.in new file +7 -0
+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/

package/xen/Config.in line 38

Quoted 10 lines
package/xen/Config.in new file +10 -0
+	  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
+	select BR2_PACKAGE_ARGP_STANDALONE if !BR2_TOOLCHAIN_USES_GLIBC

So here we have a lot more dependencies (all the ones you originally had on the main Xen option).

package/xen/Config.in line 32

Quoted 2 lines
package/xen/Config.in new file +2 -0
+ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
+XEN_INSTALL_IMAGES = YES

I've grouped this under the BR2_PACKAGE_XEN_HYPERVISOR conditional below.

package/xen/Config.in line 35

Quoted 3 lines
package/xen/Config.in new file +3 -0
+endif
+
+XEN_DEPENDENCIES += libaio libglib2 ncurses openssl pixman yajl

This is now under the BR2_PACKAGE_XEN_TOOLS option.

package/xen/Config.in line 37

Quoted 2 lines
package/xen/Config.in new file +2 -0
+
+XEN_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR)

Since you're not installing anything to the target when only the Hypervisor is enabled, I've simply added XEN_INSTALL_TARGET = NO in the hypervisor case, and moved this under the tools condition.

package/xen/Config.in line 38

Quoted 1 line
package/xen/Config.in new file +1 -0
+XEN_ARCH=$(ARCH)

Not needed, since the only architectures you support are ARM and AArch64, so the below conditions were sufficient.

package/xen/Config.in line 42

Quoted 4 lines
package/xen/Config.in new file +4 -0
+
+# Overwrite some architectures to match what Xen expects
+ifeq ($(ARCH),aarch64)
+XEN_ARCH="arm64"

Quotes not needed.

package/xen/Config.in

Quoted 2 lines
package/xen/Config.in new file +2 -0
+endif
+ifeq ($(ARCH),arm)

else ifeq is better here.

Quoted 1 line

+XEN_ARCH="arm32"

Quotes not needed.

Quoted 7 lines
package/xen/Config.in new file +7 -0
+endif
+
+XEN_CONF_OPTS += --disable-ocamltools
+XEN_MAKE_ENV += XEN_TARGET_ARCH=$(XEN_ARCH) CROSS_COMPILE=$(TARGET_CROSS) $(TARGET_CONFIGURE_OPTS)
+
+ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
+XEN_MAKE_OPTS += dist-xen

package/xen/Config.in

Quoted 10 lines
package/xen/Config.in new file +10 -0
+
+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

I've added many more dependencies here.

package/xen/Config.in

Quoted 13 lines
package/xen/Config.in new file +13 -0
+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))

See https://git.buildroot.org/buildroot/log for the final commit.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH v3 1/1 Add Xen 4.6

Quoted 10 lines · Thomas Petazzoni

Hello,

Quoted 4 lines · Alistair Francis

Add support to compile Xen 4.6 and Xen tools for arm32 and arm64 targets.

Thanks a lot! I've applied your patch, with a number of changes, see below for the details!

Thanks so much!

Sorry there were still so many changes you had to make, but thanks for merging it.

Thanks,

Alistair

Quoted 139 lines

package/xen/Config.in line 4

Quoted 11 lines
package/xen/Config.in new file +4 -0
new file mode 100644
index 0000000..52d185c
@@ -0,0 +1,42 @@
+config BR2_PACKAGE_XEN
+     bool "xen"
+     # Xen in buildroot only supports these architectures
+     depends on BR2_arm || BR2_aarch64

In fact, BR2_arm is not good enough: Xen uses the dmb instruction for memory barriers, so I've restricted the package to ARMv7.

package/xen/Config.in line 13

Quoted 9 lines
package/xen/Config.in new file +9 -0
+     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

None of these dependencies are needed for the hypervisor, they are only needed for the tools. So I've moved all of this under the tools sub-option.

Also, since I believe building with both the hypervisor and the tools disabled doesn't make much sense, I've added here:

select BR2_PACKAGE_XEN_HYPERVISOR if !BR2_PACKAGE_XEN_TOOLS

Quoted 7 lines
package/xen/Config.in new file +7 -0
+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/

package/xen/Config.in line 38

Quoted 10 lines
package/xen/Config.in new file +10 -0
+       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
+     select BR2_PACKAGE_ARGP_STANDALONE if !BR2_TOOLCHAIN_USES_GLIBC

So here we have a lot more dependencies (all the ones you originally had on the main Xen option).

package/xen/Config.in line 32

Quoted 2 lines
package/xen/Config.in new file +2 -0
+ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
+XEN_INSTALL_IMAGES = YES

I've grouped this under the BR2_PACKAGE_XEN_HYPERVISOR conditional below.

package/xen/Config.in line 35

Quoted 3 lines
package/xen/Config.in new file +3 -0
+endif
+
+XEN_DEPENDENCIES += libaio libglib2 ncurses openssl pixman yajl

This is now under the BR2_PACKAGE_XEN_TOOLS option.

package/xen/Config.in line 37

Quoted 2 lines
package/xen/Config.in new file +2 -0
+
+XEN_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR)

Since you're not installing anything to the target when only the Hypervisor is enabled, I've simply added XEN_INSTALL_TARGET = NO in the hypervisor case, and moved this under the tools condition.

package/xen/Config.in line 38

Quoted 1 line
package/xen/Config.in new file +1 -0
+XEN_ARCH=$(ARCH)

Not needed, since the only architectures you support are ARM and AArch64, so the below conditions were sufficient.

package/xen/Config.in line 42

Quoted 4 lines
package/xen/Config.in new file +4 -0
+
+# Overwrite some architectures to match what Xen expects
+ifeq ($(ARCH),aarch64)
+XEN_ARCH="arm64"

Quotes not needed.

package/xen/Config.in

Quoted 2 lines
package/xen/Config.in new file +2 -0
+endif
+ifeq ($(ARCH),arm)

else ifeq is better here.

Quoted 1 line

+XEN_ARCH="arm32"

Quotes not needed.

Quoted 7 lines
package/xen/Config.in new file +7 -0
+endif
+
+XEN_CONF_OPTS += --disable-ocamltools
+XEN_MAKE_ENV += XEN_TARGET_ARCH=$(XEN_ARCH) CROSS_COMPILE=$(TARGET_CROSS) $(TARGET_CONFIGURE_OPTS)
+
+ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
+XEN_MAKE_OPTS += dist-xen

package/xen/Config.in

Quoted 10 lines
package/xen/Config.in new file +10 -0
+
+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

I've added many more dependencies here.

package/xen/Config.in

Quoted 13 lines
package/xen/Config.in new file +13 -0
+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))

See https://git.buildroot.org/buildroot/log for the final commit.

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com