Building

Chromium for Android builds only on x86_64 Linux. On this Windows PC we use WSL2 Ubuntu.

1. Prepare WSL (once, from Windows)

WSL gives Linux only half the RAM by default (15 GB here). Linking Chromium needs more. Create or edit %UserProfile%\.wslconfig (see wslconfig.example):

[wsl2]
memory=24GB
swap=64GB
processors=16

[experimental]
autoMemoryReclaim=dropCache

Don't give WSL more than about 75% of the PC's RAM. At 30 of 32 GB, Windows ran out of memory mid-build.

Then run wsl --shutdown in PowerShell and open Ubuntu again.

Fast swap (zram)

After every WSL restart, run ./scripts/enable-zram.sh (sudo). It adds a 16 GB compressed swap in RAM that the kernel uses before the SSD swap. Compiler memory compresses ~3:1, so link and LTO peaks stay fast.

GPU memory (RTX 4050, 6 GB) is not used as swap. The only tool for it (vramfs) needs OpenCL, which WSL doesn't provide for NVIDIA. Swapping through a FUSE file is also known to deadlock under memory pressure, which is exactly when swap is needed.

2. Keep the checkout on the Linux filesystem

This repo can stay on W: (/mnt/w/Desktop/GIT/browser in WSL), but the Chromium checkout must live inside WSL (~/chromium, the default). Windows-mounted drives are far too slow for 500k files. Override with CHROMIUM_DIR=/path ./scripts/... if needed.

3. Steps (inside Ubuntu)

cd /mnt/w/Desktop/GIT/browser
./scripts/check-host.sh
./scripts/install-deps.sh               # sudo; installs depot_tools
source ~/.bashrc
./scripts/fetch-chromium.sh             # sudo for Chromium's deps; add --unsupported if the
                                        # Ubuntu release is newer than Chromium supports
./scripts/apply-patches.sh
./scripts/build.sh dev                  # APK copied to dist/

Expected: download ~40 GB; checkout ~100 GB; first dev build several hours on 16 threads (later builds are incremental). release builds use LTO: slower, and they need the RAM above.

4. Install on a phone

adb install -r dist/org.freebrowser.app-<version>-dev-arm64.apk

(Use adb.exe from Windows if the phone is connected to Windows rather than WSL.)

5. Updating Chromium

  1. Put the new version in chromium_version.txt (current stable for Android: https://chromiumdash.appspot.com/releases?platform=Android).
  2. ./scripts/apply-patches.sh --reset-only && ./scripts/fetch-chromium.sh --skip-deps
  3. ./scripts/apply-patches.sh and fix each patch that fails, then export-patch.sh.
  4. gn args out/dev --list --short and remove arguments that no longer exist.