Build DahliaOS from source: Step-by-step guide for beginners

Step-by-step guide to setup a build environment for DahliaOS (Flutter, Dart, etc.) and compile DahliaOS from source with Pangolin Desktop Environment.

DahliaOS seems to gain in popularity each day. For those uninformed, DahliaOS is a new Linux distribution that combines the good in both Linux and Fuchsia. Recently, I also shared an article in which I was able to run DahliaOS on my PS4. DahliaOS is still in its pre-release stage. But, that doesn’t mean, you as a dev can’t tinker with it to make it better. So, how to build/compile DahliaOS from source? That is what we will be discussing in this article.

DahliaOS uses buildroot to compile the system images (iso, cpio, etc.) That makes the compilation easy. But, as a beginner, setting up a build environment for DahliaOS and successfully building the OS could be a nightmare for many. If you do follow this article to a T, you will have DahliaOS images for your system compiled in no time.

We will begin with the basic requirements for this.

Requirements

Linux OS

While a Buildroot compilation can be done on almost any Linux system, I prefer Ubuntu or Ubuntu-based distros for this. I suggest you use the same, and please keep in mind that this tutorial and the command used on it have Ubuntu-based distros in mind. By the way, if you are Windows lover and don’t want to dual boot Linux, you can always create a virtual machine to run Linux on.

Disk space >60 GB

Building the latest build of Dahlia OS on my Linux distribution took up more than 35GB. To be safe, I recommend having atleast 60 GB of free space on your storage drive. If you are doing this on a virtual machine, you could also allot it a lot more than that. Why is that? Because, we will be setting up a build environment on this system. So, you could actually use the same setup for building other stuff later on.

CPU with >4 Cores

The build process is CPU intensive. The building speed will depend a lot on how many cores your CPU has. I have been able build this successfully even on a 2 Core virtual machine. But, I recommend doing this on atleast a quad-core CPU, for the fastest speed possible.

RAM >10 GB

The DahliaOS team recommends having atleast 10GB of RAM on the system compiling the OS. Not having 10GB RAM doesn’t mean your build will necessarily fail. But, the chances still persist.

Stable Internet Connection

The speed of the build also depends on the internet connection. This is because buildroot does download a lot of stuff and compile it on spot. So, I recommend you connect via Ethernet if you have a spotty WiFi connection.

That forms the basic requirements. The required software and packages will be dealt with under the relevant sections of the process accordingly. So, let us begin with the process.

Setup build environment for DahliaOS

As I already said, before building DahliaOS, we have to make sure that our Ubuntu system is capable of building the OS. That’s what we will do now. Follow these steps properly.

Step 1. Update the system and install build essentials

  1. Open a terminal and type sudo apt update && sudo apt upgrade and press Enter.
  2. Reboot the system (not compulsory, but recommended).
  3. Open a terminal and type sudo apt install build-essential libgtk-3-dev clang syslinux-utils ccd2iso gobject-introspection cmake ninja-build nano and press Enter.

Step 2. Install Dart SDK

  1. Open a terminal and type sudo apt install apt-transport-https and press Enter.
  2. Type wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/dart.gpg and press Enter.
  3. Then, type echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list and press Enter.
  4. Update the deb database again by typing sudo apt update and press Enter.
  5. Finally, to install Dart, type sudo apt install dart and press Enter.

Step 3. Download and extract Flutter SDK

  1. Download the latest stable Flutter SDK (tar.xz) to the Downloads folder in your home directory.
  2. Open a terminal and make sure you are in the home directory. If unsure, type cd ~ and press Enter.
  3. Then, type tar xf ~/Downloads/flutter_linux_2.10.5-stable.tar.xz and press Enter. This will extract Flutter SDK to the home directory. You might have to change the filename according to the latest version you downloaded.

Step 4. Add Flutter SDK to path

This step is important, failing which the build will throw errors later on.

  1. Open a terminal. Type sudo nano ~/.bashrc and press Enter.
  2. Go to the last line of the document and add export PATH="$HOME/flutter/bin:${PATH}".
  3. Press Ctrl+S first and then Ctrl+X to save the changes and exit.
  4. Restart the terminal, i.e., close the current terminal window and start a new one.
  5. To check if Flutter installation was successful, type flutter and press Enter. If it says, command not found, you should worry, but if brings up the help page for Flutter, continue.
  6. On the terminal, type flutter config --enable-linux-desktop and press Enter.

With that, we have setup the build environment for DahliaOS successfully. Flutter and Dart SDKs are an important part of the setup, not just for building DahliaOS images. They will also help you develop apps for the OS.

Now, we are ready to download DahliaOS source and build images to boot off of.

Build DahliaOS from source

In this tutorial, we are going to be building the OS in a folder in the Home directory. If you plan to build on a different drive or folder, you will have to adjust the commands accordingly.

Step 1. Download DahliaOS source and add necessary patch(es)

  1. Download the libglib2 patch for the build to the Downloads folder.
  2. Open a terminal. Making sure you are in the Home directory, type git clone https://github.com/dahliaOS/buildroot.git and press Enter.
  3. Type cd buildroot.
  4. Move the libglib2 patch to the relevant folder by typing cp $HOME/Downloads/0004-glib-safe-close.patch package/libglib2 and pressing Enter.

With that, we are ready to proceed to the final step of the process, i.e., starting the compilation.

Step 2. Build Dahlia OS using make

  1. On the terminal, make sure you are in the buildroot directory. If undure, type cd $HOME/buildroot and press Enter.
  2. If you would like to change anything in the build like the kernel settings or the busybox settings, type these commands, as necessary:-
    • make menuconfig
    • make busybox-menuconfig
    • make linux-menuconfig
  3. When satisfied with the settings, type make and press Enter.

Sit back! Order your favourite takeout or go on a trip. Well, the last one might have been a stretch. But, be prepared to wait a long time, depending on your system’s specs and internet speed, it might take a few hours to complete. To give you an idea, my VM with 10GB RAM and 4 cores took about 6 hours for the build to complete.

Once the build is complete, you will find the images in the output/images folder within the buildroot directory.

The ISO will be named rootfs.iso9960 while you will also have the images in .cpio and .cpio.xz formats.

If you did follow every instruction properly, you should have been able to boot into base DahliaOS which is nothing but a simple looking OS with three terminals. You probably weren’t looking for this, I know. What you were hoping to see on the first boot is the Pangolin Desktop Environment. So now, we will see how you could integrate Pangolin DE to DahliaOS.

Build DahliaOS with Pangolin Desktop

  1. Open a terminal in the buildroot directory, type cp -rvf dahliaOS-overlays/* output/target and press Enter.
  2. Re-compile the image with Pangolin by typing make and press Enter.

This build will not take a lot of time. For me, it completes within 15 minutes. Again, you can look for the images in the output/images folder.

That’s it my dear, readers! I hope you were able to build DahliaOS from scratch using this tutorial.

Conclusion

At last, but not the least, I would like to extend special thanks to /usr/apple, quintenvandamme and systemd for the win from the DahliaOS Discord group for all the help. By the way, if you need any help figuring out any issues that pop up, leave a comment below and I will get back to you.

4 Comments

Leave a Reply

Your email address will not be published.


*