How to quick test/debug in linux kernel?

From: jwbda
Date: Fri Aug 16 2024 - 07:05:49 EST



Hi guys, would you mind help me with this:
How to quick test/debug in linux kernel?

Here is my method:
Make some changes to the source code, add this line of code `printk(KERN_INFO ">>> run in kernel!\n");`

Then compile and run

```sh
make -j12
sudo qemu-system-x86_64 -hda ./mybuild/mylinux.img -m 4096 --enable-kvm -kernel ./linux/arch/x86_64/boot/bzImage -append "root=/dev/sda rw console=ttyS0" -nographic
```
Then check the results in the console. But I think this method is still a bit cumbersome. May I ask how do you quickly test/debug in linux kernel?