Noob Building an image advice

Hi all,
I'm following the instructions in https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem to create an x86 image for my GW-R86S mini router/gateway.

However, I downloaded the default config from:
https://downloads.openwrt.org/releases/22.03.4/targets/x86/generic/config.buildinfo -O .config

loaded it and ran
make menuconfig where I loaded the .config file to test and saved

But when I run
make -j$(nproc) V=s defconfig download clean world

I get the following errors:

/home/user/openwrt/build_dir/host/llvm-project-13.0.0.src/llvm/include/llvm/ADT/SparseBitVector.h:54:11: note: while referencing 'llvm::SparseBitVectorElement<128>::Bits'
   54 |   BitWord Bits[BITWORDS_PER_ELEMENT];
      |           ^~~~
[1988/3328] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
FAILED: lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
/home/user/openwrt/staging_dir/host/bin/g++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/user/openwrt/build_dir/host/llvm-project-13.0.0.src/build/lib/Passes -I/home/user/openwrt/build_dir/host/llvm-project-13.0.0.src/llvm/lib/Passes -I/home/user/openwrt/build_dir/host/llvm-project-13.0.0.src/build/include -I/home/user/openwrt/build_dir/host/llvm-project-13.0.0.src/llvm/include -O2 -I/home/user/openwrt/staging_dir/host/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -DNDEBUG  -fno-exceptions -fno-rtti -std=c++14 -MD -MT lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o -MF lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o.d -o lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o -c /home/user/openwrt/build_dir/host/llvm-project-13.0.0.src/llvm/lib/Passes/PassBuilder.cpp
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[1995/3328] Building CXX object tools/clang/lib/Lex/CMakeFiles/obj.clangLex.dir/ModuleMap.cpp.o
ninja: build stopped: subcommand failed.

Why do you have to build another build when x86/64 can be installed on R86S?

I need to build my own custom build with installed packages. Some from the original installation and my own ones.

I came across the online builder which is such a fantastic tool. However, building a custom x86 online with the packages results in an error about out of space. I don't see an option to change the partition size in the builder so I feels stuck.

Download the image builder and run it locally
To set the size of the rootfs use CONFIG_TARGET_ROOTFS_PARTSIZE. Please don't ask me why it's not mentioned in https://openwrt.org/docs/guide-user/additional-software/imagebuilder
But in general this site is pretty useful.

Edit: if you do not need to patch anything then there is normally no need to compile the image your self. The image builder is most of the time sufficient.

3 Likes

WOW. That's great.

It seems like a much easier method. However, I tried building with my list of packages and set the "CONFIG_TARGET_ROOTFS_PARTSIZE=512"

Now I'm getting:

Collected errors:
 * opkg_install_cmd: Cannot install package kmod-amazon-ena.
 * opkg_install_cmd: Cannot install package kmod-amd-xgbe.
 * opkg_install_cmd: Cannot install package libnl-tiny1.
 * opkg_install_cmd: Cannot install package libopenssl1.1.
 * opkg_install_cmd: Cannot install package luci-app-dockerman.
 * opkg_install_cmd: Cannot install package luci-lib-docker.
make[2]: *** [Makefile:186: package_install] Error 255
make[1]: *** [Makefile:141: _call_image] Error 2
make: *** [Makefile:259: image] Error 2

Any ideas why? I checked and the packages above are in the main package lists!

Do you use stable or snapshot builder?
I'm not sure but try to make download first just to prevent download issues...

I tried both snapshot and stable. The above is with the snapshot.

I get this with the stable one:

Collected errors:
 * opkg_install_cmd: Cannot install package kmod-amazon-ena.
 * opkg_install_cmd: Cannot install package kmod-amd-xgbe.
 * opkg_install_cmd: Cannot install package kmod-asn1-encoder.
 * opkg_install_cmd: Cannot install package kmod-fs-ntfs3.
 * opkg_install_cmd: Cannot install package luci-app-dockerman.
 * opkg_install_cmd: Cannot install package luci-lib-docker.
make[2]: *** [Makefile:170: package_install] Error 255
make[1]: *** [Makefile:125: _call_image] Error 2
make: *** [Makefile:243: image] Error 2

I tried make download but I get "make: *** No rule to make target 'download'. Stop."

