Using the StallGov governor requires some minor changes to the linux kernel.
Follow these steps:
- Download kernel sources (e.g.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
orgit clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
) - Copy your config into the downloaded source (
cd linux-stable
andcp /boot/config-
uname -r`* .config - make menuconfig to adjust the config if needed (also sets newly available config options to the default)
- Open the .config and adjust
CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem"
toCONFIG_SYSTEM_TRUSTED_KEYS=""
. It can happen that the same has to be done forCONFIG_SYSTEM_REVOCATION_KEYS
5a. On ubuntu or similar distrosmake bindeb-pkg LOCALVERSION=-custom
and install the resulting header package and an image package (e.g.linux-headers-5.11.22-custom_5.11.22-custom-4_amd64.deb
andlinux-image-5.11.22-custom_5.11.22-custom-4_amd64.deb
) (they are in the folder that contains the git repo) withdpkg -i <package>
5b. Otherwisemake install
might also work
- In your kernel directory, go to
/tools/power/cpupower/
- Install dependencies if neccessary:
gettext libpci-dev libelf-dev libpopt-dev
sudo make install
- You might have to add the resulting libraries to the lookup path in
/etc/ld.so.conf
by adding a line with/usr/lib64/
, then runsudo ldconfig
cpupower
should now work
Adjust the config when compiling the kernel, some sample changes used to find a memory corruption are in the resources/kasan-config.patch.
Based on http://nickdesaulniers.github.io/blog/2018/10/24/booting-a-custom-linux-kernel-in-qemu-and-debugging-it-with-gdb/ and https://spyff.github.io/linux/2018/07/20/qemu-vm/
- Use a default config as the start (i.e.
make defconfig
) and adjust it for kvm withmake kvm_guest.config
) - Build the kernel with
make
- Get qemu
- Do
echo "add-auto-load-safe-path path/to/linux/scripts/gdb/vmlinux-gdb.py" >> ~/.gdbinit
if needed - Get an ubuntu cloud image, e.g. https://cloud-images.ubuntu.com/eoan/current/eoan-server-cloudimg-amd64.img
- Create an image based on the downloaded one
qemu-img create -f qcow2 -b eoan-server-cloudimg-amd64.img ubuntu.img
- Create the init.yaml as
#cloud-config
hostname: ubu
users:
- name: myusername
ssh-authorized-keys:
- ssh-rsa AAAAB3Nz[...]34twdf/ myusername@pc
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: sudo
shell: /bin/bash
with your own public ssh key and create the init.img as cloud-localds init.img init.yaml
8. Run qemu with the kernel and images: qemu-system-x86_64 -kernel arch/x86_64/boot/bzImage -machine accel=kvm,type=q35 --append "root=/dev/sda1 console=ttyS0" -hda ubuntu.img -hdb init.img -m 2048 --nographic -netdev user,id=net0,hostfwd=tcp::2222-:22 -device virtio-net-pci,netdev=net0
9. Connect via ssh as ssh 0 -p2222
10. If anything goes wrong with the initialization (via init.img) the ubuntu.img has to be recreated to force initialization to happen again