X86 Firmware Selector: Root Partition Size Parameter

Hello,

What an amazing piece of software OpenWRT is. I cannot be happier using it on a repurposed x86 device as a router. Customisable, secure and effective for a lot a network related tasks. We are lucky to have community of developers who give their time to make it better year-on-year.

I have a request. Could the firmware selector website give us the ability to request a certain sized partition for the root partition on X86 builds? This would eliminate the need to manually resize the root partition using tools such as GParted or rootfs.

I'm probably naive to think that it could be a straightforward implementation, but one may dream.

2 Likes

It should be, problem is it'll increase the amount of storage required for generating and storing those images.

1 Like

You are right, it might require more storage for generating and storing those images. I am curious how much more storage this will add? Are the x86 builds that popular? This would also only apply to people who would want to use the option too I imagine?

1 Like

Sure, but not only for x86, but all platforms with removable boot media, like the Raspberries and Banan Pis, to name a few...

Well if it isn't viable, I can understand. Just thought I'd throw my idea into the hat.

It's a good idea, imho.

Another option is to implement a self extend of the root fs during 1st boot, at least for the ext4 platform, where's it's easier to do, and doesn't require much from the image building servers.

1 Like

You can auto expand the root partition and filesystem like this:
https://openwrt.org/docs/guide-user/advanced/expand_root

3 Likes

Just to be clear, if I followed the automated route, I would only need to run the following on ssh command line interface on first bootup?:
uclient-fetch -O expand-root.sh "https://openwrt.org/_export/code/docs/guide-user/advanced/expand_root?codeblock=0" . ./expand-root.sh
I am presupposing that uclient-fetch is already included in the standard x86 build.

That command only creates autostart scripts to avoid possible errors and typos.
You also need to preinstall the packages and run the script as mentioned in the examples section.

3 Likes

That is not entirely true. The extra space is zeroed out and compressed, so the final image is not that bigger. It does require more space to generate images and might slowdown the build due to having to zero out extra space, but it might not be noticeable.

3 Likes

Yeah, it's only an issue during creation.

I don't know how the image generations process works, so it's all guessing.

I would love to have this feature in the online builder. I am struggling to compile one on my own machine due to weird errors and I'm a newbie so having the ability to specify a root partition size would be fantastic.

1 Like

Tried the "offline" image builder ?

Since you already have Linux running, it should be fairly easy to set up.

Already tried

Running:

