No Budget!

How many cores?

Compilation was done on some enterprise-class IBM servers dating 2007 with 4x4 Xeon processors and 96 GB or RAM. For 16 cores in total and with 1 thread per core (lscpu), I obtained the fastest results with -j16 for xen versus -j24 for tools and stubdom. Anyway, tune the number of make jobs according to your hardware.

Overall requirements (xen + tools + stubdom)

for pkg in \
    bison \
    flex \
    gcc \
    git \
    glibc \
    make \
    openssl \
    patch \
    pciutils \
    texinfo \
    ; do
    echo -n $pkg:
    ls -1 /var/log/packages/ | grep ^$pkg-[[:digit:]]
done; unset pkg

Compiling XEN (the micro-kernel)

fetch the latest release e.g.,

cd ~/
wget https://downloads.xenproject.org/release/xen/4.10.0/xen-4.10.0.tar.gz
wget https://downloads.xenproject.org/release/xen/4.10.0/xen-4.10.0.tar.gz.sig
gpg xen-4.10.0.tar.gz.sig
gpg --recv-key 57E82BD9
gpg xen-4.10.0.tar.gz.sig
#
# Primary key fingerprint: 23E3 222C 145F 4475 FA80  60A7 83FE 14C9 57E8 2BD9
#

note. if you want current,

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

compile,

tar xzf xen-4.10.0.tar.gz
cd xen-4.10.0/
#make clean-xen
time make -j16 xen > make.xen.log && echo done
#tail -F make.xen.log
time make install-xen > make.installxen.log && echo done
#tail -F make.installxen.log
ls -lhF /boot/xen.gz
ls -lhF /boot/xen-4.10.0.gz

Tools and Stubdom requirements

installing the latest ACPICA,

cd ~/
wget https://acpica.org/sites/acpica/files/acpica-unix-20171215.tar.gz
#wget https://acpica.org/sites/acpica/files/acpica-unix2-20171215.tar.gz
tar xzf acpica-unix-20171215.tar.gz
cd acpica-unix-20171215/
time make -j24 > make.acpica.log && echo done
make install
cd ../

installing pixman using Slackpkg,

slackpkg install pixman

installing yajl using sbopkg,

slackpkg search yajl
sbopkg -s yajl
sbopkg -i yajl

installing the corresponding multilib version of gcc and glibc (and installing compat32-tools),

cd ~/
mkdir -p 14.2/
cd 14.2/
lftp -c 'open http://slackware.com/~alien/multilib/ ; mget -c 14.2/*'
upgradepkg --reinstall --install-new *.t?z
ls -1 /var/log/packages/ | grep ^compat32-tools-[[:digit:]]
ls -1 /var/log/packages/ | grep ^glibc-[[:digit:]]
ls -1 /var/log/packages/ | grep ^gcc-[[:digit:]]

Compiling the Tools and Stubdom

(XEN fetched previously) -- compile,

cd ~/xen-4.10.0/
which bcc-cpp
export PATH=$PATH:/usr/lib64/bcc
./configure

#make distclean
#time make -j24 world > make.world.log && echo done
#tail -F make.world.log

#make clean-tools
time make -j24 tools > make.tools.log && echo done
#tail -F make.tools.log

#slack3
#real   2m57.747s
#user   15m59.347s
#sys    4m27.916s

#make clean-stubdom
time make -j24 stubdom > make.stubdom.log && echo done
#tail -F make.stubdom.log

make install-tools
make install-stubdom

Compiling the Linux dom0 kernel

4.2 required, Slackware 14.2 has 4.4

building the dom0 capable kernel (this also makes it domU capable but we do not care!),

ls -lhF /usr/src/
cd /usr/src/linux/
make distclean
#make mrproper

cp -pi Makefile Makefile.dist
vi Makefile

EXTRAVERSION = .dom0

diff -bu Makefile.dist Makefile

ls -al .config # does not exist yet
ls -al /boot/config*
cp /boot/config-huge-4.4.88 .config
make xenconfig

grep CONFIG_DEBUG_INFO .config
grep CONFIG_CRASH_DUMP .config
grep CONFIG_PROC_VMCORE .config
grep CONFIG_UFS .config
cat >> .config <<-EOF9
CONFIG_DEBUG_INFO=y
CONFIG_CRASH_DUMP=y
CONFIG_PROC_VMCORE=y
CONFIG_UFS_FS=y
CONFIG_UFS_FS_WRITE=y
EOF9
make silentoldconfig

