Inside RLXOS 2.0 Source Code - Part 1

Manjeet SinghManjeet Singh
5 min read

Hey there, tech enthusiasts! Today, we're taking a fun dive into the source code of RLXOS and building one from source.

Hold on a sec, ever heard of RLXOS? It's not just your average operating system – it's an open-source, independent, and immutable securely mutable distribution. Picture this: it's like taking the best parts of Android security and workflow and bringing them to your desktop. Cool, right? (Also keep in mind that RLXOS is newer Linux distribution and can lack features and occasional instability)

If you're curious, you can dive into RLXOS 2.0 and explore all its features right here. It's a neat way to learn about building and tinkering with operating systems. Visit the Project website to learn more about the project and take a test drive of it.

Hardware Requirements

Building RLXOS doesn't demand a high-end system. But you'll need at least 100 GiB of storage space, a x86_64 multi-core system, and a minimum of 8 GiB of memory (consider adding swap space if you plan to build LLVM and Webkitgtk-like tools). In essence, you can compile RLXOS on your laptop overnight.

Compilation times vary depending on your system configuration, ranging from 2 days to 6 hours. For instance, it took me 52 hours to compile RLXOS from source on the lowest configuration Contabo Cloud VPS 1, and nearly 6 hours on Contabo Intel 10-Core.

Software Requirements

To successfully compile RLXOS, ensure you have a native Linux system installed. Additionally, install the following tools and libraries:

  • GNU C++20 compiler

  • libostree

  • bwrap

  • bsdtar or libarchive-tools

💡
RLXOS utilizes a temporary lightweight bwrap container to isolate the build process of each component from the system, ensuring no alterations are made to your system in any way.

Obtaining Source Code

Simply fork my GitHub repository at https://github.com/itsManjeet/rlxos/ containing the meta-configuration files for building RLXOS. Your star would be much appreciated to support my work.

If you're not on GitHub, clone the project using:

git clone --recurse-submodules --branch stable https://github.com/itsManjeet/rlxos

Project Structure

File/FolderDescription
elements/YAML configuration files for each component
files/Files required by one or more components to build, such as icons, service files, background wallpaper, or logos.
patches/Patch files used for fixes or customization of each component.
scripts/Scripts utilized in CI/CD pipelines.
config-<ARCH>.ymlProject configuration file used by Ignite to set up environment variables, provide global variables, and compiler information.
include/Shared configurations imported in config-<ARCH>.yml

Ignite! the build process🔥

Now that we have the source code, let's build our first RLXOS distribution. You'll understand why I call it Ignite! the build process later.

Firstly, create your own GPG key to sign the updates

Begin by removing the default rlxos.gpg key:

rm -v files/rlxos.gpg

Then generate a new one:

make file/rlxos.gpg

This action will create a public key at files/rlxos.gpg and a private key at ostree-gpg/. The private key is utilized to sign the OTA updates, while the public key is provided to users within the release ISO to verify OTA updates.

Execute:

make ELEMENT=installer/image.yml

Now, sit back and watch HIMYM to know how Ted meets his children's mother. Yes, it may take that long (unless you're Barney with NASA's hardware).

💡
Please raise the GitHub Issue with the error message along with system configuration if the process failed.

Testing the output

Once the build process concludes, check out the artifact by executing:

make checkout ELEMENT=installer/image.yml DESTDIR=out

This will check out the installer/image.yml component inside the out directory (essentially the ISO file).

out
├── rlxos-stable-installer.iso
└── rlxos-stable-installer.iso.sha265sum

0 directories, 2 files

You can use any other virtual machine or even real hardware to test the built ISO.

I prefer to use QEMU with KVM for nearly native-like performance. First, create a hard disk image by:

qemu-img create -f qcow2 disk.img 16G

This will create a dynamically allocated 16G disk image where you can virtually install RLXOS without impacting your system..

Now, execute the command to boot into the RLXOS ISO:

qemu-system-x86_64 -cdrom out/rlxos-stable-installer.iso \
    -m 2G -smp 2 -enable-kvm -cpu host \
    -soundhw hda -vga virtio \
    -drive "file=disk.img,format=qcow2"
OptionDescription
-cdrom <ISO>Specify the ISO file in this case path to our generated ISO.
-m 2G2GiB Size of virtual memory allocated to virtual machine, Like RAM in hardware
-smp 2Number of CPU allocated to the machine
-enable-kvmUse Kernel virtual machine extension of Linux kernel to enhance performance.
-cpu hostUse CPU instruction similar to host CPU
-soundhw hdaSpecify sound hardware
-drive "file=.."Specify the storage drive in this case our generated disk.img.

I reckon that's sufficient for this part. You now have the RLXOS source code and know how to build and test it. You're all set to explore the project source code and various files.

In the upcoming parts, I'll delve into:

  • Setting up update mechanisms and managing different update channels

  • Establishing CI/CD Pipelines for continuous deployment

  • Contributing to the project

  • Customizing components, theming, and creating your own custom RLXOS distribution

  • Adding support for other Desktop Environments

  • Writing element files and porting packages to RLXOS

  • Or we can delve deeper into the build process

Until then, please like the post, follow the blog, and star my GitHub repository. Your support keeps me motivated. Feel free to leave a comment if you encounter any doubts or hurdles. 🌟

0
Subscribe to my newsletter

Read articles from Manjeet Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Manjeet Singh
Manjeet Singh