[EDIT: simplified and corrected]

I would like to use the same method as Raspbian install which relies on dd deployment to a µSD. Meaning, from a minimal image file, deploy the "augmented" Raspbian system partitions with dd on a SD card, resulting into two partitions and their files.

Is there a way to augment (inject files) the image blob file?

(The augmented image file won't fit into RAM)

  • I think the easiest way is to install it i a fast SD card, do some tweaks and then clone it to an image file. Otherwise, to create an own operating system (maybe call it re-spin) is a rather big task. You could do it from scratch using an existing system in your computer. There are also some shortcuts, but I have no own experience from doing it in an RPi. – sudodus Jun 27 '20 at 19:05
  • thank you @sudodus, I will do the simple way for now. The only optimization I can think of is to use a 8GB µSD, so that the dd won't take very long. Otherwise, I studied 4 scenarios: dd with partitions, ramfs, whole disk 'dd' containing the required partitions, dd extended partition containing required partitions. None can work for several reasons. It is a bit too long to give details. – sugarman Jun 27 '20 at 20:25
  • actually, I would like to modify the blob image file, as you can do it for .iso files using a software. You can open the .iso and add/delete files. Would it be also possible with a dd image of the µSD card? – sugarman Jun 28 '20 at 7:08
  • If you don't want to work with the system on a real drive (µSD card), you might be able to work with it in a virtual machine with a virtual disk (for example using VirtualBox). I think it is possible to edit an image in a file directly, it the file system is writable, but I have not worked that way, and cannot give any detailed warnings and tips. – sudodus Jun 28 '20 at 7:13
  • @sudodus well, that would not be suited for my use case. I'm looking for an industrialized process, using few and swift steps. The process would be: start with a deployed Rasbian on a µSD card >---> dd to Desktop (one image file or partitions) >---> adding files to it on Desktop >---> 'dd' back to a new µSD : fully working augmented Raspbian – sugarman Jun 28 '20 at 8:46

@sudodus helped me find the answer.

How to augment the image? -> mount the image file as loop disk/partitions. Use a mounting point. Add the files. For details: another loop question

How to use dd to write the augmented image to another µSD?

sudo dd bs=4M status=progress of=/dev/sdf if=/dev/loop1 conv=fsync

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.