When debugging Qemu, it might be helpoful to instrument Linux Kernel to see when interrupts get received, or see data on the other side of a transfer. If you have to modify the Kernel on a regular basis, it can be faster to build it in place than to build a customer RPM/DEB and install inside the VM. Here is how I have been going about updating the kernel.
Table of contents
In order for this to work, your VM and your Hypervisor should be running a compatable version of the Toolchain used to build the kernel. I would suggest using a common Fedora/Ubuntu version for both machines.
NFS on the Hypervisor
We are going to use the Network File System (NFS) to share files between the Hypervisor and the Virtual machine. There are many steps to setting up NFS, and I did not record all of the permutations I tried to get it to work. I do know I had to: install RPMS, figure out what directories to export, and make sure the NFS daemon was running.
I can see that I have these two services running:
nfs-mountd.service
nfs-server.service
I aslo see I have these RPM installed
rpmquery -a | grep nfs
libnfsidmap-2.8.3-2.rc3.fc42.aarch64
sssd-nfs-idmap-2.11.1-1.fc42.aarch64
libnfs-6.0.2-6.fc42.aarch64
libnfs-devel-6.0.2-6.fc42.aarch64
nfs-utils-2.8.3-2.rc3.fc42.aarch64
qemu-block-nfs-9.2.4-2.fc42.aarch64
My file /etc/nfs.conf is unchanged from the default install
In my install, the exports are in /etc/exports.d/adam.exports and look like this:
/home/ayoung *(rw,sync,insecure,all_squash,anonuid=6352,anongid=65603)
/home/grose *(rw,sync,insecure,all_squash,anonuid=1000,anongid=1001)
NFS Client in the VM
The IP address is that of the Hypervisor. Adapt to your network settings.
I keep both the Hypervisor and VM directories consistent
mount -t nfs4 10.76.112.72:/home/ayoung /home/ayoung
Build the Kernel on The Hypervisor
Run the following commands inside your Linux directory on your hypervisor. I have mine in /home/ayoung/linux.
make -j $(nproc) && make -j $(nproc)
Install the Kernel in the VM
Since the Linux directory above is mounted in the VM at /home/ayoung/linux, I can complete the install process inside the VM.
make -j $(nproc) modules_install && make -j $(nproc) install
reboot