Modifying the first run setup

I would like to modify the DietPi first run setup to not repartition the drive. There are other partitions with data that must be maintained. I’m considering replacing our current Debian image with DietPi.

Do you mean the resizing of the partition?
https://github.com/MichaIng/DietPi/blob/063b3b62d942f5be9297166293d429370a941d2f/rootfs/var/lib/dietpi/services/fs_partition_resize.sh

You could just clone/fork the repo, modify to your needs and build your own images.

would be good to have some more information on current scenario and what exactly should be done.

We have two products in the field. One uses an i.MX6QP module and the other is using a Raspberry Pi Compute Module 4. Both are running a scaled-down version of Debian Linux Bullseye. Both use A-B Update mechanism where there are two fixed size Linux partitions and a data partition. Each uses a different mechanism to generate its Linux image. For the Pi, I use a modified pi-gen program. Neither of these mechanism create a repeatable image because they pull from the latest Debian repository.

I’m considering using Diet-Pi for both devices. Ideally, I would like to create one image that is loadable by both devices with the device trees selected by the bootloader. The CM4 image is already available but I will have to create one for the i.MX6. I don’t know if I need to modify the the repartitioning script yet, but for my current Pi image, I had to disable the first run script service and run my own.

My current way of creating Linux images has a lot of manual steps and is prone to errors. My goal is to be able to create Linux images that:

  1. Uses a commercial off-the-shelf (COTS) Linux image.
  2. Has one step to modify the image to our needs.
  3. Creates the same image no matter what day or how many times its created.
  4. Is easy to modify or upgrade as needed.

For testing purposes, I’m using the Generic Device load procedure on our i.MX6 product to create the Diet Pi image from the current image. When I reboot, I don’t want to destroy the current data partition and leave the current partitions intact. I can work from there to make a test image for our device.

Whatever you have in mind, it won’t be possible with the standard DietPi image. The case is simply too unique. So you’ll probably have no choice but to fork the DietPi repository and make your own specific modifications.

Furthermore, I don’t know if it’s even possible to create a single image for both devices. The RPi generally differs quite significantly from other SBCs in terms of kernel, bootloader and partition layout.

If it were possible to create a single image for different SBCs, we’d probably have done so already. Just look at the OrangePi 5 series with Pro, Plus, Max, Ultra and CM. We’ve always had to build a separate image for each one.