How To Modify Linux Source Code?

G

Guest

Guest
Hey guys, I was wondering how to modify linux? Are there any programming languages that I need to know? What text should I type? I'd like to make my own linux distribution, but it looks like a lot to build.
 
Solution
Definitely go to classes but if you want to get a look at C, check this out.

The kernel its self is mostly written in C. A lot of the user programs may be written in C++ (amongst other languages).
G

Guest

Guest
Excuse me, I meant are there a lot of commands I need to know with the terminal or a text editor? I want to learn how to change the source code but it sounds complicated. I want to know what the text in the source code means & what it does.
 
Excuse me, I meant are there a lot of commands I need to know with the terminal or a text editor?

Yes there is a lot you need to know.

want to know what the text in the source code means & what it does

You want to make your own distrobution? At this moment in time you are doomed if you cannot even be comfortable with the command line.
I suggest you take an introductory programming course before moving on.

If you feel adventurous:
https://wiki.ubuntu.com/DerivativeDistroHowto
 

USAFRet

Titan
Moderator


This is what programming courses are for.

"Hi guys. I want to build a car. What metal should I make it out of?"
 

McHenryB

Admirable
On the contrary, changing the source code is easy.

I want to know what the text in the source code means & what it does.
That's more like it. Knowing what to change, and what to change it to, is the difficult bit.

It sounds as if you are taking about a whole Linux distribution rather than just the kernel. This consists of millions of lines of source code that people have been working on for twenty years or more. If you don't know what any of it means, your chances of successfully modifying it at present compare unfavourably to those monkeys typing Shakespeare.

1. You need to learn how to program in C.

2. You have to learn how to program in x86 assembler.

3. You need to learn the coding conventions used in Linux source code and the functions provided to programs by its various libraries.

4. You need to study the source code of the Linux kernel and the user programs to understand what it does. You'll probably need to read a few books to help you with this.

5. You need to decide which part of the Linux sources you wish to change and what effect you want the change to have.

6. You can then make the change, compile the resulting source, and test it.

7. Repeat 4 & 5 until the changes you make have the desired effect and don't break anything.

8. Repeat 4, 5, & 6 until you have achieved your objective.

Start with point 1. Allow yourself 6 months to a year to become proficient in C. Then you can go on to step 2, and so on.
 
G

Guest

Guest
Thank you! That's exactly what I needed. In-depth instructions. I tried to look up on how to program in C, but I can't find any real books based on how to program. & are there any online videos I could use on how to program in C? I find videos on youtube & those videos go back to like a few years ago so they're outdated.
 

USAFRet

Titan
Moderator


You cannot learn to program in C from a youtube video.

If you can't find any programming books for C, you have not looked.
 

USAFRet

Titan
Moderator


If we equate "Modify Linux Source Code" to climbing Mt. Everest...

Go to your local community college or equivalent.
Take a couple of programming classes.

At the end of those classes, you are at the stage of "qualified to hang a poster of Mt Everest on your wall "

But do go take those classes. Every journey begins with but a single step.
 
G

Guest

Guest
Thank you! I forgot about Khan Academy, my mom signed me up for that. I never took the programming lessons, I'll try that. Thank you very much.
 
One thing I'll say is that you're probably looking at the wrong stuff to change. If an OS is a house, modifying the linux kernel is like changing the foundations.

You probably want to change the furniture, wall coverings and carpet.

I suggest that you start by installing a typical linux OS, then find out what there is you don't like about it, or think you can do better. I'd be highly surprised if you needed to touch the kernel (beyond, at most, using pre-made patches).
 
G

Guest

Guest
I'll do what you said. I'd like to start off with Linux Mint first. Thank you. & when you mean change the furniture, carpet, & wall coverings, do you mean changing the looks of the linux distro & adding/removing stuff to it?
 

jacobian

Honorable
Jan 6, 2014
206
0
10,710


It can literally take four years of college to simply have an idea of how the operating system kernels work. In case of Linux, or any other unix-like OS, knowing C and C systems programming is the key as all those OSes were built around the C programming language. You may want to check out the wikipedia article on C, Unix, and Linux to get some general idea.