The RPi3A+, which has been converted to readonly, by default has only about 180 MB of memory available for applications, which tends to be a bit insufficient for running heavy applications.
This log describes how to allocate more memory on RPi3A+ in readonly state.
It is assumed to run offline and headless with Raspberry pi OS 64bit Lite.
1. Reduce the area allocated as overlay. By default, half of the total memory is allocated, but for readonly applications, the write area is not that necessary, so we will reduce it to 100MB. Modify "/usr/bin/raspi-config".
- mount -t tmpfs tmpfs /upper
+ mount -t tmpfs -o size=100M tmpfs /upper
2. If swap is not disabled, the overlay area will be occupied by the swap file (/var/swap) when readonly is enabled. The default setting is 100MB, so 100MB of valuable overlay area will be wasted.
sudo sed -i -e "s/^CONF_SWAPSIZE=.*/CONF_SWAPSIZE=0/g" /etc/dphys-swapfile
3. gpu memory is not needed for headless operation, so it is reduced to the limit.
sudo raspi-config nonint do_memory_split 16
4. make it read-only.
sudo raspi-config nonint enable_overlayfs
sudo systemctl reboot
In this way, the available memory of the RPi3A+ will increase from 181MB->339MB and the writable area of the Overlay will be the same, from 89M->88M.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.