I tried updating the packages list using:
./scripts/feeds update -a
./scripts/feeds install -a

But I get: "Unable to open feeds configuration at ./scripts/feeds line 91."

Ah sorry the imagebuilder has no download target. Nevermind...
How ever, why do you think you need ./scripfs/feeds when using the imagebuilder?

I tried to reproduce your issue...

bernd@hiten /tmp/openwrt-imagebuilder-22.03.4-x86-64.Linux-x86_64 $ make V=s image PROFILE="generic" CONFIG_TARGET_KERNEL_PARTSIZE=64 CONFIG_TARGET_ROOTFS_PARTSIZE=512 PACKAGES="kmod-amazon-ena kmod-amd-xgbe kmod-asn1-encoder kmod-fs-ntfs3 luci-app-dockerman luci-lib-docker" | tee make.log
<snip>

Configuring kmod-Collected errors:
 * opkg_install_cmd: Cannot install package kmod-asn1-encoder.
 * opkg_install_cmd: Cannot install package kmod-fs-ntfs3.
nls-cp437.
<snip>
make[2]: *** [Makefile:170: package_install] Error 255
make[1]: *** [Makefile:125: _call_image] Error 2
make: *** [Makefile:243: image] Error 2

Same issue (Cannot install package kmod-asn1-encoder and kmod-fs-ntfs3) is also present with imagebuilder 22.03.3.

EDIT: If it is NTFS write support you want to achive: use ntfs-3g, as explained here: https://openwrt.org/docs/guide-user/storage/writable_ntfs?s[]=kmod&s[]=fs&s[]=ntfs3 With nfts-3g the imagebuilder works... (I still have to look whats maybe the issue with kmod-asn1-encoder)

I thought maybe it couldn't find the packages
kmod-asn1-encoder
luci-lib-docker
luci-app-dockerman
kmod-amazon-ena
kmod-amd-xgbe

because the feeds are somehow out of date or something.

I removed kmod-fs-ntfs3 and I'm still getting the error about the above.

The full list is this:

