Skip to content

Instantly share code, notes, and snippets.

@elazarl
Last active December 4, 2016 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elazarl/a29e6b4948e9cfac5d79712a774c4a56 to your computer and use it in GitHub Desktop.
Save elazarl/a29e6b4948e9cfac5d79712a774c4a56 to your computer and use it in GitHub Desktop.
Setup Xen development environment
setup xen environment

These are two scripts to set up Xen compilation environment.

Clone Xen with

git clone git://xenbits.xen.org/xen.git

Clone this repository

git clone https://gist.github.com/elazarl/a29e6b4948e9cfac5d79712a774c4a56 xenscripts

Then, prepare a development environment with

bash -xv prepare_build_env.sh

We assume you do not have a current pbuilder environment for other purposes.

Enter the build environment with

pbuilder --login --bindmount ~

Then build xen in your environment with

./configure --enable-systemd
make debball

You'll create a debian package in dist which you'll need to install on the server.

On the Xen server, install Ubuntu 16.04, then run the prepare_xen_server.sh once on the server after installing the xen debian package.

You can easily run prepare_xen_server.sh with

./prepare_xen_server.sh REMOTE_SSH_SERVER_IP

It would copy the script there, and run it.

Finally, reboot, and you'll have a working Xen.

Verify with xl info

#!/bin/bash -vx
set -e
sudo apt install pbuilder
[ ! -f /var/cache/pbuilder/base.tgz ] && sudo pbuilder --create --distribution xenial --othermirror 'deb http://il.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse'
DEPS=/tmp/$USER-$$-dep-install
echo -e '#!/bin/bash -xv\napt-get install -y wget curl ftp autotools-dev debhelper dpkg-dev lsb-release python-dev bcc gcc-multilib e2fslibs-dev iasl seabios libaio-dev libfdt-dev libglib2.0-dev liblzma-dev libncurses5-dev libpixman-1-dev libyajl-dev libssl-dev pkg-config uuid-dev zlib1g-dev libsystemd-dev texinfo fakeroot libbz2-dev ocaml-findlib m4 transfig ghostscript ocaml-nox git cmake' > $DEPS
trap "rm $DEPS" EXIT
chmod +x $DEPS
sudo pbuilder --execute --save-after-exec $DEPS
#!/bin/bash
if [ -n "$1" ]; then
ssh $@ 'cat ->/tmp/prepare.sh;chmod 0744 /tmp/prepare.sh' < $BASH_SOURCE
ssh $@ 'sudo /tmp/prepare.sh'
exit 0
fi
#install dependencies
apt install libyajl-dev libaio-dev libpixman-1-dev libfdt-dev
#start required service
systemctl enable xencommons
systemctl start xencommons
# Make xen the default boot loader
dpkg-divert --divert /etc/grub.d/09_linux_xen --rename /etc/grub.d/20_linux_xen
update-grub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment