Custom build with possible kernel (8/32 device)

I have a bunch (about 15) Ubiqiti AirMax M devices, but I want to rebuild the network to add separate VLANs on separate AP's. So I went from AirOS to OpenWRT. And all functionality seems to work, tested and all.

At least, it works now, out of season, with only a handful of users around. Come spring and summer, there will be hundreds of people, all expecting free wifi. so high demand with low budget. Even now I sometimes see messages that according to the web point to RAM shortage. htop agrees.

I noticed 18.06.1 leaves very little RAM. 15.05.01 or even 14.09 leaves barely more. 12.09 however leaves tons.
But 12.09 is very old. I will use it if I have to, but ubus is too limited to allow wifi-disconnect script to run (missing wireless and hostapd classes)

So I am trying to custom build 18.06.01, with as little as possible RAM usage. Which means removing as many kernel modules as I can. (packages just save flash, I have plenty of that. RAM is the problem)
Since I do not need firewall, IPv6 I will try and remove that.

Does anyone else know what I can remove that would either save RAM directly, or save RAM by having the kernel (which resides in RAM) smaller.

All hints and suggestions welcome

Alternatively, anyone knows how feasible it would be to put 14.09 ubus and logread into a custom 12.09 build?

PS: yes, I know what I want to do should make me buy Ubiquiti Unify instead of AirMax. Low budget, remember. These devices I already have.

12.09, being over 6 years old, has multiple, well-known security vulnerabilities in the kernel, application software, and 802.11 protocols. It can't be recommended for any use where it is exposed to access over wired or wireless.

What are you running on the device other than the absolute minimum (I don't consider DNS or DHCP to be part of "absolute minimum")?

As a point of reference, an Archer C7 v2 on the ar71xx target from master of late 2018 shows around 24 MB of RAM consumption, up and running APs, B.A.T.M.A.N., a couple ssh sessions, and htop.

jeff@office:~$ sudo dmesg | grep Memory
[    0.000000] Memory: 123300K/131072K available (3702K kernel code, 145K rwdata, 896K rodata, 1200K init, 212K bss, 7772K reserved, 0K cma-reserved)

So, at boot, before modules are loaded from disk, as I read that output, the "bare" kernel is already consuming ~8 MB.

Once running,

jeff@office:~$ sudo grep Slab /proc/meminfo 
Slab:               9888 kB

suggests that the kernel is using ~10 MB.

My kernel has several modules that many people may not need, including, from lsmod:

ath9k_htc              55619  0 
batman_adv            158261  0 
crc16                   1031  2 batman_adv,ext4
crc32c_generic          1424  1 
crypto_hash            10002  4 libcrc32c,ext4,jbd2,crc32c_generic
ehci_hcd               35575  1 ehci_platform
ehci_platform           5072  0 
ext4                  382736  0 
jbd2                   51362  1 ext4
libcrc32c                663  1 batman_adv
mbcache                 3182  1 ext4
nls_base                5152  1 usbcore
usb_common              2551  1 usbcore
usbcore               131299  4 ath9k_htc,ledtrig_usbport,ehci_platform,ehci_hcd
x_tables               13839  2 ip6_tables,ip_tables

Even with those, and if "module size" equated to RAM consumption, there isn't a lot to gain.

may be of some value in trying to determine what can be removed (though there doesn't seem to be a clear, definitive answer in that thread).

Personally, I'd be surprised if disabling IPv6 helps much, as, at least as I understand it, IPv6 is pretty tightly woven into the 4.x series of kernels.

Interestingly, I also have a ArcherC7. Its serving the private house. As it has plenty of MB's, I am not worried about that one though.

I am running the bare minimum. stopped everything except external syslog. Even stopped ntpd (cron stops that and itself after an hour, as I do want proper time in my syslog) Not much left running. Still wondering if the wifi-disconnect is worth its cost.

Its setup with 3 VLAN interfaces and 3 AP's. Oddly, that does not seem to cost too much.

First picture is 15.05.1, all stripped down. second one 12.09.
Admittedly, the first picture is already not as bad as it was. But I do want to see what I can do with building custom. So as stated, any hits are appreciated.

image

image

You might want to consider periodically updating the time. As I understand, 802.11 specs require 20 ppm accuracy in frequency, so your time will likely drift by some fraction of that. 20 ppm is close to two seconds a day.

Edit:

As for hints, I think you're on the right track by disabling as many kernel modules as you can. I don't know if it will help, as I don't know if they're loaded into RAM, but removing debug symbols and extraneous exports from the kernel and libraries may also help.

build JFFS2 image to free up few MBs of RAM

A JFFS2 will use less RAM then SQUASHFS? Does that have something to do with the decompression? Please explain further. Remember, I have enough Flash, its RAM I am trying to save.

PS: did someone move this to 'developers'? Pretty sure I had submitted to 'community builds'

i did not bother understanding why but probably you're right and some (if not whole) part of image is not decompressed into RAM with JFFS2

check commit to build image: https://github.com/psyborg55/openwrt/commit/8709a88713ac962668e2a755360681d9e402869f