Nethence Newdoc Olddoc Lab Your IP BBDock  

Compiling a XEN domU Linux kernel

cd /usr/src/linux/

make distclean
#https://www.kernel.org/doc/makehelp.txt
#make mrproper
ls -lhF .config* # should not exist

#diff -bu Makefile.dist Makefile
cp -pi Makefile Makefile.dist
vi Makefile

EXTRAVERSION = .domu

make help | grep defconfig
#make ARCH=x86_64 tinyconfig
make ARCH=x86_64 defconfig

cat >> .config <<-EOF0
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_XEN=y
CONFIG_PARAVIRT_GUEST=y
CONFIG_PARAVIRT_SPINLOCKS=y
CONFIG_HVC_DRIVER=y
CONFIG_HVC_XEN=y
CONFIG_XEN_FBDEV_FRONTEND=y
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
CONFIG_XEN_PCIDEV_FRONTEND=y
CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
CONFIG_XEN_FBDEV_FRONTEND=y
CONFIG_XEN_XENBUS_FRONTEND=y
CONFIG_XEN_SAVE_RESTORE=y
#CONFIG_XEN_GRANT_DEV_ALLOC=m
CONFIG_XEN_GRANT_DEV_ALLOC=y
CONFIG_XEN_TMEM=y
CONFIG_CLEANCACHE=y
CONFIG_FRONTSWAP=y
CONFIG_XEN_SELFBALLOONING=y
CONFIG_BTRFS_FS=y
CONFIG_GFS2_FS=y
CONFIG_JFS_FS=y
CONFIG_REISERFS_FS=y
CONFIG_XFS_FS=y
EOF0
tail .config

grep =m$ .config
mv .config .config.m
sed 's/=m$/=n/' .config.m > .config

make silentoldconfig
ENTER
ENTER
...

grep =m$ .config
mv .config .config.mx
sed 's/=m$/=y/' .config.mx > .config

time make -j16

#real   2m27.343s
#user   25m56.214s
#sys    6m47.455s

ls -lF arch/x86/boot/bzImage # 7537056 bytes
cp -f arch/x86/boot/bzImage /data/kernels/vmlinuz.4.4.88.domu
cp -f .config /data/kernels/vmlinuz.4.4.88.domu.config

update the guests' configuration,

kernel = "/data/kernels/vmlinuz.4.4.88.domu"

Troubleshooting

if you get this error while booting the guest,

No filesystem could mount root, tried:  ext3 ext2 ext4 vfat msdos iso9660
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(202,1)

==> it may see the disk, however the filesystem driver is missing (here CONFIG_XFS_FS=y)

References

trash

CONFIG_BRIDGE=y
CONFIG_VLAN_8021Q=y
CONFIG_BRIDGE_NF_EBTABLES=y
CONFIG_BRIDGE_EBT_BROUTE=y
CONFIG_BRIDGE_EBT_T_FILTER=y
CONFIG_BRIDGE_EBT_T_NAT=y
CONFIG_BRIDGE_EBT_802_3=y
CONFIG_BRIDGE_EBT_AMONG=y
CONFIG_BRIDGE_EBT_ARP=y
CONFIG_BRIDGE_EBT_IP=y
CONFIG_BRIDGE_EBT_IP6=y
CONFIG_BRIDGE_EBT_LIMIT=y
CONFIG_BRIDGE_EBT_MARK=y
CONFIG_BRIDGE_EBT_PKTTYPE=y
CONFIG_BRIDGE_EBT_STP=y
CONFIG_BRIDGE_EBT_VLAN=y
CONFIG_BRIDGE_EBT_ARPREPLY=y
CONFIG_BRIDGE_EBT_DNAT=y
CONFIG_BRIDGE_EBT_MARK_T=y
CONFIG_BRIDGE_EBT_REDIRECT=y
CONFIG_BRIDGE_EBT_SNAT=y
CONFIG_BRIDGE_EBT_LOG=y
CONFIG_BRIDGE_EBT_NFLOG=y
CONFIG_INFINIBAND=y
CONFIG_INFINIBAND_ISER=y
CONFIG_SCSI_LOWLEVEL=y
CONFIG_ISCSI_TCP=y

grep ^CONFIG_BRIDGE .config
grep ^CONFIG_VLAN_8021Q .config
grep ^CONFIG_INFINIBAND_ISER .config
grep ^CONFIG_SCSI_LOWLEVEL .config
grep ^CONFIG_ISCSI_TCP .config


#ls -lhF /lib/modules/
#rm -rf /lib/modules/4.4.14.domu/
#make modules_install
#rm -f /data/guests/vmlinuz.4.4.14.domu.modules.tar.gz
#tar czpf /data/guests/vmlinuz.4.4.14.domu.modules.tar.gz /lib/modules/4.4.14.domu/

you also need to update the guests e.g.,

cd /data/guests/
xl shu guest1 && xl console guest1
mkdir lala/
mount -o loop guest1/guest1.img lala/
rm -rf lala/lib/modules/4.4.14.domu/
tar xzf vmlinuz.4.4.14.domu.modules.tar.gz -C lala/
ls -ldhF lala/lib/modules/4.4.14.domu/
umount lala/
rmdir lala/
xl create guest1/guest1 -c
#depmod -a

Home | GitHub | Docker Hub | Donate | Contact