How to create a customised rootfs image without rebuilding whole system?

Hi there,

I have searched on forum and it doesnt seem to have a clear answer or maybe there is no answer to this question. My questions is if there is any simple way to create a rootfs image that have new applications upgraded or installed.

I wish to install some application and upgrade gstreamer etc on original system. How do I create a rootfs image that contains all modifications? Is there any simple method to do this? Is it possible to flash boot and rootfs images to SD card and then boot up with SD card and install applications and modify configurations and then use this SD card to create an image rootfs file that can be flashed to UFS or eMMC? The reason for this is to make production simpler.

Many thanks.

Kind regards,
Fang

This was the approach that I used and it worked for what I required:

Which OS are you running? if debian, you can simply use apt to upgrade your packages.

Hi Loic, Thank you for your reply.
Yes, i can upgrade applications. But for production I need to be able to convert upgraded system to an image file to let production team to flash it straightaway so that on production line they do not need to flash an image file that requires any upgrading.

Thank you Barry, I will try this method.

you can try
In Host machine,

  1. simg2img rootfs image
  2. mount the rootfs image and install required deb packages.
  3. After installing required packages unmount rootfs and use img2simg.

Thanks,
Arun

Thank you Arunkumar,

I have tried to simg2img rootfs image and mounted it. But I do not know how to install packages on mounted image? Could you please explain a little bit more about how to install required deb packages on mounted rootfs image? I have never done this before. Many thanks in advance.

I think you’re making this more complicated than it needs to be.

Install the rootfs of your choice on one db820c, update and configure it to your specifications, then remount the rootfs as read-only and use the ‘dd’ command to create an image of it, i.e., to an sdcard or usb disk. If you use the ‘sparse’ option to dd, you won’t need to run img2simg.

Thank you doitright and all other replies. It seems there are many options here we can use. I will try all of them. Many thanks all.

It should be generally discouraged to do that. there are files created during the first boot (ssh keys, machine-id, …) which are supposed to be unique per device. So you need to be cautious about that.