make V=s image \
CONFIG_TARGET_ROOTFS_PARTSIZE=512 \
PACKAGES="base-files busybox ca-bundle cgi-io dnsmasq dropbear e2fsprogs firewall4 fstools fwtool getrandom grub2 grub2-bios-setup grub2-efi jansson4 jshn jsonfilter kernel kmod-button-hotplug kmod-crypto-crc32c kmod-crypto-hash kmod-fs-vfat kmod-input-core kmod-lib-crc-ccitt kmod-lib-crc32c kmod-nf-conntrack kmod-nf-conntrack6 kmod-nf-flow kmod-nf-log kmod-nf-log6 kmod-nf-nat kmod-nf-reject kmod-nf-reject6 kmod-nfnetlink kmod-nft-core kmod-nft-fib kmod-nft-nat kmod-nft-offload kmod-nls-base kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8 kmod-ppp kmod-pppoe kmod-pppox kmod-slhc libblkid1 libc libcomerr0 libext2fs2 libf2fs6 libgcc1 libiwinfo-data libiwinfo-lua libiwinfo20210430 libjson-c5 libjson-script liblua5.1.5 liblucihttp-lua liblucihttp0 libmnl0 libnftnl11 libnl-tiny1 libpthread librt libsmartcols1 libss2 libubox20220515 libubus-lua libuuid1 logd lua luci luci-app-firewall luci-app-opkg luci-base luci-lib-base luci-lib-ip luci-lib-jsonc luci-lib-nixio luci-mod-admin-full luci-mod-network luci-mod-status luci-mod-system luci-proto-ipv6 luci-proto-ppp luci-ssl luci-theme-bootstrap mkf2fs mtd netifd nftables-json odhcp6c odhcpd-ipv6only openwrt-keyring opkg partx-utils ppp ppp-mod-pppoe procd procd-seccomp procd-ujail px5g-wolfssl rpcd rpcd-mod-file rpcd-mod-iwinfo rpcd-mod-luci rpcd-mod-rrdns ubox ubus ubusd uci uclient-fetch ucode ucode-mod-fs ucode-mod-ubus ucode-mod-uci uhttpd uhttpd-mod-ubus urandom-seed urngd usign attr avahi-dbus-daemon bc blkid block-mount bnx2-firmware bnx2x-firmware btrfs-progs ca-certificates cfdisk cgroupfs-mount containerd coremark coreutils coreutils-nohup curl dbus ddns-scripts docker dockerd etherwake ethtool fdisk gdisk 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 kmod-8139cp kmod-8139too kmod-alx kmod-asn1-decoder kmod-ath kmod-ath10k kmod-bnx2 kmod-bnx2x kmod-bonding kmod-br-netfilter 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-ctr kmod-crypto-deflate kmod-crypto-des kmod-crypto-ecb kmod-crypto-echainiv kmod-crypto-gcm kmod-crypto-gf128 kmod-crypto-ghash 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-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-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-crc16 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-netlink kmod-nf-ipt kmod-nf-ipt6 kmod-nf-ipvs kmod-nf-nathelper kmod-nf-nathelper-extra kmod-nf-tproxy  kmod-oid-registry kmod-pcnet32 kmod-pps kmod-ptp kmod-random-core kmod-scsi-core kmod-sdhci 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 libblobmsg-json libbpf20220308 libcap libcurl4 libdaemon libdbus libdevmapper libelf1 libevent2-core7 libexpat libfdisk1 libgmp10 libgnutls libip4tc2 libip6tc2 libipset13 libkmod liblzo2 libminiupnpc libmount1 libnatpmp1 libncurses6 libnettle8 libnetwork libopenssl-conf libopenssl1.1 libparted libpcap1 libpci libpcre libpopt0 libreadline8 libseccomp libsensors5 libstdcpp6 libsysfs2 libtasn1 libtirpc libuci-lua libwebsockets-full libusb-1.0-0 libuv1 libwebsockets-full lm-sensors lsblk luci-app-ddns luci-app-nlbwmon luci-app-openvpn luci-app-samba4 luci-app-ttyd luci-app-upnp luci-app-wol luci-proto-bonding luci-proto-wireguard mount-utils ncdu nlbwmon openssl-util parted pciids pciutils procps-ng procps-ng-watch proto-bonding resize2fs  runc samba4-libs samba4-server 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  usbids usbutils 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 luci-proto-relay relayd luci-app-attendedsysupgrade stdiscosrv luci-app-banip"

Returns the error I posted in the link above.

Hi all
I just came across Overriding CONFIG_TARGET_ROOTFS_PARTSIZE in Image Builder
and it seems like this is some sort of bug. I edited the .config file and specified 512 for the rootfs partition and built the image and it actually generated one.

Looks like this is a bug. Is this the right place to report this?

Try ROOTFS_PARTSIZE=512 instead

1 Like

What if the install process were made to be just like regular OS's?
If there were an .ISO that could be made into a bootable USB. The PC or PI etc could be then booted into an interactive installer what would give the ability to select partitioning and other options at time of setup. ( just like you do when installing Windows or Ubuntu, etc. )
It could also include integrated support for commonly needed packages and dependencies for USB network adapters which are usually going to be required for the second NIC on laptop or Pi installs.
( i.e. the kmod / usb-net ipks and dependecies, realtek firmware, etc. )

OpenWrt does boot from a USB stick as-is.

Writing an installer (and all the orchestration around that, like the ISO stuff) would be an x86_64-only development (and quite a lot of that), while the main focus of OpenWrt is very much elsewhere. Chances for this to happen are low, very low.

Thanks for the reply. That makes sense. Initially, I was just wondering if there might be existing open-source code out there for installers and ISO utilities that could perhaps be modified without having to start from scratch. I see the point though that it's really beyond the scope of OpenWRT.