Create a DietPi based distro ?

Hi, im the maintainer of lysmarineos.com a raspbian based operating system for boats.

My project is quite young. So far I have build it with pi-gen. But dietPi seem interesting as it support many hardwares.

So im wondering if there any doc/tutorial on how I can put my stack of applications and configs on DietPi to make a derivative of it ?

I would seriously consider testing the possibility of changing the base OS for my project.

FredericGuilbault
Interesting project. If you want to use DietPi as base OS, the following might be good to know:

  • DietPi images are not built from scratch but on top of ready to run images.
  • E.g. our Raspberry Pi image(s) are based on Raspbian Lite, Odroid images are based on minimal Debian images from one of the Odroid contributors Meveric, some are based on ARMbian images, x86 images based on a clean Debian install from minimal (mini.iso) installer etc.
  • So all kernel, bootloader and firmware is based on what we get, including all the differences and in case limitations that are included, however that is a natural thing in the SBC world across all multi-platform OS’s.
  • To turn the image into DietPi, we run the following script on the running system: https://github.com/MichaIng/DietPi/blob/dev/PREP_SYSTEM_FOR_DIETPI.sh
  • It purges down the image as much as possible, leaving only very essential packages, disables some non-essential system services and kernel modules as well. The final system is WiFi+Ethernet capable and has Dropbear as SSH server pre-installed. A single getty on TTY1 and in case serial-gettys on existing serial devices (for headless boot debug). But aside from that (and of course core APT and systemd) there is not much left. That is properly a good basis for you as well to allow shipping cleaner images compared to what pi-gen creates?
  • However what might be not fitting as good is that the script as well installs the DietPi scripts bases (inside an automatically configured tmpfs), a RAMlog system and pre-configures several system configurations/files to work well with our system configuration script: https://github.com/MichaIng/DietPi/blob/dev/dietpi/dietpi-config + some other tools to handle mounts and such.
  • So depending on if/how much of the DietPi scripts/features you want to keep (https://dietpi.com/#features) you might need to clean those up, including some DietPi boot services and such. However not too hard to achieve, a simple find / -name ‘dietpi’ will show you everything that is related to our tool/script set.
  • When mounting a DietPi image, lysmarine_gen should work similar via chroot, but most core system (kernel, bootloader firmware, core system configuration etc) steps can/need to be skipped. So actually it is then only installing the desktop, programs and what you need for your OS in particular.
  • Important to know, when it’s about desktops/graphics functionality, that different SBCs require different graphics/mesa/mali drivers and related different X.org configuration. Those and firmware packages are usually provided by separate SBC-specific APT repositories. Since those are not pre-installed on DietPi systems, those need to be included (SBC-depending) in your built script.

On short:
So yeah it really depends on how much of DietPi you want to keep. Everything should be possible with a further modified lysmarine_gen that skips most core system install steps. In case you need to remove our scripts and services (WantedBy symlinks) and check/modify configuration files to your needs. Boot/firmware settings and graphics/desktop installs + settings need to be done SBC-dependant as mentioned.


Just to give some ideas:
Another possibility would be to implement your particular navigation tool set as an install option to our DietPi-Software script. We have a dependency system that allows to install a chosen desktop with X server the way required for the actual SBC and boot into it automatically. Downside perhaps from your point of view is that it is no own OS then, still DietPi, but the positive thing is that you don’t need to hassle with the SBC-specific needs but concentrate on your tool set.
We have two image sets with pre-installed/configured software as well. So still DietPi but the related software option (Allo GUI/AmiBerry) is pre-installed and boots into it automatically:

That is properly a good basis for you as well to allow shipping cleaner images compared to what pi-gen creates?

well yes, that one of my consern.


Downside perhaps from your point of view is that it is no own OS then, still DietPi, but the positive thing is that you don’t need to hassle with the SBC-specific needs but concentrate on your tool set.

Does that imply that each users will have to run my build script on a raspberrypi on the first boot ? ATM my build time around 2 hours on a i7-4300 CPU with a SSDrive and a 300 mbp/s connection. I can’t imagine how much time it would take for a user on a raspberry.
I will take a look at how allo.com and amiberry do.

I think my best approach would be to implement the lysmarine toolset as an install option on the DietPi-Software script,
mount it in QEMU as pi-gen/lysmarine-gen do,
run the install script and ship the ISO under lysmarine name as a dietpi based OS.

Would that make sense ? at least for SBCs that QEMU support.

I dried to pre-populate the Dietpi in QEMU and then put the resulting image on my sdcard. It worked, but I didin’t liked the boot speed.

So I took the other approach; downloading raspbian and running PREP_SYSTEM_FOR_DIETPI.sh

Repo is here : https://github.com/FredericGuilbault/lysmarine-build-tool