How to create linux distro

How I Built My Own Linux Distribution: The Go-Nuts 2023 Guide

Build your own Linux Open Source

We all use computers on a daily basis. Most of you know about Microsoft Windows and Apple’s macOS. However, did you also know about GNU/Linux also referred to as Linux? This world is dominated by Windows with macOS being in second place, and far down the charts, we see Linux.

Microsoft Windows takes up to about 80% of the market and macOS around 16%. This leaves almost no space for Linux. But don’t stop reading just yet. It is used more than you think as these numbers only reflect desktop usage. Did you know that Android runs on Linux? When you are using Facebook, Instagram, or Google, you are also using Linux. It is the most used server operating system by a fair margin.

What Exactly is an Operating System?

An operating system is a piece of software that sits in between the hardware that you interact with and the software that you wish to run. When you are typing on a keyboard or looking at your screen, you are touching the hardware. When you start your web browser you are using software, the web browser is executing code on your CPU (Central Processing Unit).

how operating systems work

What is Linux?

Operating systems booting sequence

A Misconception about Linux

One common misconception is that Linux is an operating system (OS). This is factually incorrect and it is rather that piece of software that directly communicates with the hardware. An OS is much more than that, it includes software libraries, runtimes, and usually a default set of executables.

Most Linux distributions use GNU as the operating system (including TOS). GNU is the child of Richard Stallman and was designed to be Free (As in Freedom) and Open Source. This ranges from a compiler to system libraries as well as commonly used system programs.

In the Linux world, we often say GNU + Linux otherwise referred to as GNU/Linux, because the Operating System is a combination of those 2 projects. Other versions of Linux also exist, for example, the busybox project. These Linux distributions are often more lightweight and can be found in embedded systems.

Understanding a few Linux commands would give you a view of how to use Linux distro efficiently.

Free Software vs. Open-source Software

The Linux kernel is known to be open-source software. This means that the source code is openly available. Everybody can read the code and modify it to their heart’s content.

It means we, as a community, can find bugs and fix them or add extra features. This is a very powerful feature and enables collaboration to improve the software, fix bugs, and increase the security. Open-source software is usually free (not to be confused with free as in freedom). Examples of such software are VLC, MediaWiki (Wikipedia), and Firefox. The open-source development model has led to a vast and interesting ecosystem.

Читайте также:  Developing windows applications in linux

Then we also have free software (free as in freedom), which is even more open than open-source software. It not only allows you to look at the source code and modify it, but it also lets you resell the software for money and make a business out of it. The free software foundation describes it as “the users have the freedom to run, copy, distribute, study, change and improve the software”.

Software like Microsoft Windows is known as proprietary software. This software is not owned by the user, so they are only allowed to use it. The users are not allowed to look at the code, reverse engineer, modify, or redistribute it.

In other words, you have the freedom to do what you want with free and open-source software, but not with proprietary software. This is a key consideration in the Linux world.

My Adventure to Building my own Linux Distribution

TOS Linux Open Source

The Birth of TOS Linux

This brings us to the story of how I started to work on TOS GNU/Linux. First I used an OS known as Ubuntu (the most widely used Linux distribution). This gave me a well-established basis on how to use Linux, it was stable and supported my needs of software.

Each distro had its own features and reason why to use it. But the story really begins with Arch Linux. It is known as a Do It Yourself (DIY) distribution. This means you actually had to completely do everything yourself. From installing all drivers to choosing the Desktop Environment (DE) and applications you want to use. Nothing is done for you and everything must be done by yourself.

This distro gave me insight into how Linux works on a lower level. Because it was so low level it meant you have to make sure everything is installed and configured correctly. For example, if you forgot to install a wifi driver and network manager, then you couldn’t use the internet and thus couldn’t fix the problem.

Soon after installing Arch Linux on my laptop, I wanted to install it on my desktop. This took a lot of setup work. Which meant I created a shell script that automatically installed Arch Linux with all my dependencies and favorite applications. Which, in essence, was my very first “installer”.

This resulted in installations of 15 minutes instead of 1 to 2 days of manual work. I soon began to modify and fix bugs in the installation script. Each time I wanted a new feature, I added it to that script.

Читайте также:  Qt условная компиляция windows linux

You can imagine that over time it began growing and growing more massive. Eventually, the script was no longer, instead I made several components that each interacts with one another, and that in the end became TOS GNU/Linux.

The TOS Linux Installer

