Skip to content
Aaron edited this page May 21, 2016 · 1 revision

There are better ways to structure this, but this is the first try, so be patient :)

Patch for Xen to add a "Rust" minios stubdom:

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 2044d76..f73a2da 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -454,6 +454,14 @@ c: $(CROSS_ROOT)
 	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
 
 ######
+# rust
+######
+
+.PHONY: rust
+rust: $(CROSS_ROOT)
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
+
+######
 # VTPM
 ######
 
@@ -513,6 +521,10 @@ caml-stubdom: mini-os-$(XEN_TARGET_ARCH)-caml lwip-$(XEN_TARGET_ARCH) libxc cros
 c-stubdom: mini-os-$(XEN_TARGET_ARCH)-c lwip-$(XEN_TARGET_ARCH) libxc c
 	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/c/minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS=$(CURDIR)/c/main.a
 
+.PHONY: rust-stubdom
+rust-stubdom: mini-os-$(XEN_TARGET_ARCH)-rust lwip-$(XEN_TARGET_ARCH) libxc rust
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/c/minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS=$(CURDIR)/rust/main.a
+
 .PHONY: vtpm-stubdom
 vtpm-stubdom: mini-os-$(XEN_TARGET_ARCH)-vtpm vtpm
 	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/vtpm/minios.cfg" $(MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS="$(CURDIR)/vtpm/vtpm.a" APP_LDLIBS="-ltpm -ltpm_crypto -lgmp -lpolarssl"
@@ -552,6 +564,8 @@ install-grub: pv-grub
 
 install-c: c-stubdom
 
+install-rust: rust-stubdom
+
 install-caml: caml-stubdom
 
 install-xenstore: xenstore-stubdom
@@ -575,6 +589,7 @@ install-vtpmmgr: vtpmmgr-stubdom
 clean:
 	rm -fr mini-os-$(XEN_TARGET_ARCH)-ioemu
 	rm -fr mini-os-$(XEN_TARGET_ARCH)-c
+	rm -fr mini-os-$(XEN_TARGET_ARCH)-rust
 	rm -fr mini-os-$(XEN_TARGET_ARCH)-caml
 	rm -fr mini-os-$(XEN_TARGET_ARCH)-grub
 	rm -fr mini-os-$(XEN_TARGET_ARCH)-xenstore
diff --git a/stubdom/configure b/stubdom/configure
index 5b9c609..e74eebb 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -631,6 +631,7 @@ debug
 xenstore
 grub
 caml
+rust
 c
 host_os
 host_vendor
@@ -683,6 +684,7 @@ ac_user_opts='
 enable_option_checking
 enable_ioemu_stubdom
 enable_c_stubdom
+enable_rust_stubdom
 enable_caml_stubdom
 enable_pv_grub
 enable_xenstore_stubdom
@@ -1325,6 +1327,7 @@ Optional Features:
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-ioemu-stubdom  Build and install ioemu-stubdom
   --enable-c-stubdom      Build and install c-stubdom (default is DISABLED)
+  --enable-rust-stubdom   Build and install rust-stubdom (default is DISABLED)
   --enable-caml-stubdom   Build and install caml-stubdom (default is DISABLED)
   --disable-pv-grub       Build and install pv-grub (default is ENABLED)
   --disable-xenstore-stubdom
@@ -2040,6 +2043,43 @@ fi
 
 
 
+# Check whether --enable-rust-stubdom was given.
+if test "${enable_rust_stubdom+set}" = set; then :
+  enableval=$enable_rust_stubdom;
+
+if test "x$enableval" = "xyes"; then :
+
+
+rust=y
+STUBDOM_TARGETS="$STUBDOM_TARGETS rust"
+STUBDOM_BUILD="$STUBDOM_BUILD rust-stubdom"
+STUBDOM_INSTALL="$STUBDOM_INSTALL install-rust"
+
+
+else
+
+if test "x$enableval" = "xno"; then :
+
+
+rust=n
+
+
+fi
+
+fi
+
+
+else
+
+
+rust=n
+
+
+fi
+
+
+
+
 # Check whether --enable-caml-stubdom was given.
 if test "${enable_caml_stubdom+set}" = set; then :
   enableval=$enable_caml_stubdom;
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index 9fec853..a04961b 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -20,6 +20,7 @@ m4_include([../m4/fetcher.m4])
 # Enable/disable stub domains
 AX_STUBDOM_CONDITIONAL([ioemu-stubdom], [ioemu])
 AX_STUBDOM_DEFAULT_DISABLE([c-stubdom], [c])
+AX_STUBDOM_DEFAULT_DISABLE([rust-stubdom], [rust])
 AX_STUBDOM_DEFAULT_DISABLE([caml-stubdom], [caml])
 AX_STUBDOM_DEFAULT_ENABLE([pv-grub], [grub])
 AX_STUBDOM_DEFAULT_ENABLE([xenstore-stubdom], [xenstore])

Check out this repo in the xen/stubdom folder: xen/stubdom $ git clone https://github.com/sprout42/xen-rust.git rust

Enable the rust stubdom when configuring Xen: xen $ PYTHON_PREFIX_ARG=--install-layout=deb ./configure --prefix=/usr --enable-stubdom --enable-rust-stubdom

Either compile all of xen (make dist) or just the rust stubdom: xen\stubdom $ make rust-stubdom

Clone this wiki locally