User Tools

Site Tools


docs:guide-user:additional-software:saving-space

Saving firmware space

Excluding packages

Flash space is scarce on devices with only 4MB flash. You can save some space while compiling your own image (e.g. with the imagebuilder) by removing packages that are not needed for your usecase. In order to completely remove IPv6 support and related packages you also need to ask the imagebuilder to do so by also passing this option to the make command: “CONFIG_IPV6=n”.

Action Packages
remove pppoe -ppp -ppp-mod-pppoe
remove IPv6 -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables
remove dhcp server -odhcpd
remove iptables -iptables
remove opkg -opkg
add LuCI minimal uhttpd uhttpd-mod-ubus libiwinfo-lua luci-base luci-app-firewall luci-mod-admin-full luci-theme-bootstrap
add zram zram-swap

Build image for devices with only 4MB flash

Example image builder command line
Note: In the command line shown below, you need to adjust PROFILE=tl-wr941nd-v6 to your device.

LuCI Action Imagebuilder commandline
with LuCI - remove pppoe and IPv6
+ include only needed luci components, not full luci package.
make image PROFILE=tl-wr941nd-v6 PACKAGES=“uhttpd uhttpd-mod-ubus libiwinfo-lua luci-base luci-app-firewall luci-mod-admin-full luci-theme-bootstrap -ppp -ppp-mod-pppoe -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables”
without LuCI - remove pppoe and IPv6 make image PROFILE=tl-wr941nd-v6 PACKAGES=“-ppp -ppp-mod-pppoe -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables”

Resources:

Build image for devices with only 16/32MB RAM

If the device has 16MB or less of RAM, then it should only be used as Internal AP (e.g. to extend Wi-Fi coverage).

Example image builder command line
Note: In the command line shown below, you need to adjust PROFILE=tl-wr941nd-v6 to your device.

RAM Action Imagebuilder commandline
16MB - remove pppoe and IPv6
- remove all related elements to iptables
- remove dhcp servers
+ add LUCI
+ add zram-swap
- remove opkg - not needed after making these adjustments
make image PROFILE=tl-wr941nd-v6 PACKAGES=“uhttpd uhttpd-mod-ubus libiwinfo-lua luci-base luci-app-firewall luci-mod-admin-full luci-theme-bootstrap zram-swap -ppp -ppp-mod-pppoe -iptables -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables -odhcpd -opkg”
32MB - remove pppoe and IPv6
+ add LUCI
+ add zram-swap
- remove opkg - not needed after making these adjustments
make image PROFILE=tl-wr941nd-v6 PACKAGES=“uhttpd uhttpd-mod-ubus libiwinfo-lua luci-base luci-app-firewall luci-mod-admin-full luci-theme-bootstrap zram-swap -ppp -ppp-mod-pppoe -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables -opkg”

Resources:

Modifying build configuration variables

You can also save space by changing configuration variables using make menuconfig. In addition to the ones mentioned here you can save a tiny bit of space by disabling commands in busybox.

Options that can be disabled to save space.

Config variable Menu path
CONFIG_KERNEL_CRASHLOG Global build settings / Kernel build options / Crash logging
CONFIG_KERNEL_SWAP Global build settings / Kernel build options / Support for paging of anonymous memory (swap)
CONFIG_KERNEL_KALLSYMS Global build settings / Kernel build options / Compile the kernel with symbol table information
CONFIG_KERNEL_DEBUG_INFO Global build settings / Kernel build options / Compile the kernel with debug information
CONFIG_KERNEL_ELF_CORE Global build settings / Kernel build options / Enable process core dump support
KERNEL_MAGIC_SYSRQ Global build settings / Kernel build options / Compile the kernel with SysRq support
PACKAGE_MAC80211_DEBUGFS Kernel modules / Wireless Drivers / kmod-mac80211 / Export mac80211 internals in DebugFS
PACKAGE_MAC80211_MESH Kernel modules / Wireless Drivers / kmod-mac80211 / Enable 802.11s mesh support

Options that can be enabled to save space.

Config variable Menu path
CONFIG_STRIP_KERNEL_EXPORTS Global build settings / Strip unnecessary exports from the kernel image
CONFIG_USE_MKLIBS Global build settings / Strip unnecessary functions from libraries

Increase block size from the default 256 KB to improve compression. Warning: By default 3 blocks will be cached so this will also make the router use more RAM.

Config variable Menu path
TARGET_SQUASHFS_BLOCK_SIZE Target Images / squashfs / Block size

Options that can be enabled to save RAM.

Config variable Menu path
PACKAGE_zram-swap Base system
PROCD_ZRAM_TMPFS Base system / procd Configuration

Reduce the number of cached blocks by running make kernel_menuconfig.

Config variable Menu path
CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE File systems / Miscellaneous filesystems / Additional option for memory-constrained systems / Number of fragments cached
docs/guide-user/additional-software/saving-space.txt · Last modified: 2018/09/08 19:52 by per