LEDE Built Image Too Big

Good Evening Folks:
I'm new to LEDE and I'm actually struggling to make it work on my friend's WNR2000V4.. I wanna build a bin file with the least packages possible, with just dropbear, busybox etc. (NO LuCi) so that I can have as much free memory as possible. I'm using the latest AR71XX Image Builder tool in Kali Linux but when I specify what packages not to include (with the PACKAGES="-pkg, -pkg,..." option in the make image) the tool actually doesn't consider my specifications and creates a very big image that doesn't fit into the flash and it even includes the unwanted packages. This always results in a "lede-17.01.4-ar71xx-generic-wnr2000v4-squashfs-sysupgrade.bin is too big (> 3866624 bytes)" Warning!
Is there a way in the Image Builder to create a VERY minimal image without all the unnecessary programs?

Thanks in Advance and wish U the best

You might have better luck building from source and removing things like IPv6 and PPP.

I don't think there should be a comma. You may want to post your complete PACKAGES variable, it may have something which depends on a large package resulting in a big image.

Thanks for your reply...this is my terminal input:

make image PROFILE=WNR2000V4 PACKAGES="-libubox libuclient uclient-fetch -libpthread opkg kmod-nls-base -kmod-usb-core -libubus -libjson-c -libblobmsg-json ubusd ubus libnl-tiny iw busybox libuci swconfig -jshn netifd -libjson-script -ubox procd -jsonfilter -usign -lede-keyring -fstools fwtool base-files uboot-envtools -kmod-usb2 kmod-cfg80211 hostapd-common kmod-mac80211 kmod-ath kmod-ath9k-common kmod-ath9k -uci wpad-mini dropbear -mtd kmod-gpio-button-hotplug -logd -kmod-usb-ledtrig-usbport kmod-leds-gpio kmod-ledtrig-default-on kmod-ledtrig-netdev kmod-ledtrig-timer"

Which gives me this output:

make[1]: Entering directory '/root/Downloads/lede-imagebuilder'
echo 'Building images for ar71xx - NETGEAR WNR2000V4'
Building images for ar71xx - NETGEAR WNR2000V4
echo 'Packages: libuclient uclient-fetch opkg kmod-nls-base ubusd ubus libnl-tiny iw busybox libuci swconfig netifd procd fwtool base-files uboot-envtools kmod-cfg80211 hostapd-common kmod-mac80211 kmod-ath kmod-ath9k-common kmod-ath9k wpad-mini dropbear kmod-gpio-button-hotplug kmod-leds-gpio kmod-ledtrig-default-on kmod-ledtrig-netdev kmod-ledtrig-timer base-files busybox dnsmasq dropbear firewall ip6tables iptables kernel kmod-ath9k kmod-gpio-button-hotplug libc libgcc netifd odhcp6c odhcpd opkg ppp ppp-mod-pppoe swconfig uboot-envtools uclient-fetch wpad-mini'
Packages: libuclient uclient-fetch opkg kmod-nls-base ubusd ubus libnl-tiny iw busybox libuci swconfig netifd procd fwtool base-files uboot-envtools kmod-cfg80211 hostapd-common kmod-mac80211 kmod-ath kmod-ath9k-common kmod-ath9k wpad-mini dropbear kmod-gpio-button-hotplug kmod-leds-gpio kmod-ledtrig-default-on kmod-ledtrig-netdev kmod-ledtrig-timer base-files busybox dnsmasq dropbear firewall ip6tables iptables kernel kmod-ath9k kmod-gpio-button-hotplug libc libgcc netifd odhcp6c odhcpd opkg ppp ppp-mod-pppoe swconfig uboot-envtools uclient-fetch wpad-mini
echo

rm -rf /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx
mkdir -p /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic /root/Downloads/lede-imagebuilder/tmp /root/Downloads/lede-imagebuilder/dl
if [ ! -f "/root/Downloads/lede-imagebuilder/packages/Packages" ] || [ ! -f "/root/Downloads/lede-imagebuilder/packages/Packages.gz" ] || [ "`find /root/Downloads/lede-imagebuilder/packages -cnewer /root/Downloads/lede-imagebuilder/packages/Packages.gz`" ]; then \
	echo "Package list missing or not up-to-date, generating it.";\
	make package_index; \
else \
	mkdir -p /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx/tmp; \
	IPKG_NO_SCRIPT=1 IPKG_INSTROOT="/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx" /root/Downloads/lede-imagebuilder/staging_dir/host/bin/opkg -f /root/Downloads/lede-imagebuilder/repositories.conf --force-depends --force-overwrite --force-postinstall --cache /root/Downloads/lede-imagebuilder/dl --lists-dir ../../../../../../root/Downloads/lede-imagebuilder/dl --offline-root /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx --add-dest root:/ --add-arch all:100 --add-arch mips_24kc:200 update || true; \
