Follow along with this step-by-step guide to creating your own distribution.
In an article in the June 2018 issue of LJ, I introduced a basic recipe for building your own minimal Linux-based distribution from source code packages. The guide started with the compilation of a cross-compiler toolchain that ran on your host system. Using that cross-compiler, I explained how to build a generic x86-64 target image, and the Linux Journal Operating System (LJOS) was born.
This guide builds on what you learned from Part I, so if you haven't already, be sure to go through those original steps up to the point where you are about to package the target image for distribution.
Here's a quick review the terminology from the first part of this series:
- Host: the host signifies the very machine on which you'll be doing the vast majority of work, including cross-compiling and installing the target image.
- Target: the target is the final cross-compiled operating system that you'll be building from source packages. You'll build it using the cross-compiler on the host machine.
- Cross-Compiler: you'll be building and using a cross-compiler to create the target image on the host machine. A cross-compiler is built to run on a host machine, but it's used to compile for an architecture or microprocessor that isn't compatible with the target machine.
Gathering the Packages
To follow along, you'll need the following:
- busybox-1.28.3.tar.bz2 (the same package used in Part I).
- clfs-embedded-bootscripts-1.0-pre5.tar.bz2 (the same package used in Part I).
Note: I ended up rebuilding this distribution with the 4.19.1 Linux kernel. If you want to do the same, be sure to install the development package of the OpenSSL libraries on your host machine or else the build will fail. On distributions like Debian or Ubuntu, this package is named libssl-dev.
Fixing Some Boot-Time Errors
After following along with Part I, you will have noticed that during boot time, a couple errors are generated (Figure 1).
Figure 1. Errors generated during the init process of a system boot.