[OpenWrt-Devel] [PATCH 2/5] build: image: Add pad-to and pad-rootfs-squashfs helpers

Felix Fietkau nbd at nbd.name
Sat Mar 30 04:18:39 EDT 2019

On 2019-03-30 07:48, Petr Štetiar wrote:
> Felix Fietkau <nbd at nbd.name> [2019-03-29 18:14:36]:
>> On 2019-03-29 15:07, Petr Štetiar wrote:
>> > +
>> > +define Image/pad-root-squashfs
>> > +	$(call Image/pad-to,$(KDIR)/root.squashfs,$(if $(1),$(1),$(CONFIG_TARGET_ROOTFS_PARTSIZE)M))
>> > +endef
>> The image should only be padded if CONFIG_TARGET_IMAGES_PAD is set.
>> Keeping images not padded by default makes them faster to build and
>> faster to write to storage on upgrade.
> I've just flashed the combined image to my apu2 and it works as expected, now
> I get it why it should be handled differently only for QEMU. Thanks.
>> I think it would be better to write a separate script to pad images to
>> partition size for qemu purposes.
> Since I find it quite useful to be able to download the image from snapshots
> and use it on QEMU for quick testing, I'm wondering how to handle this use
> case properly.
> Should we simply add CONFIG_QEMU_SQUASHFS_IMAGES (enabled by default) and
> CONFIG_QEMU_SQUASHFS_PARTSIZE=32 and use this information for generating of
> images for QEMU? On armvirt/malta it will simply produce working images based
> on this settings, on x86 it will produce two additional images usable in QEMU
> as well:
I would like to avoid adding generating padded images by default. I just
came up with this simple script, which takes an existing image and pads
it to full size: http://nbd.name/pad-image.pl
With this, shipping padded images should be unnecessary.

>  openwrt-x86-64-qemu-combined-squashfs.img
>  openwrt-x86-64-qemu-rootfs-squashfs.img
Another semi-related thing: do we really need those separate rootfs
images? We could save some download server storage space by dropping
them. If necessary, we could make another script like the one above to
extract it from the combined image.

- Felix

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list