How do I add runtime to the kernel

What is the Linux kernel and what does it do?

With over 13 million lines of code, the Linux kernel is one of the largest open source projects in the world. But what is a kernel and what is it used for?

So what is the kernel?

A kernel is the lowest level of easily replaceable software that is associated with your computer's hardware. It is responsible for ensuring that all of your applications running in "user mode" are connected to the physical hardware and that processes known as servers can use interprocess communication (IPC) to obtain information from each other.

Different types of kernels

There are, of course, several ways you can do one kernel and architecture considerations if you're building one from scratch. In general, most kernels fall into one of three types: monolithic, microkernel, and hybrid. Linux is a monolithic kernel, while OS X (XNU) and Windows 7 use hybrid kernels. Let's give a quick overview of the three categories so we can get into more detail later.

picture of Uptown popcorn

A microkernel takes the approach of only managing what it has to do: CPU, memory and IPC. Pretty much everything else in a computer can be viewed as an accessory and handled in user mode. Micro-cores have the advantage of portability as they don't have to worry about changing your graphics card or even your operating system, as long as the operating system continues to try to access the hardware in the same way. Micro-cores also take up very little memory and installation space and are typically more secure because only certain processes run in user mode that do not have the high privileges of supervisor mode.


  • portability
  • Little space required for installation
  • Low memory requirements
  • security


  • Hardware is more abstracted by drivers
  • The hardware may be slow to respond because the drivers are in user mode
  • Processes have to wait in a queue to get information
  • Processes cannot access other processes without waiting

Monolithic core
Monolithic cores are the opposite of micro-cores because they not only include the CPU, memory, and IPC, but also things like device drivers, file system management, and system server calls. Monolithic kernels tend to be better at hardware and multitasking because when a program needs to get information from memory or some other running process, it can access it more directly rather than waiting in a queue to get the job done. However, this can create problems because the more things are done in supervisor mode, the more things can crash your system if someone is not doing the right thing.


  • More direct access to hardware for programs
  • Easier communication between processes
  • If your device is supported it should work without additional installations
  • Processes respond faster because there is no processor time queue


  • Large installation area
  • Large memory requirements
  • Less secure as everything is done in supervisor mode

Image via schoschie on Flickr

Hybrid kernel
Hybrid cores have the ability to choose and choose what to run in user mode and what to run in supervisor mode. Often times, things like device drivers and file system I / O are done in user mode while IPC and server calls are held in supervisor mode. This gives the best of both worlds, but often requires more work from the hardware manufacturer as the entire responsibility of the drivers rests with them. It can also have some of the latency issues associated with microkernels.


  • Developers can choose what to run in user mode and what to run in supervisor mode
  • Smaller installation area than with a monolithic kernel
  • More flexible than other models


  • May suffer from the same process delay as microkernel
  • Device drivers must (usually) be managed by the user

Where are the Linux kernel files?

The kernel file in Ubuntu is in your / boot folder and is called vmlinuz-execution. The name vmlinuz comes from the Unix world in which they simply called their kernels "Unix" in the 1960s. Linux called its kernel "Linux" when it was first developed in the 1990s.

As virtual memory became more easily multitasking capabilities, “vm” was placed at the beginning of the file to show that the kernel supports virtual memory. For a while the Linux kernel was called vmlinux, but the kernel got too big to fit in the available boot memory, so the kernel image was compressed and the extension x was changed to a z to indicate it was using zlib compression has been compressed. This compression is not always used, but is often replaced by LZMA or BZIP2. Some kernels are simply referred to as zImage.

The version numbering is in the format A.B.C.D, where A.B is likely 2.6, C is your version, and D is your patches or fixes.

In the / boot folder there will also be other important files named initrd.img-version, and config-version. The initrd file is used as a small RAM disk that extracts and executes the actual kernel file. The file is used for memory management before the kernel is fully loaded, and the configuration file tells the kernel which options and modules to load into the kernel image when it is compiled.

Linux kernel architecture

Since the Linux kernel is monolithic, this is the case with the greatest space requirement and complexity compared to the other kernel types. This was a design feature that was hotly debated in the early days of Linux and still has some of the same design flaws that monolithic kernels must have.

One thing the Linux kernel developers have done to work around these bugs is to create kernel modules that can be loaded and unloaded at runtime. This means that you can add or remove features of your kernel on the fly. This can go beyond adding hardware functionality to the kernel by including modules that perform server processes, such as: B. Low-level virtualization. However, in some cases the entire kernel can be replaced without restarting the computer.

Imagine if you could upgrade to a Windows service pack without ever rebooting ...

Kernel modules

What if Windows had every available driver already installed and you just had to turn on the drivers it needed? This is essentially what kernel modules do for Linux. Kernel modules, also known as loadable kernel modules (LKM), are essential to keep the kernel and all of your hardware functional without taking up all of the available memory.

A module normally extends the base with functions kernels for devices, file systems and system calls. LKMs have the file extension .ko and are usually stored in the / lib / modules directory. Because of its modular nature, you can easily customize your kernel by setting the modules to load or not load on startup with the menuconfig command, or by editing your / boot / config file, or you can add modules on the fly Operation with the modprobe load and unload command.

Third-party and closed-source modules are available in some distributions such as Ubuntu and may not be installed by default because the source code for the modules is not available. The developers of the software (i.e. NVidia, ATI, etc.) do not provide the source code, but instead create their own modules and compile the required .ko files for distribution. These modules are free as in Beer, but not free as in Speech and therefore not included in some distributions because the maintainers believe that they "degrade" the kernel by providing non-free software.

A kernel isn't magic, but it's absolutely essential for a computer to run properly. The Linux kernel differs from OS X and Windows in that it contains drivers at the kernel level and supports many things out of the box. Hopefully, you know a little more about how your software and hardware work together and what files you need to boot your computer.
picture of ingridtaylar