Overriding CONFIG_TARGET_ROOTFS_PARTSIZE in Image Builder

I'm trying to build a custom x86 image with Image Builder with non-default rootfs size.

I can manually (or with sed) edit the .config file and change CONFIG_TARGET_ROOTFS_PARTSIZE value, but is there a way to do it from the command line?

So far I've tried the following none, of which worked for me:

make CONFIG_TARGET_ROOTFS_PARTSIZE=512 image 

export CONFIG_TARGET_ROOTFS_PARTSIZE=512
make -e image

export MAKEFLAGS="CONFIG_TARGET_ROOTFS_PARTSIZE=512"
make image

export CONFIG_TARGET_ROOTFS_PARTSIZE=512
export MAKEFLAGS=-e
make image

I also tried GNUMAKEFLAGS instead of MAKEFLAGS above, to no avail.

Apparently CONFIG_TARGET_ROOTFS_PARTSIZE isn't propagated to sub-makes in the Image Builder.

For now, using sed as a workaround:

sed -i 's/^\s*\(CONFIG_TARGET_ROOTFS_PARTSIZE\)\s*=\s*[^#\n \t]*/\1=512/' .config

Coincidentally, I've been experimenting with various KERNEL and ROOTFS partition sizes earlier today and I can confirm that specifying various values for CONFIG_TARGET_KERNEL_PARTSIZE and CONFIG_TARGET_ROOTFS_PARTSIZE on CLI for OpenWrt 21.02.1 image builder's make command doesn't work. The values from the .config file are always used and never overridden with values from CLI.

Sources stating that it should: How to set root filesystem partition size on x86 ImabeBuilder? and https://openwrt.org/docs/guide-user/installation/openwrt_x86#building_your_own_image_with_larger_partition_size.

Tagging @jow @vgaetera and another IB expert @aparcar

1 Like

Yes but It doesn't, I suppose because the .config file gets included again in the nested make files (try grep -r CONFIG_TARGET_ROOTFS_PARTSIZE), and it seems that any "override" variables specified on the make image command line aren't propagated to sub-makes, as well the MAKEFLAGS env variable.

I haven't fully followed through all the logic, but I noticed unset PROFILE FILES PACKAGES MAKEFLAGS (can be seen with grep -r MAKEFLAGS).

I'm also surprised the following doesn't work as expected, I didn't see GNUMAKEFLAGS being altered anywhere:

export CONFIG_TARGET_ROOTFS_PARTSIZE=512
export GNUMAKEFLAGS=--environment-overrides 

It looks like the bug is still there or has resurfaced

By the source code, make image only takes a few predefined options, the one you want is ROOTFS_PARTSIZE:
https://github.com/openwrt/openwrt/commit/7b7edd25a571568438c886529d3443054e02f55f

2 Likes