Build image for devices with only 4MB flash

Issue: My device has only 4MB flash and I need to build a space optimized image.

Solution: Build your image with the imagebuilder as shown below.
See also → Which packages can i safely remove to save space?
See also → Saving firmware space
See also → Build image for devices with only 16/32MB RAM
See also → OpenWrt on 4/32 devices

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: