Attended Sysupgrade (ASU/auc), owut, firmware selector and openwrt-imagebuilder-***.tar.zst all allow customizing the openwrt image.
While updating with Attended Sysupgrade (with luci), it openly suggests to add all currently installed packages in the image that is going to be installed and this is the default behavior.
I have a 16mb device (RB962UiGS-5HacT2HnT (hAP ac)) and I wanted to install tailscale, which installed might go up to 25mb (There are instructions how to minify tailscale). This motivated me to figure out how package size is calculated.
First, how is storage used. If I understand correctly, the image is installed in
/rom
and the rw part is in /overlay
.
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mtdblock0 31:0 0 128K 0 disk
mtdblock1 31:1 0 56K 1 disk
mtdblock2 31:2 0 4K 1 disk
mtdblock3 31:3 0 4K 1 disk
mtdblock4 31:4 0 60K 1 disk
mtdblock5 31:5 0 4K 0 disk
mtdblock6 31:6 0 15.9M 0 disk
mtdblock7 31:7 0 2.7M 0 disk
mtdblock8 31:8 0 13.2M 0 disk /rom
mtdblock9 31:9 0 6.8M 0 disk /overlay
My router is 16mb, so that's probably mtdblock6? Then it is split into mtdblock7 and mtdblock8. But then /rom
+ /overlay
is 13.2+6.8=20mb, which I don't have an explanation for. Maybe mtdblock9 is an uncompressed version of mtdblock7. I don't know. My router's page doesn't have a description
But then:
# du -sh /rom
23.7M /rom
This in my head means mtdblock8 is somehow compressed and I get 23.7mb out of 13.2, compression ratio is 23.7/13.2=1.80
I don't know how to calculate the data compression ratio of /overlay
, but basically /rom
and /overlay
is a zero-sum game. So which place is better for a package?
If I want to update a remote device that I only access via tailscale, then I need to create an image with tailscale already baked in and some uci-defaults scripts to configure it.
Second, what are the default packages of a clean openwrt. Every sub-target has a manifest file (example). But this contains all the dependencies.
The firmware-selector gives a better answer in the customized field.
I tested and I can create an image without any of the default packages - 3.3 mb bin file. Will the .bin
be the size of the mtdblock8?
Tested again and the default 24.10.0 image for my device is 7.2mb, that means all the 'default' packages are 3.9mb. Can I remove any of them?
My final test was to add tailscale to the build, The result is 13.3. Does that mean I can flash it on the device?
Questions:
- why is
/rom
+/overlay
= 20mb, when I have 16mb storage? - what is the data compression ratio of
/rom
and of/overlay
? - can I remove any of the 'default' packages, if yes, which ones?
- Will the
.bin
file be exactly the same size as mtdblock8? Is it copied one-to-one or does it do something else? - If the image is 13.3mb, does that mean I can flash it on a 16mb device?