Skip to content
Advertisement

How to proceed with Linux source code customization?

I am a non CS/IT student, but having knowledge of C, Java, DS and Algorithms. Now-a-days I am focusing on operating system and had gained some of its concepts. But I want some practical knowledge of it. Merely writing algo code in java/c has no fun in doing. I have gone through many articles where they mentioned we can customize source code of Linux-kernel.

I want to start customizing the kernel as I move ahead in the learning of OS concepts and apply the same. It will make two goals achievable 1. I will gain practical idea of the operating system 2. I will have a project.

Problem which I face-
1. From where to get the source code? Which source code should I download? Also the documentation if possible.
https://www.kernel.org/
I went in there but there are so many of them which one will be better? 2. How will I customize the code once I have it?

Please give me suggestions with detail about how I should start this journey (of changing source code to customize Linux).

Moreover I am using Windows 8.

Advertisement

Answer

I recommend first reading several books on OSes and on programming. You need a broad CS culture (if possible get a CS degree)

I am a non CS/IT student,

You’ll better become one, or else spend years of work to learn all the stuff a CS graduate student has learnt.

First, you need to be very familiar with Linux programming on user side (application programs). So read at least Advanced Linux Programming and study the source code of several programs, including shells (and some kind of servers). Read also carefully syscalls(2). Explore the state of your kernel (e.g. thru proc(5)…). Look into https://kernelnewbies.org/

I also recommend learning several programming languages. You should in particular read SICP, an excellent introduction to programming. Read also some book like programming language pragmatics. Read something about continuation and continuation passing style. Read the Dragon book. Read some Introduction to Algorithms. Read something about computer architecture and instruction set architecture

Merely writing algo code in java/c has no fun in doing.

But the kernel is also written in C (mostly) and full of algorithmic code. What makes you think you’ll get more fun in it?

I want to start customizing the kernel as I move ahead in the learning of OS concepts and apply the same.

But why? Why don’t you also consider studying and contributing to some user-level code

I would recommend first reading a good book on OSes in general, notably Operating Systems: Three Easy Pieces. Look also on OSdev.

At last, the general advice about kernel programming is don’t. A common mistake is to try adding code inside the kernel to solve some issue that can and should be solved in user-land.

  1. How will I customize the code once I have it?

You probably should not customize the kernel, but if you did you’ll use familiar tools (a good source code editor like emacs or vim, a compiler and linker on the command line, a build automation tool like make). Patching the kernel is similar to patching some other free software. But testing your kernel is harder (because you’ll often reboot).

You’ll also find several books explaining the Linux kernel.

If you still want to customize the kernel you should first try to code some kernel module.

Moreover I am using Windows 8.

This is a huge mistake. You first need to be an advanced Linux user. So wipe out Windows from your computer, and install some Linux distribution -I recommend Debian- (and use only Linux, no more Windows). Become familiar with command line.

I seriously recommend to avoid working on the kernel as your first project. I strongly recommend looking at some existing user-land free software project first (there are thousands of them, notably on github, e.g. choose some package in your distribution, study its source code, work on it, propose the patch to the community). Be able to build from source code a lot of things.

Advertisement