Wannabe a kernel hacker???

This post is for an absolute beginner… 🙂

Linux kernel can be very intimidating and I am still struggling to catchup with the code. I was fascinated by list.h that gives an implementation of a generic linked list merely using macros! 🙂 I was helped through the process management by a colleague – a good place to start. I loved the bit on scheduling and the neat tricks used there. A lot of people wud advise u to join the lkml mailing list but it would be good to know something so that u can understand the exchanges there. kernelnewbies is a better place to be.

I can recommend a lot of stuff but will do it in an order that will help. For those who love crash courses here is a nice one – http://www.freesoftwaremagazine.com/articles/drivers_linux. Can download the PDF and try the module quickly. The 2nd example requires a hardware. If u can get that it wud be help greatly in understanding.

LinuxKernelDevelopment-RoberLoveYou should get yourself a copy of Linux Kernel Development by Robert Love. It is a very good place to start and will briefly discuss code snippets to get you started and clears the concepts very well.

You can start working on Linux Device Drivers (LDD) by Alessandro Rubini (a handy set of chapters in PDF available online and helps since u can use while coding) soon after or in parallel. The coding examples in this book are a must!!! I am not sure I can this book enuf!!! 🙂 I got a hard copy of the same despite the free soft copy. I lost it and I m getting another copy. Trust me it is worth it – don’t take a print – get the book!!!

Recently I tried Understanding the Linux Kernel by Bovet – the latest edition and it is pretty detailed if you are interested in further details.

The most important link I found was –

http://free-electrons.com/training/drivers (Best link to get started off! A good site for other stuff as well)

This single presentation has very good pointers and is pretty up to date unlike other links.

A good link to begin from:

http://www.ibm.com/developerworks/linux/library/l-linux-kernel

Mind the resource section of any IBM link – they are pretty neat!!! 🙂

Also recently I bumped into the following link:

http://www.ibm.com/developerworks/linux/library/l-linuxboot/

This has the boot process discussed very well.

Also a friend who has written a 32 bit OS had posted the following :

http://www.freeos.com/articles/4536

This is dated but he gives tips on how to get started! I would have advised to go thru the following link and start from main.c

http://www.ibm.com/developerworks/linux/library/l-initrd.html (briefly mentions the first few api invoked)

but then it is very difficult. Like Karthick mentions it will be good start with isolated bits like ipc and then move to process management, etc.

I have my bookmarks available on Linux Kernel Internels at –

http://del.icio.us/mynk/lki

Finally I wud like to share the most interesting link on this subject – not useful technically but just to know that a Doctor turned into a hacker merely looking at Kernel code (he did not know C!!!) and also delivered patches!!!

http://kerneltrap.org/node/465
http://apcmag.com/why_i_quit_kernel_developer_con_kolivas.htm

I have found it hard to remember the changes between 2.4 and 2.6 so recommend u to stick to 2.6 as far as possible. The following link is good on the changes b/n the two:

http://kniggit.net/wwol26.html

I shall try and keep updating this post. If you do have some good pointers as well please share in the comments. Spammers please excuse! 🙂

Finaly delving into the sources:

The source is the best place to dig into and my initial struggle was to get the ctags and cscope work right. With the many architectures supported it has always been difficult to late the right tag. A friend suggested

make ctags && make cscope

in the kernel source directory. To build for a specific architecture you need to specifiy the same. For example,

make ARCH=arm ctags && make ARCH=arm cscope

You may want to add –extra=+f option in the Makefile agains the ctags command. Helps you tag into the files additionally.

With this in place you could use your favorite editor (if not emacs or vim – MUST reconsider! :)).

——————————————————

PS: This blog was started on blogger – http://techydodo.blogspot.com/ but since I would be a _staunch_ supporter of open source & I thought it would be best to move to an open source tool for a blog on technology! 🙂 Will migrate rest of my blogs in some time… 🙂

Comments 2

Author Details

  1. hello, i’m a student of computer eng(hardware)and at the moment i’m working on a project which is about USB driver programming in linux.i use kernell 2.6.18(fedora core). i have run a simple module in it(i mean that famous hello module)but after that i tried to run some other modules such as pci modules but i faced with some problems…maybe the program it self has some problems…so…is there any persons here that has a source code of a simple usb or pci drivers?i would be really thankful for your attention.

Mayank Rungta

Leave A Comment?