Compile a Linux Kernel Part 1: Theory...a Lot of Theory (1/2)

Theory...a Lot of Theory (1/2)

How to Compile a Linux Kernel Part 1: Theory...a Lot of Theory (1/2)

!!!WARNING!!!
!!!Because of misleading informations please wait for the new post about this same argument instead of reading this post!!!

Welcome everyone!

Today we will start the first of many lessons about compiling a Linux Kernel to better understand how a computer works
We will start off with some theory...a lot of theory...

Now...since this is quite an advanced thing I will try to keep it as simple as I can but I if it won't be enough simple just tell me in the comments and I will try harder next time ;) .

In this lesson we will see the general tasks of a Kernel.

Let's start!!!!!

What Is GNU/Linux?

We often talk about Linux as an Operating System (OS)...the truth is it isn't:

it basically is the main software (the heart) of a GNU/Linux OS..."but wait you just said that Linux isn't an OS!" True...that's why we call it GNU /(and) Linux...GNU provides a part of the software(text editor, calculator, etc...) while Linux provides the other (the Kernel)

What Does a Kernel Do?

Great question!
First of all a Kernel recognizes the hardware when we turn on our computer...but why?
Well...I am sure at least once you saw one of those pop-ups from a website or a program asking you to access the
microphone or web cam, or whatever else...that's the Kernel.In other words it controls the requests
to access the hardware.The Kernel also tells the CPU how much time to give to each opened process.

When Does the Kernel Need to Be Compiled?

Again...Good question!!(I assume you already know what compiling means... if not leave a comment)
A Kernel needs to be compiled (that's why the computer asks to be rebooted) every time we:

  • add functionalities to our OS
  • update the Kernel itself

Types of Kernel

There are multiple Kernel types but the main one is the Monolithic one (Mac OS, Windows (even if Microsoft claims to use an "Hybrid Kernel"...

more of that in the next part), Linux, and many...many others OS have this type of Kernel).In the Monolithic Kernel there are already all

the necessary parts needed to use the system in one single software running in the Kernel space (where drivers are usually executed).

The drivers are usually included in the kernel as modules so you won't need to recompile the Kernel when you update or modify them.

Conclusion

So...I am going to stop there for your mind sake (you're welcome)

As you can see i try to be as brief as possible...drop a comment if you don't understand something or want to actually know something

Thanks for reading
See you in the next part :)

ThE-FiXeR

24 Comments

Looking forward to the upcoming parts of this tutorial.

Thank you for contributing!

i know that kernel is software running to give other software access to hardware, it also handles memory... but isnt that what the OS suppose to do?

according to school an operating system is system software that manages computer hardware and software resources and provides common services for computer programs, for hardware functions such as input and output and memory allocation, the operating system acts as an intermediary between programs and the computer hardware.

i understand the difference but you know i guess they confused ppl with the terms and definitions, but nice job

hacked by Mr__Nakup3nda

I agree. If anything is the OS, it's the kernel. Everything else is simply peripheral. Things like a text editor and calculator are applications on the OS.

OTW i didn't say that everything it's kernel...

Fixer:

I know you didn't say everything was the kernel. My objection and Mr Nakup2nda's, if I understand him, is that you say that the kernel is NOT the OS. My point is that if anything constitutes the OS, it is the kernel. Everything else is peripheral.

Oh...sorry i didn't understand what you meant before...you're right everything else is a peripheral
Btw OTW may I ask your opinion about this article please? It really matters to me

It's an important topic, but it is a bit superficial without any depth. Some of the information is misleading or incorrect.

The drivers are usually included in the kernel as modules , you don't need to recompile the kernel if you want to add a new one (or update one of them).

That is one of the misleading or incorrect bits of information I was referring to.

Totally agree

Wait..."one" of the misleading or incorrect information...may i ask wich are the others please?
If there are then I will have to study this subject better than I already did

Yes, study the subject a bit more and then re-write this article.

Will do sir! :)

Thank you a lot i will change that part as you suggested...and it will be more in depth in the next post
Thank both of you :)

I may be stupid, but I still don't know exactly what a kernel is, other than it controls the hardware and OS. But you may be planning to cover that more in-depth in the future?

A kernel is, in a simple explanation, the part that is basically the heart of an operating system.

-Phoenix750

If I was an 1800's gangster, I'd say 'You have moxie kid.'. And while you certainly do have it, making tutorials, you need to understand the topic a bit more after making a tutorial on it.

Let me give you an example:

Let's say I don't know how to write C/++, but I go and make a tutorial:

Int print ('This is C++')
end script
script finished

Now, that won't work. C or C++ will just give you so many errors... this is what you have sadly done... You didn't know the topic to well... But you made the tutorial. It's great that you tried to do well, and you did... But you have many problems and errors. I am not trying to be rude, ignorant or a hater... I'm just saying that you should learn about Linux a bit more than make a tutorial.

I understand...and that's why i am going to study this subject more and then i am going to rewrite this article

i was curious about embedded device like apple watch,google glass or other none pc. how do they work?how to build a custom kernel, because every device has different hardware. my opinion about kernel, it runs in machine code, fit with hardware.every hardware has it's interfaces to control its feature, the kernel will use it

The Android smartwatch is based on Android, so it runs a heavily modified version of the Linux kernel. The iWatch is based on iOS, and thus runs some kind of Unix kernel.

But other devices, like routers, depend on something called firmware and don't have a kernel. Firmware is software that is directly "flashed" on the microcontrollers present on the device (microcontrollers are those black things on your motherboard with more than 8 pins).

Firmware is super-low level, and usually controls the interactions with the kernel and the electrical signals (1 and 0) on the motherboard. Firmware is used in every device, it is just that devices like routers solely run on it (though some of them run a Linux kernel). A perfect example of firmware on a computer is the BIOS. But there are many more types of firmware on an ordinary computer (the north and south bridge, the SATA controller...)

-Phoenix750

Linux and GNU/Linux are the same thing.... Just different names....

He is right and wrong. Because most of the programs in a Linux distro except the kernel is something made by GNU, the full product is usually reffered to as GNU/Linux.

-Phoenix750

Share Your Thoughts

  • Hot
  • Latest