Everything About Linux -1

Linux Kernel acts as an interface between the computer hardware like CPU, memory, devices, and the applications /processes. It works efficiently to manage some of the kernel properties.

Functions of Linux Kernel-

  1. Memory Management — Kernel takes care of which process has taken how much of memory and where and in this way it helps in managing the memory.
  2. Process Management — It determines which process can use the CPU and for how long it can use it?
  3. Device Drivers — It acts as an interpreter or a mediator between the hardware and the processes.
  4. System Calls and Security — It receives requests from the processes known as a system call and completes the security processes to clarify there is no such vulnerates in-between.

Some of the main features of the kernel are

  1. Monolithic — Monolithic simply means, the kernel manages memory management, CPU scheduling, process management of their own.
  2. Modular — Modular simply means it can extend its capacities by dynamically loaded of their kernel and using that to work as per requirement more efficiently.

BOOT Process

Once your PC has been powered on, the BIOS begins its work as part of the POST (Power-On Self Test) process.

After booting up the computer the first thing we see is

  1. BOIS- Basic Input Output System
  2. UEFI- Unified Extensible Firmware Interface

BIOS & UEFI are two different system interfaces but as an end-user, they both are the same but have a different process running inside the hood, Both ways are used to interact with Hardware and operating system.

Bios is one of the old ways of booting a system in which we divide the hard drive into 4 equal partitions and the boot process starts from 1st place with (MBR)- Master Boot Record that contains all the records.

Limitations With Bios

  1. You can only have 4 partitions of the drive using Bios & MBR combinations (some hacks to overcome this)
  2. Size of MBR(How much MBR can reference in terms of size).

That's where the Replacement UEFI comes

  1. Besides creating separate equal partitioning, it creates a special participation one only that stores code and works fast as well.
  2. UEFI provides secure Boot also whereas Bios doesn't provide.

After this process, the screen comes to the Bootloaders

Bootloaders-

A Bootloader is a critical piece of software that is responsible for loading the Linux kernel and Linux initial Ramdisk. Linux users can choose from Several different boot loaders, each with its strengths & weakness.

Different Bootloaders are-

  1. Grand Unified Bootloader (GRUB)
  2. LILO
  3. BurG
  4. sysLinux

Most of the system contains Grub & Grub2 but sometimes you can confuse between those two because they both work similarly and have some minor changes.

Commands to customize Boot loader-

  • Open the Grub file & edit it in nano accordingly ( nano /etc/default/grub)
  • after Editing the file (Sudo Update-grub).
  • To see the Grub2 file (Cd /boot/grub/ — ls- Output- Grub.cfg)

Linux Boot Methods

There are some amazing ways to Boot-Up your machine in a more power-efficient environment that you must know-

  1. PXE- (Pre-Boot Execution Environment)- Before Linux introduces to a system, the system comes across BIOS or UEFI, and under the same environment, PXE works. In the PXE Boot process when the system sees no drive, it queries the network i.e. is a DHCP Server and DHCP Server responds with IP Address and a boot file, and a TFTP Server(where it stores files on a network) & then system downloads that images from TFTP server & Here comes Linux in action loading kernel and finally it boots up.
  2. USB, CD & Hard-drive- It is quite easy to boot from these.
  3. IPXE- (Advanced Version of PXE)- It is almost the same as PXE but the only difference is it uses HTTP to download boot files from the server which is fast & reliable too.
  4. ISO- You can make a Grub2 entry and directly boot from the ISO even if you haven’t burned it to a disk or USB drive. In Boot-Process, first, it loads up the entire Linux & Grub then goes to ISO where we can select Kernel, Mentest, and much more.

The most Awesome way to BootUp is by using PXE which directly interacts with the server without any media interference.

How Does Boot Process Works?

  • To successfully Boot-Up, Our kernel needs to mount all the modules that are currently mounted on the hard disk.
  • When we switch on our system, BIOS or UEFI interacts with Hardware and then Grub comes into action.
  • After that vmlinux comes into action that is just a basic structure of a kernel and now to make it a fully functional kernel, we need to mount all modules.
  • But sometimes vmlinux fails to notice the location of modules now here comes “INITRD” i.e. is “ init-ram-disk” which is a temporary staging area that stores the address of modules and it redirects vmlinux to the address.
  • “initrd” comes before vmlinux and it is not a part of vmlinux.
  • While some people confuse initrd to initramfs that is a different thing. Init-ram-FileSystem manages the filesystem that is developed by Dracut. This is a part of vmlinux.
  • vmlinuz is a compressed version of vmlinux that takes less space.
  • cd /boot & ls- To find different files shown above.
  • cd /lib/modules- To find Different files.

About The Author- Saurav Chaudhary

Saurav Chaudhary is an experienced Technical Content Writer. Bringing in a lot of knowledge about DevOps & Cloud, Blockchain, Web Development & Security. He strives to write pristine content about any IT-related subject.

- Follow Saurav on Twitter

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store