Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been working in embedded OS like uCOS, ThreadX. While I have coded apps in Linux, now I’m planning to start learning Linux Kernel. I have few questions regarding the environment.

  1. Which is best distro, which has easy to use tools for kernel development? (so far I had used RHEL and Fedora. While I am comfortable with these, it also looks like Ubuntu has in-built scripts for easy kernel compilation like make_kpkg, etc)

  2. Can you describe the best setup for kernel debugging? While debugging other embedded OSes, I have used serial port to dump progress, JTAG, etc. Which kind of setup does the Linux kernel devs use? (Will my testbed PC with serial port is enough for my needs? If yes, how to configure the kernel to dump to serial port?) I'm planning to redirect kernel messages to serial console which will be read in my laptop.

  3. What tool is best for debugging and tracing kernel code? As mentioned earlier, is serial console the only way? Or any IDE/JTAG kind of interface exists for PC?

share|improve this question
For #1, Linus himself uses Fedora, so that possibly says something. I don't know enough on this topic to really give an answer, but I'd be interested in what other people say. – jonescb Mar 16 '11 at 12:58
make_kpkg comes from Debian, which Ubuntu is based on and my fav distro ;) – Deleted Account Mar 16 '11 at 22:50
up vote 15 down vote accepted

My personal flavor for Linux Kernel development is Debian. Now for your points:

  1. As you probably guessed Ubuntu doesn't bring nothing new to kernel ease kernel development afaik, apart from what's already available in Debian. For e.g. make_kpkg is a Debian feat. and not Ubuntu. Here are some links to get you started on common Linux Kernel development tasks in Debian:

  2. The easiest way to do kernel debugging is using QEMU and gdb. Some links to get you started:

    Though, you should be aware that this method is not viable for certain scenarios like specific hardware issues debugging and such, for which you would be better of using physical serial debugging and real hardware. For this you can use KGDB(it works using ethernet too). KDB is also a good choice. Oh, and by the way, both KGDB and KDB have been merged into the Linux Kernel. More on those two here. Another cool method, which works marvelously for non-hardware related issues, is using the User-mode Linux Kernel. Running the Kernel in user-mode as any other process allows you to debug it just like any other program(examples). More on User-mode Linux here. UML is part of the Linux Kernel since 2.6.0 , thus you can build any official kernel version above that into UML mode by following these steps.

  3. See 2. Unfortunately there is no best here, since each tool/method has its pro's and con's.

Hope this helps you start your crazy journey in Linux Kernel Development.

share|improve this answer
Thanks! for the detailed reply. BTW i am intrested in fs and bio subsystems in kernel. which kind of setup would be best for me ? – rajaganesh87 Mar 17 '11 at 11:20
UML and QEMU is probably the way to go, since you can easily play with filesystems at no cost. – Shinnok Mar 18 '11 at 14:59
Very good links, just one thing. My favourite is debian too, but Kernel Development can be made with any distro. Maybe slack is the best way if you're purist since it uses a vanilla kernel, but configs aren't bad stuff, you'ill find your best. – D4RIO Mar 18 '11 at 15:21

If you're developing for an embedded platform that's not based on i386 hardware, you'll need to cross-compile. The Emdebian project provides toolchains to develop for many architectures (ARM, m68k, MIPS and more) on PCs (i386 or amd64). That means under Debian, you can simply add the repositories and apt-get install the toolchain for the target(s) of your choice.

share|improve this answer
Thanks for the useful link. – rajaganesh87 Mar 17 '11 at 12:43

JTAG probes do exist, but these are fairly expensive (and the companies building them have exclusive contracts). The best way to debug kernel code is to start it in kvm or qemu with gdbserver inside the emulation.

share|improve this answer
Even better, use User Mode Linux. Linux as a regular userland process. – vonbrand Jan 18 '13 at 0:54

Essentially any mainline distribution should work fine for this (they use their own distribution to hack on it). Use whatever feels more confortable.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.