make V=s image \
CONFIG_TARGET_ROOTFS_PARTSIZE=512 \
PACKAGES="attr avahi-dbus-daemon base-files bc blkid block-mount bnx2-firmware bnx2x-firmware btrfs-progs busybox ca-bundle ca-certificates cfdisk cgroupfs-mount containerd coremark coreutils coreutils-nohup curl dbus ddns-scripts dnsmasq docker dockerd dropbear e2fsprogs eject etherwake ethtool fdisk firewall4 fstools fwtool gdisk getrandom grub2 grub2-efi hostapd hostapd-common htop ip-full iperf3 ipset iptables-mod-extra iptables-mod-ipsec iptables-mod-tproxy iw iwinfo iwlwifi-firmware-ax200 iwlwifi-firmware-ax210 jshn jsonfilter kernel kmod-8139cp kmod-8139too kmod-alx kmod-asn1-decoder kmod-asn1-encoder kmod-ath kmod-ath10k kmod-bnx2 kmod-bnx2x kmod-bonding kmod-br-netfilter kmod-button-hotplug kmod-cfg80211 kmod-crypto-acompress kmod-crypto-aead kmod-crypto-arc4 kmod-crypto-authenc kmod-crypto-cbc kmod-crypto-ccm kmod-crypto-cmac kmod-crypto-crc32 kmod-crypto-crc32c kmod-crypto-ctr kmod-crypto-deflate kmod-crypto-des kmod-crypto-ecb kmod-crypto-echainiv kmod-crypto-gcm kmod-crypto-gf128 kmod-crypto-ghash kmod-crypto-hash kmod-crypto-hmac kmod-crypto-lib-chacha20 kmod-crypto-lib-chacha20poly1305 kmod-crypto-lib-curve25519 kmod-crypto-lib-poly1305 kmod-crypto-manager kmod-crypto-md5 kmod-crypto-null kmod-crypto-rng kmod-crypto-seqiv kmod-crypto-sha1 kmod-crypto-sha256 kmod-crypto-user kmod-cryptodev kmod-dax kmod-dm kmod-dma-buf kmod-drm kmod-drm-kms-helper kmod-drm-ttm kmod-dummy kmod-e1000 kmod-e1000e kmod-fb kmod-fb-cfb-copyarea kmod-fb-cfb-fillrect kmod-fb-cfb-imgblt kmod-fb-sys-fops kmod-fb-sys-ram kmod-forcedeth kmod-fs-btrfs kmod-fs-exfat kmod-fs-ext4 kmod-fs-f2fs kmod-fs-vfat kmod-hid kmod-hid-generic kmod-hwmon-core kmod-i2c-algo-bit kmod-i2c-core kmod-i40e kmod-iavf kmod-igb kmod-igbvf kmod-igc kmod-ikconfig kmod-input-core kmod-input-evdev kmod-ip6tables kmod-ipsec kmod-ipsec4 kmod-ipsec6 kmod-ipt-conntrack kmod-ipt-core kmod-ipt-extra kmod-ipt-ipsec kmod-ipt-ipset kmod-ipt-nat kmod-ipt-raw kmod-ipt-tproxy kmod-iptunnel4 kmod-iptunnel6 kmod-irqbypass kmod-iwlwifi kmod-ixgbe kmod-keys-encrypted kmod-keys-trusted kmod-kvm-intel kmod-kvm-x86 kmod-lib-crc-ccitt kmod-lib-crc16 kmod-lib-crc32c kmod-lib-lzo kmod-lib-raid6 kmod-lib-textsearch kmod-lib-xor kmod-lib-zlib-deflate kmod-lib-zlib-inflate kmod-lib-zstd kmod-libphy kmod-mac80211 kmod-macvlan kmod-mdio kmod-mdio-devres kmod-mii kmod-mlx4-core kmod-mlx5-core kmod-mmc kmod-mppe kmod-mt76-connac kmod-mt76-core kmod-mt76-sdio kmod-mt76-usb kmod-mt7921-common kmod-mt7921e kmod-mt7921s kmod-mt7921u kmod-nf-conntrack kmod-nf-conntrack-netlink kmod-nf-conntrack6 kmod-nf-ipt kmod-nf-ipt6 kmod-nf-ipvs kmod-nf-log kmod-nf-log6 kmod-nf-nat kmod-nf-nathelper kmod-nf-nathelper-extra kmod-nf-reject kmod-nf-reject6 kmod-nf-tproxy kmod-nfnetlink kmod-nls-base kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8 kmod-oid-registry kmod-pcnet32 kmod-ppp kmod-pppoe kmod-pppox kmod-pps kmod-ptp kmod-random-core kmod-scsi-core kmod-sdhci kmod-slhc kmod-tcp-bbr kmod-thermal kmod-tpm kmod-tulip kmod-tun kmod-udptunnel4 kmod-udptunnel6 kmod-usb-core kmod-usb-hid kmod-usb-net kmod-usb-net-aqc111 kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8150 kmod-usb-storage kmod-usb-storage-extras kmod-usb-storage-uas kmod-veth kmod-via-velocity kmod-vmxnet3 kmod-wireguard libatomic1 libattr libavahi-client libavahi-dbus-support libblkid1 libblobmsg-json libbpf libc libcap libcomerr0 libcurl4 libdaemon libdbus libdevmapper libelf1 libevent2-core7 libexpat libext2fs2 libf2fs6 libfdisk1 libgcc1 libgmp10 libgnutls libip4tc2 libip6tc2 libipset13 libiwinfo-lua libiwinfo libjson-c5 libjson-script libkmod liblua5.1.5 liblzo2 libminiupnpc libmnl0 libmount1 libnatpmp1 libncurses6 libnettle8 libopenssl-conf libparted libpcap1 libpci libpcre libpopt0 libpthread libreadline8 librt libseccomp libsensors5 libsmartcols1 libss2 libstdcpp6 libsysfs2 libtasn1 libtirpc libubox libubus-lua libubus libuci-lua libuci libuclient20201210 liburing libusb-1.0-0 libuuid1 libuv1 libwebsockets-full libxtables12 lm-sensors logd lsblk lua luci luci-app-ddns luci-app-firewall luci-app-nlbwmon luci-app-openvpn luci-app-ttyd luci-app-upnp luci-app-wol luci-base luci-lib-ip luci-lib-jsonc luci-lib-nixio luci-mod-admin-full luci-proto-bonding luci-proto-ppp luci-proto-wireguard luci-theme-bootstrap mkf2fs mount-utils mtd ncdu netifd nlbwmon openssl-util openwrt-keyring opkg parted partx-utils pciids pciutils ppp ppp-mod-pppoe procd procps-ng procps-ng-watch proto-bonding resize2fs rpcd rpcd-mod-rrdns runc screen shadow-common shadow-useradd shadow-utils smartmontools stress strongswan strongswan-charon strongswan-ipsec strongswan-minimal strongswan-mod-aes strongswan-mod-gmp strongswan-mod-hmac strongswan-mod-kernel-libipsec strongswan-mod-kernel-netlink strongswan-mod-nonce strongswan-mod-pubkey strongswan-mod-random strongswan-mod-sha1 strongswan-mod-socket-default strongswan-mod-stroke strongswan-mod-updown strongswan-mod-x509 strongswan-mod-xauth-generic strongswan-mod-xcbc sysfsutils tcpdump terminfo tini tmux ttyd ubox ubus ubusd uci uclient-fetch uhttpd uhttpd-mod-ubus urandom-seed usbids usbutils usign uuidgen wget-ssl wireguard-tools wireless-regdb wpa-supplicant wsdd2 zerotier zlib nano openvpn-openssl luci-app-openvpn luci-app-samba4 luci-app-ddns ca-certificates luci-app-wireguard qrencode luci-proto-wireguard luci-app-statistics collectd-mod-openvpn kmod-usb-storage kmod-usb-storage-uas kmod-fs-exfat usbutils block-mount libblkid luci-app-advanced-reboot stdiscosrv luci-app-statistics collectd collectd-mod-dns collectd-mod-interface collectd-mod-iptables collectd-mod-network collectd-mod-openvpn collectd-mod-rrdtool collectd-mod-tcpconns collectd-mod-wireless collectd-mod-uptime collectd-mod-thermal nlbwmon luci-proto-relay relayd luci-compat luci-lib-docker luci-app-dockerman kmod-amazon-ena kmod-amd-xgbe libnl-tiny1 libopenssl1.1 kmod-fs-ntfs3"

