16MB flash size, but only ~3.30MB free

hi, sorry to revive this old topic but i have a question related to this about running out of space

i have an ubiquiti mesh/lite and it says it have 16mb of flash size, but after a firstboot it have only ~3.30MB free and my filesystem looks like this


it is possible to increase /overlay
what is this /tmp? allocated in RAM

On a Ubiquiti device of that type, you have a total of 0x790000 for kernel, ROM, and overlay.

From target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi

                        partition@70000 {
                                label = "firmware";
                                reg = <0x070000 0x790000>;
                                compatible = "denx,uimage";
                        };

0x790000/1024 = 7744, 1 kB blocks

7744 - 2560 (ROM) - 3776 (overlay) = 1408 for kernel, which seems reasonable (there's probably a few less due to the JFFS2 overhead).

"It is what it is" -- that's what you've got to "play" with. You should be able to install a reasonable set of packages (such as for one VPN service) into that space. If not, you'd have to build from source or assemble your own image from packages.

/tmp/ is a RAM-backed, volatile file system and can't be used for persistent install of packages (or anything else persistent).

3 Likes

thanks for replay

im already reading and trying to make a custom build

thanks again

1 Like

Yes it is a 16 MB chip, but you only see 8 MB because the stock firmware is dual partition. Only half of the flash chip is used at a time, while the other half contains a complete backup copy of the OS. Regular builds of OpenWrt comply with this scheme by only using the first half of the flash chip.

Before flashing a custom build that repartitions the flash, be sure to copy out backups of the ART and bootloader partitions to your PC and another safe place.

1 Like

nice tip, thanks
yes im very afraid of bricking the ubiquiti by doing this, i will try to get as much info as possible

is there maybe someone that can help me giving me an expert hand on making a custom build for a project im making?
i found this
https://forum.openwrt.org/t/build-script-to-compile-custom-firmware-for-devices-with-small-memory/
and it doesnt look so hard, but as a noob i am on this and concidering i only count with 1 device to try, i dont want to take a silly risk and brick it, so if maybe it is easy for an expert to create a custom build i was thinking if someone could help me to build the img im looking for

8 MB should be enough flash for a reasonable install. That script looks like overkill to me. What packages do you want and which do you need to install?

I would like to have the base linux OS + ssh + aircrack-ng + python3-light + python3-pip

Im trying to make a drone detector and defender

I already test my python script on a raspberry pi zero and i tought the ubiquiti would be an awesome hardware to use outdoor

Im able to install aircrack-ng but python3 even the light its too heavy, so maybe cleaning all the web interface and functions from openwrt and letting the OS clean (with opkg and ssh) would be awesome.

Thanks for your attention

Working with an ath79 device that has 16 MB of flash available and an ath10k radio (Archer C7v2), with no "extra" packages from master (meaning no LuCI and no web server)

  • 4,391,714 -- Overall sysupgrade image size (kernel, ROM)

Add aircrack-ng (OpenSSL is default)

  • 5,702,434

Add python3-light and python3-pip (be aware that -light doesn't have many "normal" Python libraries)

  • 8,061,730

Add python3-pip (be aware that only "pure Python" packages can be installed by pip)

  • 12,649,250

So it would be possible to fit all of that into an ath79 device with a 16 MB flash where the majority of that flash was available to OpenWrt. Doing that for the qca9563_ubnt_unifiac would require some careful examination of the boot loader's behavior (as it might try to boot from the "alternate" firmware under certain situations, resulting in a soft brick) and potentially "stealing" the alternate-firmware's partition for a single, larger firmware partition

                        partition@70000 {
                                label = "firmware";
                                reg = <0x070000 0x790000>;
                                compatible = "denx,uimage";
                        };

                        partition@800000 {
                                label = "ubnt-airos";
                                reg = <0x800000 0x790000>;
                                read-only;
                        };

I wouldn't attempt it without full backups of the flash and serial connectivity.

Conceivably you could allocate 0x070000 - 0xf90000 for firmware, a little more than 15 MB.

NB: Do not overwrite the bs, cfg, or art partitions!

Assuming that the U-Boot could be made robust to never try to boot from the alternate firmware, it might be a couple evenings of careful work to change the DTS and add a "custom" device definition for the expanded use of flash.

1 Like

great info @jeff thank a lot
yes in considering translating my python script to bash script to save that space, but i have never worked with bash scripts and i dont know how to do the things this couple python libs do, like opening and reading a csv (csv) or creating a wifi beacon frame (scapy)

going back to the custom build, do you think its able for me to proceed with an "external help", like you or anyone who would like to put those couple of evenings on this, or it would be impossible unless the "external help" have the ubiquiti too?

Without the device in hand and serial access, that person would be "shooting blind".

You might be able to get some guidance as to the careful steps you could take once you've got serial access. There might even be others with the device in hand that you could work with (I've already got more routers on my desk than I know what to do with!) if you open a new thread in the For Developers section clearly defining your goals in its title.

Do you have access to a Linux-based OS (box or VM) and some level of comfort with command line use?

It looks like if you've got a 3.3 V serial adapter, the connections are pretty easy to get to from https://openwrt.org/toh/ubiquiti/unifiac#serial_console

thats sounds like the way to go

yes i have my laptop with ubuntu, i should have an usb-to-serial cable somewhere

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.