How to create your own Linux distribution


Details
Welcome to a beginner-friendly deep dive on how to create your own Linux distribution!
But why would you want to create one yourself?
** BACKGROUND **
Mainstream Linux distributions (e.g. Ubuntu, ArchLinux) enable their users to perform a plethora of tasks and often include the means for further customization of the system via a package manager, development tools, a desktop environment etc.
However, if you are creating a device that has a very specific set of use cases and needs to operate under strict constraints in regards to resources, power consumption, performance, or robustness, then using a full-fledged desktop operating system is infeasible. This is very common when developing embedded systems, meant to be used in an IoT application, the automotive or telecom industry, and so forth.
To create an Embedded Linux operating system, there are two paths you may follow:
- Create a "golden image"; often the first choice when prototyping with a development board, e.g. a Raspberry Pi.
An off-the-shelf operating system, such as Debian, is hacked until it fits the purpose. Then clones of that "golden image" are created and installed in more devices.
This is good enough for creating a proof-of-concept but quickly falls short when the project becomes more complicated, larger, or the need to develop product variants arises. - Create a configuration-based distribution; the industry-proven way to create an Embedded Linux operating system.
Instead of maintaining the operating system as a big binary, its components are specified in version controllable configuration files. Setting everything up may require a steeper learning curve since things are not already conveniently in place. However, it is the only sustainable way to go forward when it comes to serious Embedded Linux development.
More on the topic: https://www.linuxjournal.com/content/linux-iot-development-adjusting-binary-os-yocto-project-workflow
** WORKSHOP **
In this workshop, we are going to demonstrate the "ingredients" needed to build your own Linux distribution using the Yocto project. Then we will run our distribution on a Raspberry Pi board.
Yocto is a collection of tools and processes enabling the creation of configurable Embedded Linux distributions. You define which components are to be included in your operating system with software- and hardware-specific configuration files. "Recipes" determine how these components are built and also what they depend upon. Finally, these recipes are utilized by "bitbake" (a tool offered by Yocto) to build your custom Linux image.
During the workshop, we will go over the setup needed to create a custom operating system for a typical IoT device. It boots up, automatically connects to the internet, and launches a C++ demon that fetches information from a cloud API.
** LEARNING GOALS **
After the workshop, the participants should be familiar with:
- Yocto build fundamentals
- Hardware & software-specific configuration
- Simple bitbake recipes for C++ binaries built with CMake
- Application launch on startup with systemd
- WiFi connection & IP on startup
- Cross-compiling applications
- Linux kernel configuration with fragments
** PREREQUISITES **
No experience with Yocto is required, however, familiarity with Linux as an operating system and its tools is necessary.

How to create your own Linux distribution