Skip to content

Instantly share code, notes, and snippets.

@blackskygg
Last active March 5, 2017 14:53
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 blackskygg/2c1f63de6b96f035976dd44aaa39170b to your computer and use it in GitHub Desktop.
Save blackskygg/2c1f63de6b96f035976dd44aaa39170b to your computer and use it in GitHub Desktop.
build and install xen (from the source code) on my archlinux
#!/bin/bash
echo 'Patching EFI build...'
git checkout -- xen/arch/x86/Makefile
git checkout -- xen/arch/x86/efi/Makefile
git checkout -- xen/Makefile
sed -i.bak '/ EFI_LD/s/LD/LD_EFI/' xen/arch/x86/Makefile
sed -i.bak 's/LD/LD_EFI/' xen/arch/x86/efi/Makefile
sed -i.bak '/EFI_MOUNTPOINT .*/aLD_EFI ?= $(LD)' xen/Makefile
echo 'Fixing installation paths...'
git checkout -- m4/paths.m4
git checkout -- tools/ocaml/xenstored/define.ml
git checkout -- tools/ocaml/xenstored/systemd_stubs.c
sed -i 's:\$localstatedir/run/xen:/run/xen:' m4/paths.m4
sed -i 's:/var/run:/run:' tools/ocaml/xenstored/define.ml
sed -i 's:/var/run:/run:' tools/ocaml/xenstored/systemd_stubs.c
echo 'Configuring...'
./autogen.sh;
./configure \
PYTHON=/usr/bin/python2 \
--prefix=/usr \
--sbindir=/usr/bin \
--with-sysconfig-leaf-dir=conf.d \
--with-initddir=/etc/init.d \
--enable-systemd \
--disable-docs \
--with-extra-qemuu-configure-args="--disable-bluez --disable-gtk --enable-spice --enable-usb-redir";
#!/bin/bash
rm -rf destdir
mkdir destdir
echo 'Installing Xen...'
make DESTDIR=/home/sky/lab/repos/xen/destdir LANG=C PYTHON=python2 install
cd destdir
# Fix paths in scripts, move to right locations and create missing directories
echo 'Fixing paths...'
sed -i 's:/var/run:/run:' usr/lib/xen/bin/xenpvnetboot
sed -i 's:/var/run:/run:' usr/lib/xen/bin/pygrub
sed -i 's:/var/run:/run:' usr/bin/xenmon.py
mkdir -p var/log/xen/console
# Sanitize library path (if lib64 exists)
if [ -d usr/lib64 ]; then
echo 'Sanatizing library paths...'
cd usr/
mv lib64/* lib/
rmdir lib64
cd ../
fi
if [ -f usr/lib/efi/xen.efi ]; then
echo 'Moving efi binary...'
mv usr/lib/efi/xen*.efi "boot/"
rm -rf usr/lib/efi
fi
# Clean up
echo 'Cleaning up...'
# Hypervisor symlinks
rm -f boot/xen{,-4}{,.9}.{gz,efi}
# Documentation cleanup ( see xen-docs package )
rm -rf usr/share/doc
rm -rf usr/share/man
# Temporary directories
rmdir run/xen run/xenstored
# sysvinit scripts
rm -rf etc/init.d;
# Unnecessary qemu support files
rm usr/share/qemu-xen/qemu/{palcode,openbios}-*
rm usr/share/xen/qemu/openbios-*
# adhere to Static Library Packaging Guidelines
rm -f usr/lib/*.a
# Wow, that's dangerous
cp -rp . /
#!/bin/bash
export LD_EFI='/usr/x86_64-w64-mingw32/bin/ld'
echo 'Making xen'
make LANG=C PYTHON=python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment