Setup Recommendations

This page serves as a follow-up to Lab 3, where we discussed environment setup. Here, we outline essential tools, commands, and workflows for efficient kernel and C development.

Kernel Development

Testing and Virtualization with Virtme-ng

virtme-ng is a fast QEMU tool designed specifically for kernel development. Build your kernel with vng -bv and run it instantly with vng -v to see the startup messages. If a build fails, run vng -k followed by vng -bv to retry. For an interactive shell inside the VM, use vng -v -- /bin/bash -i. Conveniently, virtme-ng automatically installs your in-tree modules into the virtual machine, so you no longer need shared folders for your compiled module.ko files.

vng --user root is also recommended if you don’t want to enter your root password to load/unload modules in the VM!

IDE Integration with Clangd

Make your code editor understand kernel code by running ./scripts/clang-tools/gen_compile_commands.py. This generates a configuration file for a tool called clangd. Once set up, clangd indexes all kernel functions for quick navigation and automatically formats your code to match official Linux rules.

Code Style Verification

Always check your code formatting by running ./scripts/checkpatch.pl <c-files> to ensure it follows Linux rules. You can safely ignore the warning about the missing SPDX-License-Identifier tag, as it does not matter for local testing.

Back to top