This gist aims at building Linux from source-code and deploying it as HVM guest in Xen by using xl.
We use v5.10.17 tag (13b6016). We first build .config
by issuing:
make localmodconfig
To enable debug symbols, you can set:
CONFIG_DEBUG_INFO_NONE=y
We have to create a minimal initramfs, we do it by following https://landley.net/writing/rootfs-howto.html.
The initramfs_list
is:
dir /dev 755 0 0
nod /dev/console 644 0 0 c 5 1
nod /dev/tty0 644 0 0 c 4 0
nod /dev/hvc0 644 0 0 c 229 0
file /init usr/hello 755 0 0
This creates a initramfs that includes a simple Hello World (It must be statically compiled!). We compile by using:
make vmlinux
To deploy as a guest, we copy vmlinux (uncompressed linux image) and the following cfg in Xen:
extra="console=hvc0 earlyprintk=xen initcall_debug debug"
kernel="/home/pepo/vmlinux"
memory=1024
vcpus=1
name="myguest"
# store dump if crash or poweroff
# in /var/lib/xen/dump/NAME
on_crash="coredump-destroy"
on_poweroff="coredump-destroy"
To create the guest, we issue:
xl create -f linux.cfg -c