pengutronix / genimage

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

How to use tar to get an extra compressed file of the image? #219

Closed maovidal closed 1 year ago

maovidal commented 1 year ago

Hi everyone:

I'm having trouble to understand how to use https://github.com/pengutronix/genimage#tar

My ultimate interest is to get a *.tar.gz file from an image. Let's say I have this:

image boot.vfat {
    vfat {
        files = {
            "efi-part/EFI",
        }
    }
    size = 16352K # 16MB - 32KB
}

I have tried this on the same genimage.cfg:

image boot.vfat {
    vfat {
        files = {
            "efi-part/EFI",
        }
    }
    size = 16352K # 16MB - 32KB
    tar {}
}

But genimage complains about receiving 2 images.

Then I tried:

image boot.vfat {
    vfat {
        files = {
            "efi-part/EFI",
        }
    }
    size = 16352K # 16MB - 32KB
}

image boot.vfat.tar.gz {
    tar {}
}

This last one produces the boot.vfat but also an empty boot.vfat.tar.gz. What is the correct way to use tar?

Thank you!

a3f commented 1 year ago

Do you want the contents of the image in the tar.gz or the image itself in compressed form?

maovidal commented 1 year ago

Hi @a3f

Mi intention is/was to get that boot.vfatimage file compressed. I was able to achieve it using the exec-post option.

However, later I was thinking that maybe I understood incorrectly the tar option. I didn't find any clue about how to use it (inspecting the source with my rudimentary knowledge) as passing other options like files or image are rejected by genimage for tar.

What could be an example of its use case and how to use it? Currently this is all the content of the documentation for the tar option:

Generates a tar image. The image will be compressed as defined by the filename suffix.

Thank you!

a3f commented 1 year ago

exec-post = "gzip -k $IMAGEOUTFILE" is the correct way to achieve that. The tar image is for creating a tarball containing the files in the --rootpath.