Custom OpenWRT FW for AP with 4MB

So you have an Access Point that supported OpenWRT but now the official builds of OpenWRT dont support it anymore because of 4MB memory/32MB ram limitations?

There are some options how to continue using this device, especially if you only need some AP to extend your wifi coverage, but you have to build the image yourself, especially if you want to use some current features like e.g. for seamless roaming.

Luckily, due to some available docker images (source), setting up the buildenvironment is as easy as executing

$ docker run --rm -v "$(pwd)":/home/build/openwrt/source -it openwrtorg/imagebuilder:19.07.7

Then in the docker shell

# get current state of sourcecode
docker> git clone repo
docker> cd repo
# configure your device here
docker> make menuconfig
# download all dependencies
docker> make download
# build the image
docker> make -j4

On your host, you can check the repo/bin/targets/<architecture>/tiny folder for firmware images to flash. If there is no factory one, then the image probably was would have been to big for the selected device so it wasnt built.

Now some efforts to make it smaller:

When you get a factory image, SSH it over to /tmp/fw.img and flash it via SSH command:

sysupgrade -v -F -n /tmp/fw.img

One helpful command was to rerequest a DHCP lease without rebooting the router by:

PID=`pidof udhcpc` && kill -SIGUSR1 $PID