fi
Downloading (.../Packages.gz)
Updated list of available packages in /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx/../../../../../../root/Downloads/lede-imagebuilder/dl/reboot_core
Downloading (.../Packages.gz)
Updated list of available packages in /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx/../../../../../../root/Downloads/lede-imagebuilder/dl/reboot_base
Downloading (.../Packages.gz)
Updated list of available packages in /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx/../../../../../../root/Downloads/lede-imagebuilder/dl/reboot_luci
Downloading (.../Packages.gz)
Updated list of available packages in /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx/../../../../../../root/Downloads/lede-imagebuilder/dl/reboot_packages
Downloading (.../Packages.gz)
Updated list of available packages in /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx/../../../../../../root/Downloads/lede-imagebuilder/dl/reboot_routing
Downloading (..../Packages.gz)
Updated list of available packages in /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx/../../../../../../root/Downloads/lede-imagebuilder/dl/reboot_telephony
Downloading file:packages/Packages
Updated list of available packages in /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx/../../../../../../root/Downloads/lede-imagebuilder/dl/imagebuilder
make package_install
make[2]: Entering directory '/root/Downloads/lede-imagebuilder'

Installing packages...
IPKG_NO_SCRIPT=1 IPKG_INSTROOT="/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx" /root/Downloads/lede-imagebuilder/staging_dir/host/bin/opkg -f /root/Downloads/lede-imagebuilder/repositories.conf --force-depends --force-overwrite --force-postinstall --cache /root/Downloads/lede-imagebuilder/dl --lists-dir ../../../../../../root/Downloads/lede-imagebuilder/dl --offline-root /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx --add-dest root:/ --add-arch all:100 --add-arch mips_24kc:200 install /root/Downloads/lede-imagebuilder/packages/libc_1.1.16-1_mips_24kc.ipk
Installing libc (1.1.16-1) to root...
Installing libgcc (5.4.0-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libgcc_5.4.0-1_mips_24kc.ipk.
Configuring libgcc.
Configuring libc.
IPKG_NO_SCRIPT=1 IPKG_INSTROOT="/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx" /root/Downloads/lede-imagebuilder/staging_dir/host/bin/opkg -f /root/Downloads/lede-imagebuilder/repositories.conf --force-depends --force-overwrite --force-postinstall --cache /root/Downloads/lede-imagebuilder/dl --lists-dir ../../../../../../root/Downloads/lede-imagebuilder/dl --offline-root /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx --add-dest root:/ --add-arch all:100 --add-arch mips_24kc:200 install /root/Downloads/lede-imagebuilder/packages/kernel_4.4.92-1-45d282495a15974d60f8edb091d0e2a9_mips_24kc.ipk
Installing kernel (4.4.92-1-45d282495a15974d60f8edb091d0e2a9) to root...
Configuring kernel.
IPKG_NO_SCRIPT=1 IPKG_INSTROOT="/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx" /root/Downloads/lede-imagebuilder/staging_dir/host/bin/opkg -f /root/Downloads/lede-imagebuilder/repositories.conf --force-depends --force-overwrite --force-postinstall --cache /root/Downloads/lede-imagebuilder/dl --lists-dir ../../../../../../root/Downloads/lede-imagebuilder/dl --offline-root /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx --add-dest root:/ --add-arch all:100 --add-arch mips_24kc:200 install libuclient uclient-fetch opkg kmod-nls-base ubusd ubus libnl-tiny iw busybox libuci swconfig netifd procd fwtool base-files uboot-envtools kmod-cfg80211 hostapd-common kmod-mac80211 kmod-ath kmod-ath9k-common kmod-ath9k wpad-mini dropbear kmod-gpio-button-hotplug kmod-leds-gpio kmod-ledtrig-default-on kmod-ledtrig-netdev kmod-ledtrig-timer base-files busybox dnsmasq dropbear firewall ip6tables iptables kernel kmod-ath9k kmod-gpio-button-hotplug libc libgcc netifd odhcp6c odhcpd opkg ppp ppp-mod-pppoe swconfig uboot-envtools uclient-fetch wpad-mini
Installing libuclient (2017-11-02-4b87d831-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libuclient_2017-11-02-4b87d831-1_mips_24kc.ipk.
Installing libubox (2018-01-07-1dafcd78-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libubox_2018-01-07-1dafcd78-1_mips_24kc.ipk.
Installing uclient-fetch (2017-11-02-4b87d831-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/uclient-fetch_2017-11-02-4b87d831-1_mips_24kc.ipk.
Installing opkg (2017-03-23-1d0263bb-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/opkg_2017-03-23-1d0263bb-1_mips_24kc.ipk.
Installing libpthread (1.1.16-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libpthread_1.1.16-1_mips_24kc.ipk.
Installing kmod-nls-base (4.4.92-1) to root...
Downloading file:packages/kmod-nls-base_4.4.92-1_mips_24kc.ipk
Installing ubusd (2017-02-18-34c6e818-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/ubusd_2017-02-18-34c6e818-1_mips_24kc.ipk.
Installing libjson-c (0.12.1-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libjson-c_0.12.1-1_mips_24kc.ipk.
Installing libblobmsg-json (2018-01-07-1dafcd78-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libblobmsg-json_2018-01-07-1dafcd78-1_mips_24kc.ipk.
Installing ubus (2017-02-18-34c6e818-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/ubus_2017-02-18-34c6e818-1_mips_24kc.ipk.
Installing libubus (2017-02-18-34c6e818-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libubus_2017-02-18-34c6e818-1_mips_24kc.ipk.
Installing libnl-tiny (0.1-5) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libnl-tiny_0.1-5_mips_24kc.ipk.
Installing iw (4.9-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/iw_4.9-1_mips_24kc.ipk.
Installing busybox (1.25.1-4) to root...
Copying /root/Downloads/lede-imagebuilder/dl/busybox_1.25.1-4_mips_24kc.ipk.
Installing libuci (2018-01-01-141b64ef-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libuci_2018-01-01-141b64ef-1_mips_24kc.ipk.
Installing swconfig (11) to root...
Copying /root/Downloads/lede-imagebuilder/dl/swconfig_11_mips_24kc.ipk.
Installing netifd (2017-01-25-650758b1-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/netifd_2017-01-25-650758b1-1_mips_24kc.ipk.
Installing jshn (2018-01-07-1dafcd78-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/jshn_2018-01-07-1dafcd78-1_mips_24kc.ipk.
Installing procd (2017-08-08-66be6a23-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/procd_2017-08-08-66be6a23-1_mips_24kc.ipk.
Installing libjson-script (2018-01-07-1dafcd78-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libjson-script_2018-01-07-1dafcd78-1_mips_24kc.ipk.
Installing ubox (2017-03-10-16f7e161-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/ubox_2017-03-10-16f7e161-1_mips_24kc.ipk.
Installing fwtool (1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/fwtool_1_mips_24kc.ipk.
Installing base-files (173.1-r3560-79f57e422d) to root...
Copying /root/Downloads/lede-imagebuilder/dl/base-files_173.1-r3560-79f57e422d_mips_24kc.ipk.
Installing jsonfilter (2016-07-02-dea067ad-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/jsonfilter_2016-07-02-dea067ad-1_mips_24kc.ipk.
Installing usign (2015-07-04-ef641914-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/usign_2015-07-04-ef641914-1_mips_24kc.ipk.
Installing lede-keyring (2017-01-20-a50b7529-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/lede-keyring_2017-01-20-a50b7529-1_mips_24kc.ipk.
Installing fstools (2017-06-30-bdcb075f-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/fstools_2017-06-30-bdcb075f-1_mips_24kc.ipk.
Installing uboot-envtools (2015.10-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/uboot-envtools_2015.10-1_mips_24kc.ipk.
Installing kmod-cfg80211 (4.4.92+2017-01-31-3) to root...
Downloading file:packages/kmod-cfg80211_4.4.92+2017-01-31-3_mips_24kc.ipk
Installing hostapd-common (2016-12-19-ad02e79d-7) to root...
Copying /root/Downloads/lede-imagebuilder/dl/hostapd-common_2016-12-19-ad02e79d-7_mips_24kc.ipk.
Installing kmod-mac80211 (4.4.92+2017-01-31-3) to root...
Downloading file:packages/kmod-mac80211_4.4.92+2017-01-31-3_mips_24kc.ipk
Installing kmod-ath (4.4.92+2017-01-31-3) to root...
Downloading file:packages/kmod-ath_4.4.92+2017-01-31-3_mips_24kc.ipk
Installing kmod-ath9k-common (4.4.92+2017-01-31-3) to root...
Downloading file:packages/kmod-ath9k-common_4.4.92+2017-01-31-3_mips_24kc.ipk
Installing kmod-ath9k (4.4.92+2017-01-31-3) to root...
Downloading file:packages/kmod-ath9k_4.4.92+2017-01-31-3_mips_24kc.ipk
Installing wpad-mini (2016-12-19-ad02e79d-7) to root...
Copying /root/Downloads/lede-imagebuilder/dl/wpad-mini_2016-12-19-ad02e79d-7_mips_24kc.ipk.
Installing dropbear (2017.75-4) to root...
Copying /root/Downloads/lede-imagebuilder/dl/dropbear_2017.75-4_mips_24kc.ipk.
Installing kmod-gpio-button-hotplug (4.4.92-2) to root...
Downloading file:packages/kmod-gpio-button-hotplug_4.4.92-2_mips_24kc.ipk
Installing kmod-leds-gpio (4.4.92-1) to root...
Downloading file:packages/kmod-leds-gpio_4.4.92-1_mips_24kc.ipk
Installing kmod-ledtrig-default-on (4.4.92-1) to root...
Downloading file:packages/kmod-ledtrig-default-on_4.4.92-1_mips_24kc.ipk
Installing kmod-ledtrig-netdev (4.4.92-1) to root...
Downloading file:packages/kmod-ledtrig-netdev_4.4.92-1_mips_24kc.ipk
Installing kmod-ledtrig-timer (4.4.92-1) to root...
Downloading file:packages/kmod-ledtrig-timer_4.4.92-1_mips_24kc.ipk
Package base-files (173.1-r3560-79f57e422d) installed in root is up to date.
Package busybox (1.25.1-4) installed in root is up to date.
Installing dnsmasq (2.78-4) to root...
Copying /root/Downloads/lede-imagebuilder/dl/dnsmasq_2.78-4_mips_24kc.ipk.
Package dropbear (2017.75-4) installed in root is up to date.
Installing firewall (2017-05-27-a4d98aea-1) to root...
Copying /root/Downloads/lede-imagebuilder/dl/firewall_2017-05-27-a4d98aea-1_mips_24kc.ipk.
Installing libxtables (1.4.21-2) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libxtables_1.4.21-2_mips_24kc.ipk.
Installing libip4tc (1.4.21-2) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libip4tc_1.4.21-2_mips_24kc.ipk.
Installing libip6tc (1.4.21-2) to root...
Copying /root/Downloads/lede-imagebuilder/dl/libip6tc_1.4.21-2_mips_24kc.ipk.
Installing kmod-nf-ipt (4.4.92-1) to root...
Downloading file:packages/kmod-nf-ipt_4.4.92-1_mips_24kc.ipk
Installing kmod-ipt-core (4.4.92-1) to root...
Downloading file:packages/kmod-ipt-core_4.4.92-1_mips_24kc.ipk
Installing kmod-nf-conntrack (4.4.92-1) to root...
Downloading file:packages/kmod-nf-conntrack_4.4.92-1_mips_24kc.ipk
Installing kmod-ipt-conntrack (4.4.92-1) to root...
Downloading file:packages/kmod-ipt-conntrack_4.4.92-1_mips_24kc.ipk
Installing kmod-nf-nat (4.4.92-1) to root...
Downloading file:packages/kmod-nf-nat_4.4.92-1_mips_24kc.ipk
Installing kmod-ipt-nat (4.4.92-1) to root...
Downloading file:packages/kmod-ipt-nat_4.4.92-1_mips_24kc.ipk
Installing ip6tables (1.4.21-2) to root...
Copying /root/Downloads/lede-imagebuilder/dl/ip6tables_1.4.21-2_mips_24kc.ipk.
Installing kmod-nf-conntrack6 (4.4.92-1) to root...
Downloading file:packages/kmod-nf-conntrack6_4.4.92-1_mips_24kc.ipk
Installing kmod-nf-ipt6 (4.4.92-1) to root...
Downloading file:packages/kmod-nf-ipt6_4.4.92-1_mips_24kc.ipk
Installing kmod-ip6tables (4.4.92-1) to root...
Downloading file:packages/kmod-ip6tables_4.4.92-1_mips_24kc.ipk
Installing iptables (1.4.21-2) to root...
Copying /root/Downloads/lede-imagebuilder/dl/iptables_1.4.21-2_mips_24kc.ipk.
Package iptables (1.4.21-2) installed in root is up to date.
Package kernel (4.4.92-1-45d282495a15974d60f8edb091d0e2a9) installed in root is up to date.
Package kmod-ath9k (4.4.92+2017-01-31-3) installed in root is up to date.
Package kmod-gpio-button-hotplug (4.4.92-2) installed in root is up to date.
Package libc (1.1.16-1) installed in root is up to date.
Package libgcc (5.4.0-1) installed in root is up to date.
Package netifd (2017-01-25-650758b1-1) installed in root is up to date.
Installing odhcp6c (2017-01-30-c13b6a05-2) to root...
Copying /root/Downloads/lede-imagebuilder/dl/odhcp6c_2017-01-30-c13b6a05-2_mips_24kc.ipk.
Installing odhcpd (2017-10-02-c6f3d5d4-2) to root...
Copying /root/Downloads/lede-imagebuilder/dl/odhcpd_2017-10-02-c6f3d5d4-2_mips_24kc.ipk.
Package opkg (2017-03-23-1d0263bb-1) installed in root is up to date.
Installing ppp (2.4.7-12) to root...
Copying /root/Downloads/lede-imagebuilder/dl/ppp_2.4.7-12_mips_24kc.ipk.
Installing kmod-lib-crc-ccitt (4.4.92-1) to root...
Downloading file:packages/kmod-lib-crc-ccitt_4.4.92-1_mips_24kc.ipk
Installing kmod-slhc (4.4.92-1) to root...
Downloading file:packages/kmod-slhc_4.4.92-1_mips_24kc.ipk
Installing kmod-ppp (4.4.92-1) to root...
Downloading file:packages/kmod-ppp_4.4.92-1_mips_24kc.ipk
Installing ppp-mod-pppoe (2.4.7-12) to root...
Copying /root/Downloads/lede-imagebuilder/dl/ppp-mod-pppoe_2.4.7-12_mips_24kc.ipk.
Installing kmod-pppox (4.4.92-1) to root...
Downloading file:packages/kmod-pppox_4.4.92-1_mips_24kc.ipk
Installing kmod-pppoe (4.4.92-1) to root...
Downloading file:packages/kmod-pppoe_4.4.92-1_mips_24kc.ipk
Package swconfig (11) installed in root is up to date.
Package uboot-envtools (2015.10-1) installed in root is up to date.
Package uclient-fetch (2017-11-02-4b87d831-1) installed in root is up to date.
Package wpad-mini (2016-12-19-ad02e79d-7) installed in root is up to date.
Configuring libubox.
Configuring libuclient.
Configuring uclient-fetch.
Configuring libpthread.
Configuring opkg.
Configuring libubus.
Configuring libjson-c.
Configuring libblobmsg-json.
Configuring ubusd.
Configuring ubus.
Configuring libnl-tiny.
Configuring iw.
Configuring busybox.
Configuring libuci.
Configuring odhcpd.
Configuring swconfig.
Configuring kmod-lib-crc-ccitt.
Configuring kmod-slhc.
Configuring kmod-ppp.
Configuring kmod-pppox.
Configuring kmod-pppoe.
Configuring kmod-nf-ipt.
Configuring kmod-ipt-core.
Configuring kmod-nf-conntrack.
Configuring kmod-ipt-conntrack.
Configuring jshn.
Configuring netifd.
Configuring libjson-script.
Configuring ubox.
Configuring procd.
Configuring jsonfilter.
Configuring usign.
Configuring lede-keyring.
Configuring fstools.
Configuring fwtool.
Configuring base-files.
Configuring kmod-nf-nat.
Configuring uboot-envtools.
Configuring dnsmasq.
Configuring libxtables.
Configuring libip4tc.
Configuring libip6tc.
Configuring kmod-ipt-nat.
Configuring firewall.
Configuring kmod-nf-conntrack6.
Configuring kmod-nf-ipt6.
Configuring kmod-ip6tables.
Configuring odhcp6c.
Configuring kmod-cfg80211.
Configuring hostapd-common.
Configuring kmod-mac80211.
Configuring kmod-ath.
Configuring kmod-ath9k-common.
Configuring kmod-ath9k.
Configuring wpad-mini.
Configuring dropbear.
Configuring kmod-ledtrig-timer.
Configuring ppp.
Configuring kmod-leds-gpio.
Configuring kmod-gpio-button-hotplug.
Configuring iptables.
Configuring kmod-ledtrig-default-on.
Configuring ip6tables.
Configuring kmod-nls-base.
Configuring ppp-mod-pppoe.
Configuring kmod-ledtrig-netdev.
rm -f /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx/usr/lib/opkg/lists/*
make[2]: Leaving directory '/root/Downloads/lede-imagebuilder'
make package_postinst
make[2]: Entering directory '/root/Downloads/lede-imagebuilder'

Cleaning up

Activating init scripts
rm -f /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx/usr/lib/opkg/info/*.postinst
make[2]: Leaving directory '/root/Downloads/lede-imagebuilder'
make build_image
make[2]: Entering directory '/root/Downloads/lede-imagebuilder'

Building images...
make V=ss -C target/linux/ar71xx/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="" \
	PROFILE="DEVICE_WNR2000V4"
make[3]: Entering directory '/root/Downloads/lede-imagebuilder/target/linux/ar71xx/image'
mkdir -p /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp
cp /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/vmlinux.elf /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-vmlinux.elf
cp /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/vmlinux /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-vmlinux.bin
dd if=/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/vmlinux.bin.lzma of=/root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-vmlinux.lzma bs=65536 conv=sync
mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma  -e 0x80060000 -n 'MIPS OpenWrt Linux-4.4.92' -d /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/vmlinux.bin.lzma /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-uImage-lzma.bin
Image Name:   MIPS OpenWrt Linux-4.4.92
Created:      Sat Jan 13 09:21:55 2018
Image Type:   MIPS Linux Kernel Image (lzma compressed)
Data Size:    1257834 Bytes = 1228.35 kB = 1.20 MB
Load Address: 80060000
Entry Point:  80060000
cp /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/loader-generic.elf /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-vmlinux-lzma.elf
mkdir -p /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp
/root/Downloads/lede-imagebuilder/staging_dir/host/bin/mksquashfs4 /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs -nopad -noappend -root-owned -comp xz -Xpreset 9 -Xe -Xlc 0 -Xlp 2 -Xpb 2  -b 256k -p '/dev d 755 0 0' -p '/dev/console c 600 0 0 5 1' -processors 1 
Parallel mksquashfs: Using 1 processor
Creating 4.0 filesystem on /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs, block size 262144.

[|                                                               ]   0/525   0%
[============|                                                   ] 100/525  19%
[========================\                                       ] 200/525  38%
[===============================================================|] 525/525 100%
Exportable Squashfs 4.0 filesystem, xz compressed, data block size 262144
	compressed data, compressed metadata, compressed fragments, no xattrs
	duplicates are removed
Filesystem size 1806.74 Kbytes (1.76 Mbytes)
	35.47% of uncompressed filesystem size (5094.42 Kbytes)
Inode table size 5660 bytes (5.53 Kbytes)
	22.25% of uncompressed inode table size (25438 bytes)
Directory table size 7492 bytes (7.32 Kbytes)
	47.74% of uncompressed directory table size (15692 bytes)
Number of duplicate files found 71
Number of inodes 761
Number of files 521
Number of fragments 12
Number of symbolic links  179
Number of device nodes 1
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 60
Number of ids (unique uids + gids) 1
Number of uids 1
	root (0)
Number of gids 1
	root (0)
cp /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs-raw
cp /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs-64k
/root/Downloads/lede-imagebuilder/staging_dir/host/bin/padjffs2 /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs-64k 64
/root/Downloads/lede-imagebuilder/staging_dir/host/bin/padjffs2 /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs 4 8 16 64 128 256
dd if=/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs of=/root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-root.squashfs bs=128k conv=sync
export MAKEFLAGS= ;make -w legacy-images
make[4]: Entering directory '/root/Downloads/lede-imagebuilder/target/linux/ar71xx/image'
cp /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/vmlinux /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4
/root/Downloads/lede-imagebuilder/staging_dir/host/bin/patch-cmdline /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4 "board=WNR2000V4 console=ttyS0,115200 mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,3776k(firmware),64k(art)ro"
search space used is default of 16KB
/root/Downloads/lede-imagebuilder/staging_dir/host/bin/lzma e /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4 -lc1 -lp2 -pb2 -d20 /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4.bin.lzma
mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -M 0x32303034 -e 0x80060000 -n 'MIPS OpenWrt Linux-4.4.92' -d /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4.bin.lzma /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4.uImage
Image Name:   MIPS OpenWrt Linux-4.4.92
Created:      Sat Jan 13 09:22:00 2018
Image Type:   MIPS Linux Kernel Image (lzma compressed)
Data Size:    1268568 Bytes = 1238.84 kB = 1.21 MB
Load Address: 80060000
Entry Point:  80060000
if [ 0 -eq 0 ]; then filename="/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs-raw"; fstype=${filename##*\.}; case "${fstype}" in *) bs=`stat -c%s /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4.uImage`;; esac; ( dd if=/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4.uImage bs=${bs} conv=sync;  cat /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs-raw ) > /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-wnr2000v4-squashfs-sysupgrade.bin; if [ -n "64" ]; then case "${fstype}" in squashfs*) padjffs2 /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-wnr2000v4-squashfs-sysupgrade.bin 64; ;; esac; fi; if [ `stat -c%s /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-wnr2000v4-squashfs-sysupgrade.bin` -gt 3866624 ]; then echo "Warning: /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-wnr2000v4-squashfs-sysupgrade.bin is too big (> 3866624 bytes)" >&2; rm -f /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-wnr2000v4-squashfs-sysupgrade.bin; fi; else if [ 0 -gt 262144 ]; then if [ `stat -c%s "/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4.uImage"` -gt 0 ]; then echo "Warning: /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4.uImage is too big (> 0 bytes)" >&2; else if [ `stat -c%s /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs-raw` -gt 3866624 ]; then echo "Warning: /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs-raw is too big (> 3866624 bytes)" >&2; else ( dd if=/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4.uImage bs=0 conv=sync; dd if=/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs-raw ) > /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-wnr2000v4-squashfs-sysupgrade.bin; fi; fi; else ( dd if=/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/tmp/vmlinux-wnr2000v4.uImage bs=0 conv=sync; dd if=/root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/root.squashfs-raw ) > /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-wnr2000v4-squashfs-sysupgrade.bin; if [ `stat -c%s /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-wnr2000v4-squashfs-sysupgrade.bin` -gt 3866624 ]; then echo "Warning: /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-wnr2000v4-squashfs-sysupgrade.bin is too big (> 3866624 bytes)" >&2; rm -f /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-wnr2000v4-squashfs-sysupgrade.bin; fi; fi; fi
make[4]: Leaving directory '/root/Downloads/lede-imagebuilder/target/linux/ar71xx/image'
/root/Downloads/lede-imagebuilder/staging_dir/host/bin/opkg --offline-root /root/Downloads/lede-imagebuilder/build_dir/target-mips_24kc_musl-1.1.16/root-ar71xx --add-arch all:100 --add-arch mips_24kc:200 list-installed > /root/Downloads/lede-imagebuilder/bin/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-device-wnr2000v4.manifest
make[3]: Leaving directory '/root/Downloads/lede-imagebuilder/target/linux/ar71xx/image'
make[2]: Leaving directory '/root/Downloads/lede-imagebuilder'
make checksum
make[2]: Entering directory '/root/Downloads/lede-imagebuilder'

Calculating checksums...
make[2]: Leaving directory '/root/Downloads/lede-imagebuilder'
make[1]: Leaving directory '/root/Downloads/lede-imagebuilder'

Now the question is: can I tell the image builder to put only the packages I tell it to include and exclude all the other useless packages (such as kmod-ubs2 that is completely nonsensical in a usb-port lacking router)?

Or, 'cause you are more expert than me, which packages would you include just to have a dropbear connection to the router, opkg for installing programs and an ethernet connection ? (I even don't want to include all the wifi ipks and maybe install them later on the overlay free space).

I apologize for asking too many questions but I'm getting mad with all this stuff :slight_smile:

Wish you a Good Day

You only need so specify the packages you want to strip (unless you'd also like to include packages that aren't included by default). I had a similar problem myself recently with my TL-WR841N v7 build. Apparently a lot of packages were being blocked by opkg (which checks the dependencies), so virtually none of the bigger packages were stripped. That was very frustrating.

At this point it might be better to fire up a buildroot and make sure all the packages you'd like to strip are built modularly (ie shown as [m] in the configuration tool). That will not include them in the final firmware unless they're a dependency for something you did build in (shown as [*]). It might also be worth it to strip your kernel and libraries from debugging symbols.

Do note that it makes no sense to install anything onto the overlay nor to keep opkg on a device with limited flash. Stuff on the overlay is not compressed, unlike stuff included into the firmware image. The most efficient use of space is when you include everything you need into the image and keep the overlay for settings and other stuff that is not static.

Your image with those settings would never run.
Both libubox, ubox and libubus are crucial core packages, and the firmware will not run properly without them. And you are trying to remove them :frowning:

Removing uci removes the capability to read any config files
Removing mtd removes the possibility of flashing the router again.

I did not bother reading further, as it seems that you are removing lots of packages without any understanding to their role. Good luck.

@dimakx It might be easier if you just tell us which packages you do need, and if you can do without PPP and IPv6. It sounds like you do want to include extra packages, but like I said installing them afterwards is a terrible idea on 4MB devices.

@Borromini I know it's a goddamn Bad Idea but I have to make it run on this 4MB device :frowning_face: .
I actually need the few basic things that make me access into the router for having as much free flash as I can!

@hnyman You're Right! I tried removing nearly everything without caring about the feasibility of doing so :sweat_smile:. Do you know a good sintax for installing only the base packages?

Thanks to all for helping me out :slight_smile:

Thanks, What I need is to keep some free memory for uploading and .ovpn file inside it. I'm fully aware that OpenVPN on this tiny device is a suicide, but I just wanna try it out for general practice :slight_smile:

You're not getting it. I'm not saying running a 4 MB device is a bad idea. I'm saying installing things after flashing is a horrible idea.

Look man - I'm offering you to put together a custom .config that you can use in the buildroot. Just for you! The least you can do is tell us which packages you do need and which you don't. List them. Be specific. Non mi rompere le palle.

I completely grasped what you where saying!

I need a configuration file with these packages for the wnr2000v4:
libubox
ubox
libubus
uci
mtd
dropbear
base-files
busybox
kernel
opkg
swconfig
libc
libgcc
uboot-envtools

I only need these packages, leaving apart the rest! (Do you think it is feasible?)

I'm sorry for "Romperti le Palle", if you can't write a .config file down don't worry, you have been very helpful :slight_smile:

Thank U!

Wish you a Good Afternoon and All the Best

I'm sure your intentions were fine, but your statements were vague :slightly_smiling_face:.

  • Can you do an opkg list-installed|grep openvpn to show which related packages you have/need?
  • Do you need IPv6?
  • Do you need PPP?

I'm sorry for being vague but this is my first time Building an Image by my own, will focus more on clarity next time :slight_smile:

-I actually don't have my Linux Machine there now so I can't make an "opkg list-installed|grep openvpn" command :frowning: will try tonight:
but as far as I understood here https://github.com/StreisandEffect/streisand/wiki/Setting-an-OpenWrt-Based-Router-as-OpenVPN-Client , the OpenVPN openvpn-openssl LEDE package depends on openvpn kmod-tun liblzo zlib libopenssl (~1M)... am I wrong?

-If it does fit in the rom why not?
-same reply as above :slight_smile:

Thank U

Thanks, I'll see how far that gets me. Does your friend use PPP?

I actually think he does! Is it linked with the WAN interface right?

ok, I read about ppp, I'm sure he does!

Thanks!

OK. I have tested the following config. OpenVPN is built with mbedTLS instead of OpenSSL as the crypto library (OpenSSL is way too big for a 4 MB flash). I've stripped a few extra things you shouldn't need as well (and USB is disabled, like you said it makes no sense on this device). I'll send in a patch to get this fixed.

Follow the buildroot installation instructions on your Linux system and insert the following as your .config. After that, follow these instructions. First time you'll need to build the toolchain, so that might take a while. In the end, you'll have your WNR2000v4 image in bin/targets/ar71xx/generic/.

CONFIG_TARGET_ar71xx=y
CONFIG_TARGET_ar71xx_generic=y
CONFIG_TARGET_ar71xx_generic_DEVICE_WNR2000V4=y
CONFIG_DEVEL=y
CONFIG_TOOLCHAINOPTS=y
# CONFIG_KERNEL_DEBUG_INFO is not set
# CONFIG_KERNEL_DEBUG_KERNEL is not set
# CONFIG_KERNEL_PRINTK is not set
CONFIG_OPENVPN_mbedtls_ENABLE_DEF_AUTH=y
CONFIG_OPENVPN_mbedtls_ENABLE_FRAGMENT=y
CONFIG_OPENVPN_mbedtls_ENABLE_HTTP=y
CONFIG_OPENVPN_mbedtls_ENABLE_LZ4=y
CONFIG_OPENVPN_mbedtls_ENABLE_LZO=y
CONFIG_OPENVPN_mbedtls_ENABLE_MULTIHOME=y
CONFIG_OPENVPN_mbedtls_ENABLE_PF=y
CONFIG_OPENVPN_mbedtls_ENABLE_PORT_SHARE=y
CONFIG_OPENVPN_mbedtls_ENABLE_SERVER=y
CONFIG_OPENVPN_mbedtls_ENABLE_SMALL=y
CONFIG_OPENVPN_mbedtls_ENABLE_SOCKS=y
# CONFIG_PACKAGE_kmod-nls-base is not set
CONFIG_PACKAGE_kmod-tun=y
# CONFIG_PACKAGE_kmod-usb-core is not set
# CONFIG_PACKAGE_kmod-usb-ledtrig-usbport is not set
# CONFIG_PACKAGE_kmod-usb2 is not set
CONFIG_PACKAGE_liblzo=y
CONFIG_PACKAGE_libmbedtls=y
CONFIG_PACKAGE_openvpn-mbedtls=y
# CONFIG_PACKAGE_opkg is not set
CONFIG_USE_MKLIBS=y
CONFIG_PACKAGE_libpthread=y

You might be able to disable libpthread as well, but since it builds fine for a 4 MB device, this should get you going. As you can see, this image does not include opkg anymore; it does not make sense to include it (you shouldn't use what's left of your overlay to install packages).

If you want any additional packages included, run make menuconfig to add them before compiling.

1 Like

I can't tell how grateful I am for your support! Thank you very Much! As soon as I return back at my Linux Machine I'll read the instructions you gave me and build this Image :slight_smile:
Thanks again for your support... I'll let you know if everything goes fine :slight_smile:

Wish U the best !

After a bunch of hours of testing I can confirm that the compiling process went well!! Everything I need works fine! Thank You again for your support and wish you the best :slight_smile:

Have a nice evening