11 ms·
Are there any good guides on compiling the Linux kernel from source and testing it on a VM? Many resources seem to assume that you want to install it next to yo
by LegionMammal978 2y ago
Are there any good guides on compiling the Linux kernel from source and testing it on a VM? Many resources seem to assume that you want to install it next to your existing kernel, but I'd prefer not to risk my filesystem or hardware if something goes wrong.
- exe34 2y agoyou could mount and chroot the vm image, and install into that.
- zamadatix 2y agoThe easiest thing is just to follow said guide in a VM. Setting up a full system VM is the simpler path since it's such a common tasks that all the VM tooling is already built around the idea you'll want to do that. If you absolutely must compile outside the VM for whatever reason you can just transfer the resulting files over. It's a bit of a dead end if your kernel issue has to do with your hardware of course. I once had to patch a bug about specific NVMe drives I was working with so there was no choice but to do that with the actual hardware.
- rwmj 2y agoYou can direct boot a local kernel with qemu: qemu-kvm -kernel /path/to/your/bzImage ...
- ndesaulniers 2y agoDon't forget the bajillion arch specific command line flags for qemu!
- ndesaulniers 2y agoWe have wrapper scripts around qemu that we use heavily for CI and development. https://github.com/ClangBuiltLinux/boot-utils https://github.com/ClangBuiltLinux/boot-utils https://docs.kernel.org/kbuild/llvm.html https://docs.kernel.org/kbuild/llvm.html
- commandersaki 2y agoWireguard testsuite comes with a pretty good userland for testing kernel facilities (obviously wireguard itself). It's been integrated in the kernel tree, I can't remember where, but it's great to use for experimentation.