where to start linux kernel programming? - linux-kernel

I have been programming in C for a couple of years in Linux. Now I want to work on linux kernel and contribute to kernel, if possible. I have been looking on the internet for the information about a starting point but I couldn't find one. So can any one please tell me where to begin?

I'm not a kernel person at all but I work with a lot of people who are very much into the kernel. They all recommend Linux Kernel Development by Robert Love as a good book on the subject. I've bought the book myself and plan to, in my copious free time, go through it.
The Kernel Mentors mailing list related resources at http://kernelnewbies.org/KernelMentors is also a good place to look at.

I would also recommend the site lxr.linux.no as a browsable source code repository.
It contains version 0.0.1 an up. With the help of this site, it is very easy to search for keywords in the kernel source on different versions.

Basically venturing into kernel programming starts off with a need to fiddle with services provided by the kernel....Me for example ..i had a need to fiddle with the IP packets generated and arriving on the kernel network stack....so started of writing LKMs,.,,kernel modules.And understand becomes easier if you have good understand of general Operating System Concepts.For example there was this book which i referred during my engineering undergraduation days...Operating System Concepts Author Silberschatz Galvin..even though i never cracked my head understanding user space and kernel space..that book did look into core concept at a more naive level...and it looked in from general OS point of view not specific to linux as such..now that i am more into kernel space programming that i realize how beautifully that book ventured into both user space and kernel space concepts....it just starts off with NEED to get into kernel side...from user space

Related

What does the kernel do once put into memory?

I'm a first year grad student trying to write an Operating System from scratch as a side project. I've read the Linux Programming Interface, Modern Operating Systems 4th edition, a bunch of articles on OSdev wiki's, and anything I can find on Google, but I'm having a tough time finding what I should be doing next after writing a simple bootloader, and a kernel that can take user input and display it back onto the screen.
I have a feeling that I need to create some drivers that interact with the file system and memory, but I'm not entirely sure. I'm trying to work my way up with just physical memory and one process running "kernel" for right now. I'll worry about virtual memory (pagging) and multi-processes later. If anyone can give me some kind of direction or better understanding of what happens when the kernel is finally put into memory, that would be great.
Thanks.
I would like to point a resource that will be of great help for you to understand this stuff in real details. One of the great and evolving resource that is being maintained on git.
https://github.com/0xAX/linux-insides/tree/master/Booting

Are filter drivers intended to extend system drivers?

Are filter drivers intended to extend system drivers?
Is this their main purpose?
Are they basically just an extra layer that sits between the driver and the user?
This seems overly simple an explanation and I am wondering if I am missing something.
Are there good ways to learn more?
The driver topic is a very advanced one.
To get an overview, you can have a closer look on the Windows Driver Kit (WDK) sides.
If you decide to get into this stuff, then you need a lot of time, frustration resistance and fanaticism.
The first thing you should do (befor you touch the WDK!) is, to start reading a good book.
If you want to develop for windows file system, read Rajeev Nagar's book "Windows NT File System Internals : A Developer's Guide". It's published in 1997, but it's something like the "bible" of NTFS.
For common driver developement you can find books like "Developing Drivers with the Windows Driver Foundation", written by Penny Orwick.
These books describes programming kernel mode software, which is done in C language. So, you should have a good base knowlege on C before you start.
Among others there are the OSR side (www.osr.com) and SysInternals on technet (http://technet.microsoft.com/de-DE/sysinternals), which are truely worth to have a closer look on.
More than the halfe time you spend on reading debug outputs and crash dumps, so it's wise to know what these things are meaning and how to get this information, but there are good books for windows debugging too.
I hope, I was able to give a short overview on the question for the ways to learn more.
In a way yes.
For example, if file system filter driver is for file encryption/compression/security, it is enhancing the file system functionality.
The filter driver does not handle talking to actual devices. They rely on lower level drivers to communicate with device. The filter drivers are add-on to the drivers to implement certain functionality. The active drivers which modify data/request are to enhance vanilla drivers while the passive filter drivers are just pass-throughs without any direct enhancements.
So I think your assumptions are correct.
Will like to hear different views though.

Windows function map?

Is there some sort of thing like a layout/plan of the windows api? A clear overview of which api depends on another? Or a website where they are linked in a hierarchical way (starting with the most dependable, ending with the core function)
e.g Kerenel32.dll!CreateFile() -> ntdll.dll!ntCreateFIle() -> ntoskrnl32.exe!zwCreateFile()
I can link them all by hand with a dependency walker but it takes much time. So I was just wondering if something like this already existed.
I don't have the answer to your question, but I think an even more interesting road would be to read what Geoff Chappell has found out regarding the Windows Kernel and the Win32 API. I have not read those sections, but so far everything I've read on that website has filled me with wonder and awe at how thoroughly things can be analysed given a disciplined and talented investigator.
You can always take a look at ReactOS:
ReactOS® is a free, modern operating system based on the design of Windows® XP/2003. Written completely from scratch, it aims to follow the Windows-NT® architecture designed by Microsoft from the hardware level right through to the application level.
Simply search for whatever function in the documentation and look at its source. 99% of the time you can just pretend to be looking at the actual Windows source :) Very helpful when playing around with a debugger too.

Projects on Memory Paging

i am studying for a test on operating systems , and i would love it if i can take a look at
free source projects regarding memory management and memory paging.
Thanks very much for your help:)
Nataly
There's plenty of OS kernels with source available, but I have a feeling trying to pick through them is going to be very difficult. A production kernel is a complex piece of work, so it's hard to understand the theory behind it by looking at the code.
What you probably want is an OS simulator that focuses on teaching the theory. We wrote our own in my OS classes. Just a quick google search came up with this list of a number of them:
http://vip.cs.utsa.edu/simulators/

Resources to help learn Windows kernel development in an operating systems class?

I am currently in an university operating system class and we are working on the windows kernel, more precisely WRK, the windows research kernel, for our projects. WRK is based off of win2k3 server.
I am however having a real hard time dredging up resources to help learn the basics of OS development, Windows kernel development and just generally getting around the Windows API.
We are using the book Microsoft Internals by Russinovich but I was wondering if any of you had some great resources to recommend to me, whether book, online guides or some old class notes. Thanks!
What specifically are you looking for? Online resources? For that, OSROnline is one of the better websites. Alot of kernel development knowledge is found in the MS and the OSR Mailing lists, that's another place to check that might be better than Stack overflow.
Specifically books, there is the Programming WDM,Developing drivers with KMDF and Advance Windows Debugging. The last specifically will not teach you so much about the kernel and more how to navigate inside it, something you will do quite often if you are writing drivers or researching parts of it.
In order to write drivers, the easiest way is probably to take Windows Driver samples and hack at them, stare the results with windbg and learn more.
microsoft kernel dev? that's just weird. what university are you at?
one of the most interesting things about kernels, in my opinion, is the scheduler algorithms. I'd recommend you check that out.
I can't imagine where you'd start looking for windows stuff though. I did it with the linux kernel and there's a LOT of resources (of course).
http://oreilly.com/catalog/linuxkernel/chapter/ch10.html
The third edition of Tanenbaum's Modern Operating Systems has a chapter devoted to the Vista kernel. I haven't looked into that chapter (I only read the Linux one), but as far as big-picture stuff, it's fantastic. I'm not sure what level of detail you're looking for, but that might be a good resource to check out.

Resources