This is the list extracted from the existing installation of my R86S list plus some additional packages that I use.

But the image builder has no feeds by default...
I only used feeds when compiling an image.
I still don't understand why you need it?
What's with the asn1 module? What's for? Can you just remove it from the list for now?

I didn't know that. I don't need the feeds. I thought I did in order to install the packages it was complaining about.

I tried without the following:
kmod-asn1-encoder
luci-lib-docker
luci-app-dockerman
kmod-amazon-ena
kmod-amd-xgbe

and now I'm getting:

Building images...
Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on /home/user/openwrt-imagebuilder-x86-generic.Linux-x86_64/build_dir/target-i386_pentium4_musl/linux-x86_generic/root.squashfs, block size 262144.
Pseudo file "dev" exists in source filesystem "/home/user/openwrt-imagebuilder-x86-generic.Linux-x86_64/build_dir/target-i386_pentium4_musl/root-x86/dev".
Ignoring, exclude it (-e/-ef) to override.
[====================================================================================================================================================================================|] 4519/4519 100%

Exportable Squashfs 4.0 filesystem, xz compressed, data block size 262144
        compressed data, compressed metadata, compressed fragments,
        no xattrs, compressed ids
        duplicates are removed
Filesystem size 79692.86 Kbytes (77.83 Mbytes)
        28.05% of uncompressed filesystem size (284149.56 Kbytes)
Inode table size 32502 bytes (31.74 Kbytes)
        21.55% of uncompressed inode table size (150809 bytes)
Directory table size 42050 bytes (41.06 Kbytes)
        41.00% of uncompressed directory table size (102550 bytes)
Number of duplicate files found 529
Number of inodes 4376
Number of files 3607
Number of fragments 160
Number of symbolic links 550
Number of device nodes 1
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 218
Number of hard-links 0
Number of ids (unique uids + gids) 1
Number of uids 1
        unknown (0)
Number of gids 1
        unknown (0)
Creating filesystem with parameters:
    Size: 109051904
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 6656
    Inode size: 256
    Journal blocks: 0
    Label: rootfs
    Blocks: 26624
    Block groups: 1
    Reserved blocks: 0
    Reserved block group size: 7