TOS Linux has a graphical installer that is responsible for installing the operating system on your hardware. It does a number of things. Mainly the following:

  1. Partition the hard drive/SSD
  2. Creating users and groups
  3. Installing all required packages (from the TOS repository)
  4. Configuring the OS (keyboard layout, permissions, repository mirrors, etc)
  5. Setting up the boot process
  6. Preparing and validating the environment

Each section above has its own respective configuration.

For example, people can decide how to partition their environment, which filesystem to use, and if they want to encrypt their data or not. The installer is fully featured and easy to use.

TOS Linux Installer

Package Management and Repository

A major part of a distribution is its package management and the repositories. TOS uses the “PacMan” (package manager). It is responsible for keeping the system up-to-date along with all the applications.

A naive approach to package management is how windows does it. There you have to go to a website and download the executable. This is obviously unsafe as you can download a malicious executable.

TOS has what is called a repository. It contains a list of packages that are known to be safe and get updated daily. This guarantees up-to-date and secure packages. Packages get built by the TOS developers and are verified to come from reputable sources.

To prevent Man In the Middle attacks, TOS uses what is called package signing. In short, each package gets built and compressed (much like a zip file, instead it uses zstd) after it is compressed it will be signed with a private key. The resulting signature will be provided in the repository with the package.

The basic installation includes the public key on their computer. When they download a package, they also download the signature and verify if the package is signed by the matching private key.

The TOS repository and security topic is vast and should have their own blog post. At this moment, you can install over 80,000 packages from the repository.

TOS Desktop Environment

Outside maintaining packages, kernels, configurations, installers, repositories, and more, TOS also provides its own desktop environment.

Before continuing TOS can also use other desktop environments such as GNOME, KDE, Deepin, Cinnamon, Mate, and more, they are all provided in the official repository.

TOS Desktop Environment

A desktop environment sits on top of the Operating System and provides a Graphical User Interface that helps you maintain your daily life. Here is a list of what a desktop environment does:

  1. Managing applications/windows
  2. Giving a default set of applications (text editor, file manager, settings, etc)
  3. Managing the state (WiFi, Bluetooth, display settings, keyboard layout, etc)
  4. Managing privileges (asks for password or fingerprint when needed)
  5. Managing look and feel, icons, themes, folders, mouse pointer, wallpaper, and more
  6. Login management
Читайте также:  Iso software for linux

To keep it simple, it does everything that you can visually see except for applications that you install manually.

For macOS and Windows, the desktop environment is baked into the operating system. On Linux, you are free to swap them.

TOS Linux Kernel

TOS wants to support as many computers and hardware as it can. Because of this, we have a modified version of the Linux kernel that supports the broadest set of hardware. By default, the vanilla kernel contains only a subset of what you can do.

In TOS, we extend this subset with more features and saner defaults for the ultimate desktop experience. The vanilla kernel contains configurations for servers, whilst the TOS kernel is designed for graphical use and support for most hardware.

Booting up

To be able to use TOS GNU/Linux we have to start it up, usually called the bootup sequence.

The TOS Linux bootloader supports multiple operating systems. It can boot any version of Linux, BSD, macOS, and Windows. So you can run TOS Linux side by side with, for example, windows.

linux open source boot sequence

The above image (from GoLinuxCloud) demonstrates the boot sequence. In TOS we both support MBR and GPT(UEFI) systems to boot up. The bootloader used is Grand Unified Bootloader (GRUB) Which will launch an initial ramdisk (initrd) that will be loaded into RAM (it contains everything needed to start all applications). It is responsible for mounting the hard drives, running the kernel, starting the init process, etc.

TOS GNU Bootloader

Once everything is booted up, you will be presented with a login screen.

TOS login screen

Wiki

TOS provides an excellent wiki that should help you in case you have questions or are having issues.

Here are some example pages you can find in the wiki:

  • Developer coding style guide
  • TDE – basic usage
  • Updating packages
  • System repair
  • Setup NVIDIA as a graphical driver
  • Configuring open VPN
  • PostgreSQL

At the moment, the wiki has over 2400 pages/tutorials which will cover most of the daily issues that users might run into.

Conclusion

TOS GNU/Linux was started as a project so that I had a machine that was totally under my control. It contains a huge number of packages in the repository and provides the needed control for the user. It allows you to completely modify and alter your system. And it comes along with an extensible wiki that covers most (if not all) of your problems.

I would also like to thank the work that Allen McRae and the other developers did on Arch Linux as they founded the basis that later became TOS.

Some people might want to take a look at TOS and for that reason, I will leave here a list of useful links

Recommended Reads:

SUBSCRIBE TO OUR NEWSLETTER

Источник

Оцените статью
Adblock
detector