How I Built My Own Linux Distribution [2023 Guide] – iDalko

This article was written by Tom Meyers, a DevOps engineer at iDalko.

There’s a lot you can do when it comes to open source software thanks to its built-in flexibility, scalability, and adaptability. You may even decide to make a new product based on your specific requirements. In this blog post, I’ll walk you through the journey I took to build my own Linux distribution called TOS.

Before we begin, let’s draw the landscape.

Here’s what I’m going to cover in this blog post:

The world of operating systems

  • What is Linux?
  • My adventure to build my own Linux distribution The
  • world of operating

systems

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

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

What exactly is an operating system?

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

However, it does not do so directly. It talks to your operating system, which then talks to your hardware. In essence, it translates and manages the hardware so that the software can use it. (See below)

<img src="https://www.idalko.com/wp-content/uploads/2020/11/word-image-13.png" alt="how operating systems work" /

>What is Linux?Operating system boot sequence

A

misconception about

Linux

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

Most Linux distributions use GNU as their operating system (including TOS). GNU is the son 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, also known as GNU/Linux, because the operating system is a combination of those 2 projects. There are also other versions of Linux, for example, the busybox project. These Linux distributions are often lighter and can be found on embedded systems.

Understanding some Linux commands would give you insight into how to use the Linux distribution 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. Everyone can read the code and modify it to their heart’s content.

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

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

Software such as

Microsoft Windows is known as proprietary software. This software is not owned by the user, so you are only allowed to use it. Users cannot view, reverse engineer, modify, or redistribute code.

In other words, you have the freedom to do whatever 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 build my own Linux distribution<img src

=”https://www.idalko.com/wp-content/uploads/2020/11/word-image-16.png” alt=”TOS Linux Open Source” />

The birth

of TOS Linux

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

However, as time grew, so did my curiosity. I began to explore the vast landscape of Linux distributions. This led me to try different distributions. In order, I experimented with:

  1. Ubuntu
  2. Kubuntu
  3. Fedora
  4. Manjaro
  5. Arch Linux
  6. TOS (My Own Distribution)

Each distribution had its own features and reason for using it. But the story really starts with Arch Linux. It is known as a Do It Yourself (DIY) distribution. This means that you actually had to do everything completely 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 distribution gave me an idea of how Linux works at a lower level. Because it was so low-level, it meant you had to make sure everything was installed and configured correctly. For example, if you forgot to install a wifi driver and a network administrator, then you could not use the Internet and therefore could not fix the problem.

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

This resulted in 15-minute installations instead of 1 to 2 days of manual labor. Soon I started modifying and fixing errors in the installation script. Every time I wanted a new feature, I added it to that script.

You can imagine that over time it began to grow and become more massive. Eventually, the script was gone, but I made several components that interact with each other, and that eventually became TOS GNU/Linux.

The

TOS Linux installer

TOS Linux has a graphical installer that takes care of installing the operating system on your hardware. It does several things. Mainly the following:

  1. Partition the hard disk/SSD
  2. Creating users and groups
  3. Installing all necessary packages (from the TOS repository)
  4. Operating system settings (keyboard layout, permissions, repository mirrors, etc.) Configuring
  5. the

  6. boot process
  7. Preparing and validating the

environment

Each previous section has its own respective settings

.

For example, people can decide how to partition their environment, which file system to use, and whether they want to encrypt their data or not. The installer is full-featured and easy to use.

It is based on the framework of the squid installer.

TOS Linux Installer

Package

and

repository management

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

A naïve approach to package management is how Windows does it. There you have to go to a website and download the executable. This is obviously not safe, as you can download a malicious executable.

TOS has what’s called a repository. It contains a list of packages that are known to be safe and are updated daily. This ensures up-to-date and secure packages. The packages are built by TOS developers and verified to come from reputable sources.

To prevent Man In the Middle attacks, TOS uses what is called packet signing. In short, each package is built and compressed (just like a zip file, instead 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 your computer. When they download a package, they also download the signature and verify whether the package is signed by the corresponding private key.

The TOS repository and security topic are vast and should have their own blog post. At this point, you can install more than 80,000 packages from the repository.

TOS Desktop Environment In addition

to maintaining packages, kernels, configurations, installers, repositories

, and more, TOS also provides its own desktop environment.

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

The default desktop environment is called TDE (TOS Desktop Environment).

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’s a list of what a desktop environment does:

Application

  1. /window
  2. management

  3. Give a default set of applications (text editor, file manager
  4. , settings, etc.)

  5. Manage status (WiFi, Bluetooth
  6. , display settings, keyboard layout, etc.) Privilege management

  7. (prompts for password or fingerprint when needed) Manage
  8. appearance,

  9. icons, themes, folders, mouse pointer, wallpaper and
  10. more

  11. Login management

And much more

.

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

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

If you want to read more about TDE, read this guide.

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 it can do.

At TOS, we extend this subset with more features and healthier defaults for the best desktop experience. The vanilla kernel contains configurations for servers, while the TOS kernel is designed for graphical use and support for most hardware.

You can take a look at the TOS kernel source code.

In

order to use TOS GNU/Linux we have to start it, usually called a boot sequence

.

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

<img src="https://www.idalko.com/wp-content/uploads/2020/11/word-image-19.png" alt="

Linux open source boot sequence” />

The image above (from GoLinuxCloud) shows the boot sequence. In TOS we support MBR and GPT (UEFI) systems to boot. 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 boot process, etc.

The initialization process is responsible for launching each program. For example, it starts all the necessary drivers, starts the GUI, and all background processes. In the case of TOS, this is systemd.

<img src="https://www.idalko.com/wp-content/uploads/2020/11/word-image-20.png" alt="TOS

GNU Bootloader

” />

Once everything is booted, 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 problems.

The wiki covers topics on how to use TOS, how to install it, and what you can do as a developer. It also covers other topics, such as how to set up certain software. The wiki can be found at the wiki.odex.be link.

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

  • Coding style guide for TDE developers
  • – basic usage Updating
  • packages
  • System Repair
  • Configuring

  • NVIDIA as a graphics driver Configuring
  • PostgreSQL
  • Open VPN

At the moment, the wiki has over 2400 pages/tutorials that will cover most of the daily issues that users may encounter.

Conclusion

TOS GNU/Linux was started as a project for me to have a machine that was totally under my control. It contains a large number of packages in the repository and provides the necessary control for the user. It allows you to modify and completely 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 when they founded the base that later became TOS.

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

  • Download
  • the TOS setup guide
  • TOS Home

  • Page Wiki Home Page
  • The source

  • code
  • of

  • TOS

Recommended Reading

: Open Source Software

  • : An Introduction
  • The Benefits of Open Source

Software for Small Businesses