error: ext4_allocate_best_fit_partial: failed to allocate 359 blocks, out of space?
make[3]: *** [/home/user/openwrt-imagebuilder-x86-generic.Linux-x86_64/include/image.mk:328: /home/user/openwrt-imagebuilder-x86-generic.Linux-x86_64/build_dir/target-i386_pentium4_musl/linux-x86_generic/root.ext4] Error 1
make[2]: *** [Makefile:205: build_image] Error 2
make[1]: *** [Makefile:143: _call_image] Error 2
make: *** [Makefile:259: image] Error 2

Here is my partition size:
CONFIG_TARGET_ROOTFS_PARTSIZE=512

Yep try to increase. Like 1024

I tried setting it to 512, 1024 and even 4096 and I always get "failed to allocate 359 blocks"

I think it's something else

p.s I also tried CONFIG_TARGET_KERNEL_PARTSIZE=16 and also CONFIG_TARGET_KERNEL_PARTSIZE=32 to no avail.

It's not a file system space issue on the build host ?

1 Like

Nope. Only using 6% of the available capacity.

Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           390M  740K  389M   1% /run
/dev/sda1        58G  3.1G   52G   6% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           390M     0  390M   0% /run/user/0
tmpfs           390M     0  390M   0% /run/user/1000

I also tried "make clean" first in case there is some residual issues.

Further to the above. Here's the actual output of the build process after I removed all the packages it complained about. It seems to pick random packages every time I reinitialise the set up and try again.

Building images...
Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on /home/user/openwrt-imagebuilder-22.03.4-x86-generic.Linux-x86_64/build_dir/target-i386_pentium4_musl/linux-x86_generic/root.squashfs, block size 262144.
Pseudo file "/dev" exists in source filesystem "/home/user/openwrt-imagebuilder-22.03.4-x86-generic.Linux-x86_64/build_dir/target-i386_pentium4_musl/root-x86/dev".
Ignoring, exclude it (-e/-ef) to override.
[====================================================================================================================================================================================\] 4627/4627 100%

Exportable Squashfs 4.0 filesystem, xz compressed, data block size 262144
        compressed data, compressed metadata, compressed fragments,
        no xattrs, compressed ids
        duplicates are removed
Filesystem size 92946.69 Kbytes (90.77 Mbytes)
        29.39% of uncompressed filesystem size (316278.03 Kbytes)
Inode table size 32922 bytes (32.15 Kbytes)
        21.71% of uncompressed inode table size (151615 bytes)
Directory table size 42042 bytes (41.06 Kbytes)
        40.72% of uncompressed directory table size (103245 bytes)
Number of duplicate files found 517
Number of inodes 4383
Number of files 3606
Number of fragments 190
Number of symbolic links  563
Number of device nodes 1
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 213
Number of ids (unique uids + gids) 1
Number of uids 1
        unknown (0)
Number of gids 1
        unknown (0)
Creating filesystem with parameters:
    Size: 109051904
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 6656
    Inode size: 256
    Journal blocks: 0
    Label: rootfs
    Blocks: 26624
    Block groups: 1
    Reserved blocks: 0
    Reserved block group size: 7
error: ext4_allocate_best_fit_partial: failed to allocate 2304 blocks, out of space?
make[3]: *** [/home/user/openwrt-imagebuilder-22.03.4-x86-generic.Linux-x86_64/include/image.mk:335: /home/user/openwrt-imagebuilder-22.03.4-x86-generic.Linux-x86_64/build_dir/target-i386_pentium4_musl/linux-x86_generic/root.ext4] Error 1
make[2]: *** [Makefile:189: build_image] Error 2
make[1]: *** [Makefile:127: _call_image] Error 2
make: *** [Makefile:243: image] Error 2

I have tried with the partition size set to 512 and all the way up to 4096 and it always comes up with "failed to allocate blocks"

Here's what I did to get that code to work.
Removed duplicate packages and the kmod-asn1-encoder as well as kmod-fs-ntfs3.
then changed 256 to 1024 on the line 56 of the target/linux/x86/image/Makefile

