1

[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)

7
  • 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
    Commented Jun 27, 2020 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
    Commented Jun 27, 2020 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
    Commented Jun 28, 2020 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
    Commented Jun 28, 2020 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
    Commented Jun 28, 2020 at 8:46

2 Answers 2

1

@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

0
# losetup -fP image.img

-f will set it to the first loop device

-P will make a partition table

The device will be called /dev/loop0

1
  • Welcome to Stackexchange, and thanks for your first answer. However, it is not clear how your suggestion adds anything to the other answer. Commented Mar 9, 2021 at 2:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .