Only 32MB of RAM, still works for simple tasks

Nothing spectacular, but I wanted to share that even devices low on RAM (32MB) still work for simple tasks.

In this case there were a few TP-Link 1043nd v1 I had lying around (https://openwrt.org/toh/tp-link/tl-wr1043nd) with only 32MB of RAM.

In my setup one was configured to operate as WDS-client, bridged to LAN ports for a server that has no WiFi.

Since RAM is scarce it makes sense to remove unneeded things:

#!/bin/bash

BUILDER="https://downloads.openwrt.org/releases/21.02.3/targets/ath79/generic/openwrt-imagebuilder-21.02.3-ath79-generic.Linux-x86_64.tar.xz"

# download image builder
if [ ! -f "${BUILDER##*/}" ]; then
	wget "$BUILDER"
	tar xJvf "${BUILDER##*/}"
fi

cd openwrt-*/

# list all targets for this image builder, consider 'make help' as well
#make info

# clean previous images
make clean

# Packages are added if no prefix is given, '-packagename' does not integrate/removes a package
make image  PROFILE="tplink_tl-wr1043nd-v1" \
           PACKAGES="-firewall -kmod-ip6tables -kmod-ipt-conntrack \
                     -kmod-ipt-core -kmod-ipt-nat -kmod-ipt-offload kmod-mac80211 kmod-nf-conntrack -kmod-nf-conntrack6 -kmod-nf-flow -kmod-nf-ipt \
                     -kmod-nf-ipt6 -kmod-nf-nat -kmod-nf-reject -kmod-nf-reject6 -kmod-ppp -kmod-pppoe -kmod-pppox -ppp -luci-proto-ppp -luci-proto-ipv6 -luci-app-firewall \
                     -ppp -ppp-mod-pppoe \
                     -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables -odhcpd-ipv6only \
                     -odhcpd \
                     -iptables \
                     -opkg \
                     zram-swap \
                     uhttpd uhttpd-mod-ubus libiwinfo-lua luci-base luci-mod-admin-full luci-theme-bootstrap \
                     -wpad-basic-wolfssl wpad-wolfssl \
                     luci-app-statistics collectd-mod-ping collectd-mod-wireless collectd-mod-uptime \
                     pingcheck htop"

exit 0

To test the setup the server ran an iperf3 session for a day:

while true; do iperf3 -c 192.168.1.123 -t90; sleep 1; iperf3 -c 192.168.1.123 -R -t90; sleep 1; done

And the device managed to handle that quite Ok (I stopped at ~21:00):

TL;DR: Don't expect wonders, such hardware is still old. Even devices with 32MB can be used for simple tasks. Use SystemBuilder to free/compress RAM. No need to throw the hardware away yet.

Edit:
After configuring/diagnosing/testing it makes sense to disable uhttpd and collectd to free RAM and mitigate OOM issues. Enter console and issue the commands:

/etc/init.d/collectd stop
/etc/init.d/luci_statistics stop
/etc/init.d/uhttpd stop

/etc/init.d/collectd disable
/etc/init.d/luci_statistics disable
/etc/init.d/uhttpd disable

If you like to have LuCI running temporarily, just start it from the console with /etc/init.d/uhttpd start

7 Likes

especially devices with ath9k radio,they are a legend

1 Like

The early draft-n ath9k wireless silicon of the tl-wr1043nd v1 however is far from legendary.

2 Likes

The legends are about the brave souls that used those chips and lived to tell the story :wink:

5 Likes

From what I read MGLRU might even make it better in not too distant future.

i m not talking about the specific chipset on this device, some other tplinks i have, are not so bad compared to other chipset/driver of this days.

https://openwrt.org/docs/guide-user/installation/sysupgrade.cli#low_memory_workaroundstmp_is_too_small_to_hold_the_downloaded_file has some good info on freeing up RAM.

You can also take out the symlinks for these if not needed. I freed up ~5mb with these and wireless drivers on a device.
ppp
pppoe
nf-log6
nf-reject6

nice theres more stuff you could do. like switching off many unneeded things with kernel parameters. watchdog debug etc. also play around with vm values and use zram.
ohhhh u smart. u already have zram. my bad. great job

There are packages that should not have been installed, such as wpad-wolfssl.

Tested with OpenWrt 23.05.2, r23630-842932a63d.
wpad-wolfssl collides and needs to be removed.
1043nd-v1 currently has no release build on official server so this script is a life saver indeed.

Thanks!

Update 2023-12-19:

  • fix zram0: (added kmod-lib-lzo, kmod-crypto-acompress)
  • reduce image: removed luci-app-statistics collectd-mod-ping collectd-mod-wireless collectd-mod-uptime
#!/bin/bash

BUILDER="https://downloads.openwrt.org/releases/23.05.2/targets/ath79/generic/openwrt-imagebuilder-23.05.2-ath79-generic.Linux-x86_64.tar.xz"

# download image builder
if [ ! -f "${BUILDER##*/}" ]; then
	wget "$BUILDER"
	tar xJvf "${BUILDER##*/}"
fi

cd openwrt-*/

# list all targets for this image builder, consider 'make help' as well
#make info

# clean previous images
make clean

# Packages are added if no prefix is given, '-packagename' does not integrate/removes a package
make image  PROFILE="tplink_tl-wr1043nd-v1" \
           PACKAGES="-firewall -kmod-ip6tables -kmod-ipt-conntrack \
                     -kmod-ipt-core -kmod-ipt-nat -kmod-ipt-offload kmod-mac80211 kmod-nf-conntrack -kmod-nf-conntrack6 -kmod-nf-flow -kmod-nf-ipt \
                     -kmod-nf-ipt6 -kmod-nf-nat -kmod-nf-reject -kmod-nf-reject6 -kmod-ppp -kmod-pppoe -kmod-pppox -ppp -luci-proto-ppp -luci-proto-ipv6 -luci-app-firewall \
                     -ppp -ppp-mod-pppoe \
                     -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables -odhcpd-ipv6only \
                     -odhcpd \
                     -iptables \
                     -opkg \
                     zram-swap kmod-lib-lzo kmod-crypto-acompress \
                     uhttpd uhttpd-mod-ubus libiwinfo-lua luci-base luci-mod-admin-full luci-theme-bootstrap \
                     -wpad-basic-wolfssl -wpad-wolfssl \
                     pingcheck htop"

exit 0
2 Likes

How do you get it to build when tplink_tl-wr1043nd-v1 isn't in https://downloads.openwrt.org/releases/23.05.2/targets/ath79/generic/profiles.json ?

WR1043ND V1 was set to source-only in https://github.com/openwrt/openwrt/commit/f5cb556d4f70e7aac428857fe782b58ece0cf188 due to 23.05 deprecating support for 32 MB RAM devices. You would need to compile it yourself from source, with the knowledge that the firmware may be too big.

Its sad, that such source-only devices are not listed here: https://firmware-selector.openwrt.org/
Because there you can do exactly this. Build your own firmware image from source. For example without luci or without other things you just dont need.

The firmware selector builds using the ASU server, which uses the pre-compiled image builder tarballs, so it's not from source.

For example, if you go to FS and ask for an x86/64 SNAPSHOT build, the ASU server grabs https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-imagebuilder-x86-64.Linux-x86_64.tar.xz and uses that for the build.

1 Like

I think it is a more complicated issue, as ASU no longer even allows once-supported devices on their last branch, like the Vonets VAR11N-300, even though it still supports 19.07.10 builds, and the files all still exist: https://downloads.openwrt.org/releases/19.07.10/targets/ramips/mt7620/openwrt-19.07.10-ramips-mt7620-vonets_var11n-300-initramfs-kernel.bin but the device doesn't seem to exist in ASU, even when selected older firmware.

The ASU server intentionally only presents a subset of what's available on the downloads site, see https://sysupgrade.openwrt.org/json/v1/overview.json for what it knows about. (My above reply was addressing the "from source" comment.)

1 Like

How would I use this to build for the Mikrotik hAP Lite?
AR71xx was deprecated with 19.07.10 but with 16mb flash and 32mb ram, surely something like this is possible?