WHERE TO START : KERNEL & DEVICE DRIVER DEV ?

Hi, I am new here and so I have been meaning to begin myself with Kernel development for the Linux platform for quite a while now, but I am uncertain as to where to begin and what are the first steps to delve into kernel development ? My C programming isn’t extensive but I have some experience in programming some small programs in C, and again I’m not too sure about my skillset with C.

I have also be meaning to delve into the Linux Device Driver programming too, but I am not certain whether this is actually somehow related to the Linux Kernel development.

So back to the question where should I start with Linux Kernel Development or programming Linux Device Driver ? Are there any career opportunities in this part of Linux ? Would like to hear from the experienced users who are also involved in this related field, Thanks.

hi,
i would start from scratch, linux from scratch :wink:

1 Like

I have built kernels for the company where I work, only for different android tablets though. We do it to enable extra hardware support from the tablet, to interact with our products. Fortunately the drivers we use are already written, so its just a matter of changing configs, but still good fun.

After reading a bit about how the kernel works, just start building it. After that try changing configs ect, then progress to writing your own ‘driver’, to then include.

2 Likes

Hello Matt, thank you for your response, If you wouldn’t mind me asking about the job you had in kernel development, you mentioned something on modding parts and bits of the kernel, I mean I’m just curious as to what reason why modify them in a way ? I know it may sound like a silly question, because I have no prior experiences with modifying bits of the linux kernel to fit something else, and also I had a thought that the linux kernel would work out of the box on everything, i.e. mobile phone systems, tablets, and PCs included. Well unless you wanted to add in some extra features.

Oh and also just fit in another question here, do linux device drivers share the same libraries as the linux kernel ?

In desktops the kernel will, most of the time, work ‘out of the box’. Because it includes support for a wide range of devices, and a lot of things are standardized. Mobile phones were all very different, so kernels had to be built for each one (I think this changed for android 9 tho).

Not everything available in the kernel is included when it’s built. So when the tablet manufacture built the kernel, they only included extra modules that a typical user might need. I was using it to control a motor via USB, so i needed to rebuild the kernel to include the drivers i needed. I also had to modify some of the C files for the driver, but nothing difficult.

On libraries, i’m not sure 100% on what you mean. Linux kernel cant use user space libraries because it hasn’t started yet, but it has its own functions that can be used.

1 Like

Hi thanks Matt,
my confusion is that should I see the device driver as a part of the entire kernel itself, or should I see them as a separate section of the linux kernel ?

I also have a hard time trying to comprehend how the deivce driver simply developed. I understand that the device driver module is indeed an abstract level of the physical device, but
I couldn’t understand as to how they are developed and how they could simply work after compilation? and it just simply works after mounting the module. After googling and watching youtube videos on how developers explainations on device drivers, i still coudn’t really grasps the idea behind how it works. Would you be kind to explain to me about it ?

These are some questions i’m not really qualified to answer.

Drivers in the kernel are both a part of it and also somewhat separate. You have the kernel drivers that initialize basic functionality, that is how it works ‘out of the box’. You also have kernel modules that can be loaded dynamically, adding more device specific functionality (e.g. nvidia drivers).

I think you will probably find this repo interesting, especially these documents: https://github.com/0xAX/linux-insides/tree/master/Booting. I believe its updated somewhat, although might not be 100% accurate with the current kernel version.

Hopefully that repo helps understand drivers a bit better. I’m not sure really how i would explain it, but i will give it a go if you still have trouble.

1 Like