Search code examples
linux-kernelkernellinux-device-driverdriversmethodology

How safe is that to develop a simple linux kernel module/driver on my own machine?


I'm writing a simple kernel character device driver, and I wonder how safe is it to do it on my own machine's OS instead of on a VM.

Could a kernel panic be destructive?


Solution

  • I had these issues when I started writing device drivers.

    1. System hangs - These happen to every kernel newbie. They're caused by the Linux kernel is doing useless work repeatedly. You won't even be able to move the mouse.
    2. Kernel crashes - Messages like 'System program problem detected' appear when you boot into your system again.
    3. As you start writing advanced drivers like network device drivers, your Ethernet or wireless cards may stop working. Restarting your system might fix this issue, but it might not.

    A real kernel developer doesn't mess around with VMs. Don't be afraid to test and code on real machine. I compiled a separate kernel exclusively for testing device drivers. I have one kernel for testing and another for application programming.

    If you want to test drivers on a newly built kernel, this is a nice guide on installing a new kernel.