9

In my Operating Systems class we are looking to modify a Linux kernel with some simple system calls of our own in C.

What would be a good distro suited for this purpose? We don't need any frills, no GUI, a vanilla kernel, etc. The more basic the better.

Michał Piaskowski
  • 3,800
  • 2
  • 34
  • 46
mmcdole
  • 91,488
  • 60
  • 186
  • 222
  • @Torsten Marek, A distro that uses a vanilla, unmodified kernel, possibly an older version that is less complex than > 2.6 linux kernels. – mmcdole Feb 04 '09 at 20:36

11 Answers11

9

I was able to modify the kernel pretty easily using a minimal Gentoo install. Just install gentoo, follow the installation instructions, then:

$ emerge gentoo-sources
$ emerge emacs
$ cd /usr/src/linux
Tom Ritter
  • 99,986
  • 30
  • 138
  • 174
  • +1 for the commands it takes to get "just enough to edit/compile a kernel", awesome – dlamotte Feb 17 '10 at 22:50
  • 1
    +1 i believe genkernel is the best tool chain to utilize , much easier than any DEB / RPM based distro. – daisy Dec 25 '11 at 09:44
6

In my operating systems course last semester we used User Mode Linux, the big advantage being that when you hose the system, you can simply kill the process with no risk to the host environment.

Adding/Modifying system calls is tedious but trivial regardless of the kernel you use. However the 2.6 kernel is significantly more massive and complex, so if you're going to be modifying the code in a significant way the older kernels are easier to work with and much better documented. (ie: easier to find books and references)

Happy hacking :)

vinc456
  • 2,862
  • 5
  • 23
  • 30
  • +1 for UML. If only HURD could do this - its a smaller, more immature kernel with more places that can be improved. – new123456 Oct 17 '10 at 19:31
5

archlinux++

but really.. gentoo, slack, and arch are all more-or-less good choices

3

Arch Linux provides a great platform for kernel development that is also very functional. If you learn to use pacman, it will actually make testing your kernel modifications quite easily and provides the sources and tools in a sane manner.

I do think that if you are serious about learning linux and kernel hacking, doing a Linux From Scratch install should be on your list. It's a great distro/book and will let you build the platform for development yourself.

neorab
  • 109
  • 2
2

On all distributions, you can install the vanilla kernel.org sources instead of the distribution-related kernel packages, which is probably a good idea anyway when you want to do kernel development.

However, you'll be in trouble when you want to use any recent distribution with non-2.6 kernels, because they often build libc6 in a way that it cannot run with 2.4. Additionally, a lot of the guts of hardware management (like udev) require fairly recent kernels.

Apart from that, using Debian gives you a barebone system, and installing your own kernels is a breeze with kernel-package.

Torsten Marek
  • 83,780
  • 21
  • 91
  • 98
1

I wouldn't necessarily say any particular distro is geared towards kernel development as such, but if you want a traditional Linux distro that doesn't pile too much custom configuration stuff between you and the kernel, Slackware is a decent choice.

bobince
  • 528,062
  • 107
  • 651
  • 834
1

My suggestion is to grab the latest kernel. There will be more debugging features inside it than in an older kernel. Also, older kernels would pretty much look just as complex as the most recent to the newbie.

As for the distribution itself, you can't really go wrong. If all you want is to try some custom system calls, then grab whatever mainstream distribution which gives you a nice development environment. Then compile and try your customized glibc without installing it over the distro's.

0

A non-linux alternative is Geek OS, but this is very much aimed at the educational level, and is not a practical kernel. It is ultra-simple though.

Mike A
  • 1,273
  • 12
  • 13
0

well I have found one called "minix" it isn't really a linux distro, but it was made specifically for teaching, but if you can only use a linux distro, then it shouldn't matter, I am pretty sure all distros have the same kernel

noah
  • 91
  • 1
  • 2
0

When choosing a distro for kernel development, remember that it's the kernel you want to hack, not the distro itself. You will therefor want an easy distro that stays out of your way as much as possible. Ubuntu says out of the way fairly nicely.

IANAKH

SingleNegationElimination
  • 151,563
  • 33
  • 264
  • 304
0

Gentoo if you dont mind automated compilation (most people think that gentoo is Linux From Scratch => you have to do everything on your own).

Arch if you have slower computer (laptop).

Biggest advantage of these two is that they have very very good documentation and only installing Gentoo f.e. gives you basic knowledge about init system and what services has to run. If one copy&paste commands from guide it's worthless though (luckily handbook makes people think a bit, thus preventing kids from installing gentoo and taking over our neat #irc) :D

Tomas Pruzina
  • 8,397
  • 6
  • 26
  • 39