I Got in the Kernel and So Can You
Aaron Grothe
Intro
- "Who am I? Why am I here" - Adm. James Stockdale
- Had a Linux Company named Heimdall Linux
- Tried to Revive the LKAP project
- Have a handful of patches in the Linux Kernel
- Have two projects about Linux Kernel Quality: linuxicc, linuxcpd
Heimdall Linux
- Heimdall Linux was a company developing Common Criteria evaluated Linux products
- During the process we helped confirm some other people's bugs and contributed to the repositioning on one bracket in the Linux Kernel :-)
- We did have dealing with the iptables/netfilter software as well, but it was
evolving so quickly we never really managed to contribute much to it
LKAP - Linux Kernel Audit Project
- LKAP attempt to audit the Linux Kernel similar to OpenBSD
- This is an idea that pops up every couple of years
- It would be a pretty thankless job which combined with arguing over which tools to use normally manages to kill it
- Most of the good parts are being handled by projects like the Kernel Janitor's project
- Might be due for another rebirth sometime soon
Handful of Patches
- Almost all of my patches are in the Crypto subsystem
- Crypto is a pretty friendly place to submit patches
Where do I Start?
Subscribe to several mailing lists
Hit several websites
References - Books
Keep in mind all books get out of date pretty quickly
- Linux Device Drivers
- Understanding the Linux Kernel
- Linux Kernel Development
- Kernel Projects for Linux
- Linux Core Kernel Commentary - 2nd edition covers 2.4
Linux Device Driver Toolkit
- The Linux Device Driver Toolkit is a complete toolkit that should have everything that a developer needs to develop a Linux Device driver
- It comes with a version of the Linux Device Drivers book
- It hasn't been updated in a while as the author is prepping a forth edition
How I got my Patches in
- I signed up for the LKML list and I read it for a while
- crypto interested me and I found a couple of algorithms that weren't supported
- I found implementations of them that were in the public domain
- I added them to the Linux Kernel on my Sparc and X86 boxes
- I ran and tested them
- I then submitted them to the crypto maintainer
- Viola
Where to Start?
- Figure out what interests you
- Filesystems
- Networking
- Memory
- Device Drivers
- Code Correctness
- Virtualization
- Power Saving/Suspend (Please do this)
Four Really Interesting Places to Contribute
Example How to Contribute to Nouveau Project
- Subscribe to the mailing list
- Start running a kernel with their patches
- Start running the git version of their patches
- Participate in Code Reviews and suggestions
- Turn in bug reports
- Contribute small patches
- Contribute large patches
What if I want to Start with something Big?
- You'll have to maintain your patch out of tree for a while
- I would recommend doing whatever it takes to get your code into the kernel
- Fighting for mindshare with an out of tree patch is tough
- The last real successful one that I knew of was the CK patch set, which was largely a role up of a lot of desktop scheduling patches
FAQs about Kernel Development
- Do I have to use GIT? No, but it helps
- Am I good enough to contribute to the kernel? Everybody can contribute to the kernel it is pretty open
- What is the biggest challenge for the kernel? Device drivers
Tips for Doing Kernel Stuff
- UML - User Mode Linux lets you run Linux kernel as a process
- using COW filesystems could be a huge difference maker when doing kernel work
- CCache - Cache for compiling C code helps out a lot
- Be ready for some setbacks, E.g. A bug was found in my implementation of Xtea pretty early :-(
- The Linux Kernel is a meritocracy and a technocracy. You can have the best code and if you don't have a track record it probably won't get in
- Sign off on your patches, not doing that makes you look like a newbie
Tips for Getting Your Code In
- Compile on multiple architectures
- x86 and x86/64 good
- x86 and sparc/powerpc better
- x86 and and x86/64 and sparc/powerpc better yet
- Make sure your patch applies cleanly
- Indent your code consistently
- If your code doesn't make it in, resubmit it later
- Submit your code right after a stable release so you can line up with the merge window.
Three Things to Be Cautious About Trying To Merge
- C++ support, this is brought up every couple of years and is savagely beaten down. Sometimes the suggester is slapped around as well :-)
- Security mechanism unless it has been well vetted. The SE Linux guys were pretty vicious to App Armor and SMACK
- Filesystems developing a filesystem that works well in all areas is pretty tough. This rule doesn't apply if you are adding support for an already existing filesystem that another OS uses
Two Projects that should be Merged
- ReiserFS4 - had problems in the past. ReiserFS(3) is largely not being developed for anymore so it is either 4 or bust
- AppArmor - at war with the SE/Linux folks. Now that the LSM is not going away because of SMACK this might be able to get in
My Next Kernel Projects
- Redoing LinuxICC and LinuxCPD to have history and trends
- Adding some additional compilers to LinuxICC including 64-bit ICC
- LinuxMetrics.org - site to do simple metrics on kernel over time such as cyclomatic complexity and the other usual
- Would like to write a version of tcpdrop for Linux. Unless somebody already has ;-)
- Would like to write a device driver for the Radioshark
Is Kernel development worth it?
- A lot of the cool stuff happens in userspace
- If I was going to do a filesystem I would at least prototype it with FUSE first
- I learned a lot by doing my stuff so I would say yes
- It also gives you the ultimate card to play in Linux kernel arguments.
- It usually goes like this
- "Do you have code in the kernel?",
- pause
- "Then shut up!!!"
Summary
- The Linux Kernel is an amazing piece of software
- The sheer amount of hardware it supports is amazing
- Even running your own kernel can teach you a lot about Linux
- Thanks for Listening :-)