make V=s image \ ROOTFS_PARTSIZE="1024" \ PACKAGES="attr avahi-dbus-daemon base-files bc blkid block-mount bnx2-firmware bnx2x-firmware btrfs-progs busybox ca-bundle ca-certificates cfdisk cgroupfs-mount containerd coremark coreutils coreutils-nohup curl dbus ddns-scripts dnsmasq docker dockerd dropbear e2fsprogs eject etherwake ethtool fdisk firewall4 fstools fwtool gdisk getrandom grub2 grub2-efi hostapd hostapd-common htop ip-full iperf3 ipset iptables-mod-extra iptables-mod-ipsec iptables-mod-tproxy iw iwinfo iwlwifi-firmware-ax200 iwlwifi-firmware-ax210 jshn jsonfilter kernel kmod-8139cp kmod-8139too kmod-alx kmod-asn1-decoder kmod-ath kmod-ath10k kmod-bnx2 kmod-bnx2x kmod-bonding kmod-br-netfilter kmod-button-hotplug kmod-cfg80211 kmod-crypto-acompress kmod-crypto-aead kmod-crypto-arc4 kmod-crypto-authenc kmod-crypto-cbc kmod-crypto-ccm kmod-crypto-cmac kmod-crypto-crc32 kmod-crypto-crc32c kmod-crypto-ctr kmod-crypto-deflate kmod-crypto-des kmod-crypto-ecb kmod-crypto-echainiv kmod-crypto-gcm kmod-crypto-gf128 kmod-crypto-ghash kmod-crypto-hash kmod-crypto-hmac kmod-crypto-lib-chacha20 kmod-crypto-lib-chacha20poly1305 kmod-crypto-lib-curve25519 kmod-crypto-lib-poly1305 kmod-crypto-manager kmod-crypto-md5 kmod-crypto-null kmod-crypto-rng kmod-crypto-seqiv kmod-crypto-sha1 kmod-crypto-sha256 kmod-crypto-user kmod-cryptodev kmod-dax kmod-dm kmod-dma-buf kmod-drm kmod-drm-kms-helper kmod-drm-ttm kmod-dummy kmod-e1000 kmod-e1000e kmod-fb kmod-fb-cfb-copyarea kmod-fb-cfb-fillrect kmod-fb-cfb-imgblt kmod-fb-sys-fops kmod-fb-sys-ram kmod-forcedeth kmod-fs-btrfs kmod-fs-exfat kmod-fs-ext4 kmod-fs-f2fs kmod-fs-vfat kmod-hid kmod-hid-generic kmod-hwmon-core kmod-i2c-algo-bit kmod-i2c-core kmod-i40e kmod-iavf kmod-igb kmod-igbvf kmod-igc kmod-ikconfig kmod-input-core kmod-input-evdev kmod-ip6tables kmod-ipsec kmod-ipsec4 kmod-ipsec6 kmod-ipt-conntrack kmod-ipt-core kmod-ipt-extra kmod-ipt-ipsec kmod-ipt-ipset kmod-ipt-nat kmod-ipt-raw kmod-ipt-tproxy kmod-iptunnel4 kmod-iptunnel6 kmod-irqbypass kmod-iwlwifi kmod-ixgbe kmod-keys-encrypted kmod-keys-trusted kmod-kvm-intel kmod-kvm-x86 kmod-lib-crc-ccitt kmod-lib-crc16 kmod-lib-crc32c kmod-lib-lzo kmod-lib-raid6 kmod-lib-textsearch kmod-lib-xor kmod-lib-zlib-deflate kmod-lib-zlib-inflate kmod-lib-zstd kmod-libphy kmod-mac80211 kmod-macvlan kmod-mdio kmod-mdio-devres kmod-mii kmod-mlx4-core kmod-mlx5-core kmod-mmc kmod-mppe kmod-mt76-connac kmod-mt76-core kmod-mt76-sdio kmod-mt76-usb kmod-mt7921-common kmod-mt7921e kmod-mt7921s kmod-mt7921u kmod-nf-conntrack kmod-nf-conntrack-netlink kmod-nf-conntrack6 kmod-nf-ipt kmod-nf-ipt6 kmod-nf-ipvs kmod-nf-log kmod-nf-log6 kmod-nf-nat kmod-nf-nathelper kmod-nf-nathelper-extra kmod-nf-reject kmod-nf-reject6 kmod-nf-tproxy kmod-nfnetlink kmod-nls-base kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8 kmod-oid-registry kmod-pcnet32 kmod-ppp kmod-pppoe kmod-pppox kmod-pps kmod-ptp kmod-random-core kmod-scsi-core kmod-sdhci kmod-slhc kmod-tcp-bbr kmod-thermal kmod-tpm kmod-tulip kmod-tun kmod-udptunnel4 kmod-udptunnel6 kmod-usb-core kmod-usb-hid kmod-usb-net kmod-usb-net-aqc111 kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8150 kmod-usb-storage kmod-usb-storage-extras kmod-usb-storage-uas kmod-veth kmod-via-velocity kmod-vmxnet3 kmod-wireguard libatomic1 libattr libavahi-client libavahi-dbus-support libblkid1 libblobmsg-json libbpf libc libcap libcomerr0 libcurl4 libdaemon libdbus libdevmapper libelf1 libevent2-core7 libexpat libext2fs2 libf2fs6 libfdisk1 libgcc1 libgmp10 libgnutls libip4tc2 libip6tc2 libipset13 libiwinfo-lua libiwinfo libjson-c5 libjson-script libkmod liblua5.1.5 liblzo2 libminiupnpc libmnl0 libmount1 libnatpmp1 libncurses6 libnettle8 libopenssl-conf libparted libpcap1 libpci libpcre libpopt0 libpthread libreadline8 librt libseccomp libsensors5 libsmartcols1 libss2 libstdcpp6 libsysfs2 libtasn1 libtirpc libubox libubus-lua libubus libuci-lua libuci libuclient20201210 liburing libusb-1.0-0 libuuid1 libuv1 libwebsockets-full libxtables12 lm-sensors logd lsblk lua luci luci-app-firewall luci-app-nlbwmon luci-app-openvpn luci-app-ttyd luci-app-upnp luci-app-wol luci-base luci-lib-ip luci-lib-jsonc luci-lib-nixio luci-mod-admin-full luci-proto-bonding luci-proto-ppp luci-theme-bootstrap mkf2fs mount-utils mtd ncdu netifd nlbwmon openssl-util openwrt-keyring opkg parted partx-utils pciids pciutils ppp ppp-mod-pppoe procd procps-ng procps-ng-watch proto-bonding resize2fs rpcd rpcd-mod-rrdns runc screen shadow-common shadow-useradd shadow-utils smartmontools stress strongswan strongswan-charon strongswan-ipsec strongswan-minimal strongswan-mod-aes strongswan-mod-gmp strongswan-mod-hmac strongswan-mod-kernel-libipsec strongswan-mod-kernel-netlink strongswan-mod-nonce strongswan-mod-pubkey strongswan-mod-random strongswan-mod-sha1 strongswan-mod-socket-default strongswan-mod-stroke strongswan-mod-updown strongswan-mod-x509 strongswan-mod-xauth-generic strongswan-mod-xcbc sysfsutils tcpdump terminfo tini tmux ttyd ubox ubus ubusd uci uclient-fetch uhttpd uhttpd-mod-ubus urandom-seed usbids usbutils usign uuidgen wget-ssl wireguard-tools wireless-regdb wpa-supplicant wsdd2 zerotier zlib nano openvpn-openssl luci-app-samba4 luci-app-ddns ca-certificates luci-app-wireguard qrencode luci-proto-wireguard luci-app-statistics collectd-mod-openvpn kmod-fs-exfat usbutils block-mount libblkid luci-app-advanced-reboot stdiscosrv luci-app-statistics collectd collectd-mod-dns collectd-mod-interface collectd-mod-iptables collectd-mod-network collectd-mod-openvpn collectd-mod-rrdtool collectd-mod-tcpconns collectd-mod-wireless collectd-mod-uptime collectd-mod-thermal nlbwmon luci-proto-relay relayd luci-compat luci-lib-docker luci-app-dockerman kmod-amazon-ena kmod-amd-xgbe libnl-tiny1 libopenssl1.1"

Enter here on this site and search for your device/router then add your packages and build your image

https://firmware-selector.openwrt.org/

It won't change the root FS size thought.