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

Nishant Sharma codemarauder at gmail.com
Thu Feb 29 06:41:19 PST 2024


Bumping this thread after years.

On 01/04/19 11:03, Jo-Philipp Wich wrote:
>>>> 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.
>>> Ok, if that is preferred, it's fine with me. But we should probably add some
>>> note somewhere, that in order to test this images in QEMU (x86, armvirt,
>>> malta), the images should be padded with this script in order to provide
>>> usable images.
> Most other targets ship image artifacts which are usable ootb, requiring
> one extra step to pad the combined images is a waste of user resources
> every single time. It also causes recurring confusion among users
> wanting to use x86 builds since the need for padding is neither
> documented, nor obvious while a combined.img.gz makes it obvious that it
> is an image file which requires decompression.
> I really don't see the huge problem with conservatively padding the
> combined image artifacts to something like 32 or 48MB, it must not even
> be 256M or more.

I build large squashfs images (16GB, 32GB) for x86_64 running on Xeon 
processors for high workload gateways running VPN, Squid, Snort etc.

Till OpenWrt 19.07, I was able to build 32GB images on a machine with 
only 8GB of RAM and 8GB of swap. sysupgrade also worked fine on those 

But since 21.02, I am getting the *memory exhausted* error.

Below is the build log snippet for 23.05.2:



39891+1 records in
39891+1 records out
20424365 bytes (20 MB, 19 MiB) copied, 0.0445292 s, 459 MB/s

bs=16642998272 conv=sync

dd: memory exhausted by input buffer of size 16642998272 bytes (16 GiB)


Here the block size is set to 16GiB to pad rootfs and there are not 
enough system resources available on the build host to be able honour that.

I don't see any special case to handle x86/x86_64 in image-commands.mk

Is there a way I can disable padding for x86_64?

Thanks in advance.


More information about the openwrt-devel mailing list