pengutronix / genimage

tool to generate multiple filesystem and flash images from a tree
GNU General Public License v2.0
308 stars 110 forks source link

How to auto fill sd card without expanding the image #120

Closed mttbx closed 3 years ago

mttbx commented 4 years ago

I want to make the image and burn it into my sd card. Suppose the size of the image is 20M, and of sd card is 32G. I want to know how to make the image automatically fill the rest of the sd card without generate a 32G image.

michaelolbrich commented 3 years ago

What exactly do you mean with 'fill the rest of the sd card'? What should happen with it? genimage can create empty partitions. And with a classic mbr and at most 4 partitions, this means that nothing is written there, so the image remains small. But you still need to create the filesystem after writing the image to the sd card.

Also, the sd card is probably not exactly 32G so you need to ensure that you get the exact size correctly.

mttbx commented 3 years ago

What I mean is to create a 20M image. When I burn it into my 32G sd card, the last partition will fill the remaining space. Is there a way?

aaribaud commented 3 years ago

This is a job for the system inside the image to perform on first run, not for genimage to try at build time.

For instance, on Raspberry Pi OS they do it by