time make -j24 > make.log && echo done
#tail -F make.log

#real   14m59.666s
#user   188m25.223s
#sys    39m3.343s

#real   22m18.284s
#user   225m46.046s
#sys    76m45.694s

ls -lhF /lib/modules/
#rm -rf /lib/modules/.../
make modules_install

this does not harm even though we might switch to extlinux,

ls -l /boot/vmlinuz.old
mv /etc/lilo.conf /etc/lilo.conf.dist
sed '/^$/d; /^#/d' /etc/lilo.conf.dist > /etc/lilo.conf
cat >> /etc/lilo.conf <<-EOF
#image = /boot/vmlinuz-huge-4.4.88
image = /boot/vmlinuz.old
  root = /dev/sda1
  label = slack4488
  read-only
EOF
make install
ls -l /boot/config
mv /boot/config /boot/config.old
cp .config /boot/config

note. assuming lba32 and timeout = 100 (10 seconds) have already been set up.

(optional) -- eventually try to boot this xen-enabled kernel w/o xen as hypervisor,

#sync
#shutdown -r now

Preparing the initrd

The XEN-enabled kernel needs an initrd to avoid kernel panic (attempted to kill init!),

cd /boot/
mkinitrd -c -o initrd.gz -k 4.4.88 -r /dev/sda1

Booting with mbootpack

slackpkg search mbootpack
sbopkg -s mbootpack
sbopkg -i mbootpack
cd /boot/
zcat xen-4.10.0.gz > xen-4.10.0
zcat initrd.gz > initrd
mbootpack -o xenvmlinuz -m vmlinuz -m initrd xen-4.10.0
vi /etc/lilo.conf

default = xen4488
#default = slack4488

image = /boot/xenvmlinuz
  root = /dev/sda1
  initrd = /boot/initrd.gz
  label = xen4488
  read-only

lilo
sync
shutdown -r now

notes.

  • assuming lba32 and timeout has already set to 100 (10 seconds).
  • mkinitrd also works from the installer while chrooting into the system (possibly even w.o chrooting into it)

refs.

Booting with SYSLINUX/EXTLINUX

See Booting GNU/Linux or XEN with EXTLINUX.

Networking

See XEN // Networking.

Ready to go

cat /sys/hypervisor/properties/capabilities

cp -pi /etc/ld.so.conf /etc/ld.so.conf.dist
cat >> /etc/ld.so.conf <<-EOF
/usr/local/lib
EOF
cat /etc/ld.so.conf
ldconfig

/etc/rc.d/init.d/xencommons start
cat >> /etc/rc.d/rc.local <<-EOF
#self verbose
/etc/rc.d/init.d/xencommons start
EOF

cat /proc/xen/capabilities
xl li

cat /sys/class/net/bond0/bonding/miimon
cat /sys/class/net/bond0/bonding/mode 
cat /sys/class/net/bond0/bonding/lacp_rate
brctl show

libvirt capable (optional)

slackpkg install libpciaccess
sbopkg -i libvirt
sbopkg -i libvirt-python
sbopkg -i virt-manager
sbopkg -i virt-viewer

cat /etc/sysctl.d/60-libvirtd.conf
sysctl fs.aio-max-nr=1048576

/usr/sbin/libvirtd -d
cat >> /etc/rc.local <<-EOF

echo -n starting libvirt...
/usr/sbin/libvirtd -d && echo done
EOF

virsh list

References

OBSOLETE

installing latest YAJL,

#cd ~/
#git clone git://github.com/lloyd/yajl
#./configure
#make -j24
#make install

mbootpack from source,

#cd ~/
#git clone https://github.com/timdeegan/mbootpack.git
#cd mbootpack/
#make
#cp mbootpack /usr/local/bin/

install,

#cp xen/xen.gz /xen4100.gz
#ls -lhF /xen.gz
#ln -sf xen4100.gz /xen.gz

mounted by xencommons,

cat >> /etc/fstab <<-EOF
xenfs /proc/xen xenfs defaults 0 0
EOF
mount /proc/xen/