packages icon indicating copy to clipboard operation
packages copied to clipboard

tailscale: improve packaging

Open CAFxX opened this issue 1 year ago • 2 comments

Maintainer: @BKPepe (?) Environment: OpenWrt 21.02.3, r16554-1d4dea6d4f

Description:

The tailscale and tailscaled binaries are quite large, even when squashfs'd:

image

The tailscale documentation mentions that, exactly to address this, tailscaled can be optionally built including the cli functionality, so that it can be symlinked busybox-style to support both the tailscaled and tailscale cli roles:

go build -o tailscale.combined -tags ts_include_cli ./cmd/tailscaled
ln -s tailscale.combined tailscale
ln -s tailscale.combined tailscaled

As currently tailscale depends on tailscaled, we could maybe move from the current two packages

  • tailscaled
  • tailscale (depends: tailscaled)

to two packages and a virtual package

  • tailscaled
  • tailscale-combined (provides: tailscale, tailscaled)

where tailscale-combined is the tailscaled command built using the ts_include_ci tag.

Quickly building the packages locally and compressing with upx (as a stand-in for squashfs) seems to indicate that this approach would save ~1.3MB in a firmware image that includes tailscale (e.g. such as those built via attended-sysupgrades).

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
   9961472 ->   2308728   23.18%   linux/mips    tailscale
  26083328 ->   4790500   18.37%   linux/mips    tailscale.combined
  17235968 ->   3765896   21.85%   linux/mips    tailscaled

CAFxX avatar Aug 02 '22 06:08 CAFxX

As currently tailscale depends on tailscaled, we could maybe move from the current two packages

Feel free to create a pull request to address this.

Quickly building the packages locally and compressing with upx (as a stand-in for squashfs) seems to indicate that this approach would save ~1.3MB in a firmware image that includes tailscale (e.g. such as those built via attended-sysupgrades).

Please see: https://github.com/openwrt/packages/issues/17984#issuecomment-1059674191

BKPepe avatar Aug 02 '22 07:08 BKPepe

Please see: https://github.com/openwrt/packages/issues/17984#issuecomment-1059674191

Yeah as I mentioned, I used upx just as a quick stand-in for squashfs (since internally both squashfs and upx use lzma). I am aware upx wouldn't help with squashfs. I was not advocating we should use upx. It was just to give an estimate of how much we would save in the firmware image after lzma compression.

CAFxX avatar Aug 02 '22 08:08 CAFxX