Skip to content

About

revive: open-source Linux OS for old Android phones. Mainline kernel + Debian, own Qt/QML touch shell, no Google, no Halium. First device: Xiaomi Mi A2.

Topics

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

revive

revive: Linux for old Android phones

License: MIT Last commit GitHub stars Kernel: mainline Linux 7.2 Userland: Debian forky Architecture: arm64 Shell: Qt 6 / QML Wayland: phoc (wlroots) Device: Xiaomi Mi A2 No Google services PRs welcome Built with AIWorkHub

Your phone's second life. revive is an open-source mobile Linux distribution that replaces Android on old smartphones. The phone boots a mainline Linux kernel and a plain Debian userland: no Android, no Google services, no Halium or libhybris, no accounts, no telemetry. Every Debian package runs on it, and revive adds its own touch shell on top.

Goal: keep working phones out of the landfill and turn them into private, hackable pocket computers, small servers or embedded devices. The design is a light, universal ARM platform: phones first, then tablets, single-board computers and industrial devices (docs/VISION.md).

revive home screen: clock, apps, dock, status bar with CPU, RAM, Wi-Fi and battery revive quick settings: Wi-Fi, brightness, theme, language, restart and power off foot terminal with the on-screen keyboard GNOME Contacts running on revive

revive light theme, home screen in Georgian revive light theme, quick settings in Georgian volume bar shown by the hardware volume keys

More screenshots, in date order: docs/screenshots/.

What works

Area State on the Xiaomi Mi A2
Boot mainline Linux 7.2 (sdm660-mainline), Debian forky arm64, systemd
Display and touch panel, touchscreen, GPU (Adreno 512, Mesa freedreno), brightness
Shell phoc (wlroots) + revive-shell (Qt 6 / QML): home screen, launcher, dock, status bar with CPU/RAM/battery, pull-down quick settings, swipe-up home gesture, auto-rotation
Input on-screen keyboard (phosh-osk-stevia), power key screen on/off, volume keys
Network Wi-Fi (iwd) with scan and connect in the shade, USB network + SSH to a PC
Audio speaker (TAS2557, clean at full volume since patch 0007), earpiece/headphone paths, microphones, PipeWire (16-bit PCM: the ADSP mishandles 24-bit)
Apps any Debian app; Firefox (mobile layout), GNOME Calls, Chats, Contacts, Calculator, Clocks, Text Editor, Image Viewer, Files, foot preinstalled
Themes and languages JSON theme files (dark, light) and Qt translations (English, Georgian), switched live
Modem SIM (dual-SIM, first card used), registers on LTE; outgoing and incoming calls connect, but call audio is missing (needs q6voice); mobile data not working yet (IPA v2.6L data path)
Updates ./flash.sh reboots the phone to fastboot over SSH and reflashes it, no button presses
Memory about 1 GB used of 4 GB with the shell, keyboard, Calls and Contacts services running and no app open
Device Codename Kernel Status
Xiaomi Mi A2 xiaomi-jasmine sdm660-mainline 7.2 daily-driver work in progress; see the table above

New phones are added as a devices/<codename>/ folder (CONTRIBUTING.md). The shell talks to hardware only through one device API, Revive.System, so a port mostly means a device profile, not shell code. Themes and translations: docs/CONTRIBUTING-THEMES-AND-LANGUAGES.md.

Built with AIWorkHub

revive is developed with AIWorkHub, an open-source, local-first control plane for multi-model AI coding agents in VS Code and MCP. A manager agent plans the work as task cards with exact write scopes, worker agents implement them in isolated worktrees, reviewer agents check them, and every change is built and measured on the real phone before it lands on main. The kernel debugging, device bring-up and on-phone testing in this repository were done this way, with a human owner setting direction.

Build

Needs Docker (Docker Desktop on Windows/macOS). On a Linux host, enable arm64 emulation once: docker run --privileged --rm tonistiigi/binfmt --install arm64.

./build.sh xiaomi-jasmine        # → out/xiaomi-jasmine/{boot.img,rootfs.img,vbmeta.img}

On Windows, run this from Git Bash or WSL. The first build downloads the kernel and Debian, which takes a while. Later builds reuse the linuxphone-work Docker volume.

Build options

Four options tune the Debian system. Set them in the environment (SLIM_DOCS=0 APPS="firefox calls" ./build.sh xiaomi-jasmine) or in devices/<name>/device.conf; the environment wins. The build log prints the chosen values (== build options: ...).

Option Default Effect
SLIM_DOCS 1 Do not install /usr/share/doc, man, info and help. /usr/share/doc/*/copyright stays, for license compliance. 0 installs everything.
LOCALES en ka Space-separated languages kept under /usr/share/locale: each one and its variants (en, en_GB, ka@...), plus locale.alias. all keeps everything.
APPS firefox calls chats contacts calculator clocks editor viewer files App bundles to preinstall. APPS="" builds a minimal image. Core system packages (shell, compositor, keyboard, network, modem, audio) are always installed. The extra bundles android (Android apps, large, slow first build), dotnet (shared .NET runtime for MAUI apps, 35 MB download) and tor (a local Tor daemon for revive-market --tor) are only installed when you list them; see below.
ZRAM_PERCENT 50 Compressed swap in RAM (zram), sized at this percent of RAM, zstd, swap priority 100. Installs systemd-zram-generator, writes /etc/systemd/zram-generator.conf and sets vm.swappiness=100 in /etc/sysctl.d/99-revive-zram.conf. 0 adds none of these.

Why ZRAM_PERCENT: the Mi A2 has 4 GB of RAM and no swap. A compile plus Firefox filled it; with nothing to page out, the kernel thrashed the page cache and the phone froze, SSH silent for minutes. With zram, cold pages are compressed in RAM, so memory pressure slows the phone down instead of freezing it. Trade-off: compression costs CPU time, and the compressed pages still occupy RAM (zstd typically gives about 2-3x), so it stretches memory but is no replacement for it. 0 skips it. The kernel needs CONFIG_ZRAM and zstd support (CONFIG_ZRAM_BACKEND_ZSTD, CONFIG_CRYPTO_ZSTD) in devices/<name>/kernel.config or the defconfig; verify on the phone with swapon --show and zramctl.

App bundles and their packages:

Bundle Packages
firefox firefox-esr, firefox-esr-mobile-config (and the revive-firefox-defaults step, only when Firefox is built in)
calls gnome-calls, callaudiod
chats chatty
contacts gnome-contacts
calculator gnome-calculator
clocks gnome-clocks
editor gnome-text-editor
viewer loupe
files portfolio-filemanager
android The Android Translation Layer (runs Android APKs), built from source, plus the Debian libraries it needs. Not in the default APPS.
dotnet The pinned shared .NET 11.0.0 runtime (linux-arm64) in /usr/lib/dotnet, plus libssl3t64, zlib1g, libstdc++6. Not in the default APPS.
tor The Debian tor package; its service listens on 127.0.0.1:9050, where revive-market --tor connects (docs/MARKET.md). Not in the default APPS.

android lets Android apps run natively on revive (no container, no Google services); see docs/ANDROID-APPS.md for what works. revive applies local ATL patches from tools/atl/patches on top of the pinned ATL commit until they are upstream; the one there now (0001-FragmentTransaction-move-added-fragments-only-as-far, fragment lifecycle) fixes the androidx "Restarter must be created only during owner's initialization stage" abort. Patches count as pins: adding, removing or changing one rebuilds ATL. It costs about 190 MB compressed (atl-stage.tar.gz; 240 files) plus its runtime packages. The first build takes several hours: it compiles ART and the Android libraries natively for arm64, which under qemu on a PC is slow, and cannot be done on the phone (4 GB of RAM). Enable it with APPS="firefox calls ... android" (add it to the other bundles you want; it is not implied by them). The build is split in two:

  • The host side runs tools/atl (docker build --platform linux/arm64 -t revive-atl tools/atl, then docker run of that image) when out/atl/atl-stage.tar.gz is missing or out/atl/versions.txt does not match the commits pinned in tools/atl/build-atl.sh. It writes out/atl/atl-stage.tar.gz, out/atl/runtime-packages.txt (Debian packages the staged files need, derived with ldd and dpkg -S) and out/atl/versions.txt.
  • The image build then installs the packages from runtime-packages.txt and extracts the stage into the rootfs.

Caches: the Docker volume revive-atl-work (sources, build trees, finished-component markers; an interrupted build resumes there) and out/atl/. To rebuild, delete out/atl: the next build runs tools/atl again and reuses the finished components in the volume. When any pin changed, the stage is started over and every component is rebuilt against the new ones (incrementally, from the build trees kept in the volume). For a clean rebuild from scratch also run docker volume rm revive-atl-work.

dotnet installs the shared .NET runtime, so .NET MAUI apps (OpenMaui, MAUI's Linux backend) can be published framework-dependent: 48 MB instead of 135 MB self-contained. See docs/PORTING-MAUI.md for how to port and install such an app. It is not in the default APPS; enable it with APPS="firefox calls ... dotnet".

  • Size: a 35 MB download (35,716,289 bytes), 87 MB on disk in /usr/lib/dotnet.
  • Pinned version: .NET runtime 11.0.0, linux-arm64 (DOTNET_RUNTIME_URL and DOTNET_RUNTIME_SHA512 at the top of the bundle code in build.sh). The build downloads it with curl inside the build container, checks it with sha512sum -c and stops on a mismatch.
  • Installed as: /usr/lib/dotnet (root-owned), /usr/bin/dotnet symlink, and /etc/dotnet/install_location (/usr/lib/dotnet), so framework-dependent apps start without DOTNET_ROOT.
  • Native dependencies: libssl3t64, zlib1g and libstdc++6 are listed with the bundle; libicu already comes with Qt, and the build fails if it is ever absent.
  • To bump: take the new linux-arm64 runtime URL and its sha512 from releases.json and replace both variables in build.sh. The runtime is cached on the linuxphone-work volume and re-checked against the pinned sha512 every build.

Measured in the built image (/work/xiaomi-jasmine/rootfs, 1.8 GB, 698 packages):

What Size Option
/usr/share/locale 196 MB LOCALES
/usr/share/doc 40.5 MB SLIM_DOCS
/usr/share/help 11.6 MB SLIM_DOCS
/usr/share/man 10 MB SLIM_DOCS
/usr/share/info 0.6 MB SLIM_DOCS
firefox-esr 273 MB APPS (firefox)

Other big packages, for orientation: GNOME Contacts and Calls pull libwebkit2gtk (97 MB) and libjavascriptcoregtk (30 MB) through libedataserverui, so dropping contacts and calls saves those too. gstreamer1.0-plugins-bad pulls onnxruntime and dnnl (about 44 MB), and is not tied to an app bundle.

The docs and locale rules are dpkg path-exclude/path-include lines that live in the image under /etc/dpkg/dpkg.cfg.d/ (mmdebstrap writes them to 99mmdebstrap), so later apt install runs on the phone stay slim too. To undo them on a running phone, delete that file, then reinstall the packages whose files you want back:

grep -l path-exclude /etc/dpkg/dpkg.cfg.d/* | xargs sudo rm   # as phone, with sudo
sudo apt install --reinstall <package>                        # e.g. the app whose man page or translation you miss

apt install --reinstall $(dpkg-query -f '${binary:Package} ' -W) restores everything, but needs the space and a network connection.

Install (Xiaomi Mi A2)

This erases everything on the phone, and Android is gone until you reflash Xiaomi's stock fastboot ROM (flash_all).

  1. In Android: Settings → About → tap Build number 7× → Developer options → enable OEM unlocking and USB debugging.
  2. Unlock the bootloader (confirm on the phone with the volume and power keys):
    adb reboot bootloader
    fastboot flashing unlock
  3. Test the kernel without flashing anything. The kernel log should scroll on the screen, then stop at "rootfs not found", which is expected because nothing is flashed yet:
    fastboot boot out/xiaomi-jasmine/boot.img
  4. Flash and boot:
    fastboot reboot bootloader
    fastboot flash --slot=all vbmeta out/xiaomi-jasmine/vbmeta.img
    fastboot flash --slot=all boot   out/xiaomi-jasmine/boot.img
    fastboot flash userdata          out/xiaomi-jasmine/rootfs.img
    fastboot reboot

Updating

Once revive runs on the phone, update it with no button presses. Connect it over USB and run:

./flash.sh xiaomi-jasmine

The script reboots the phone into fastboot over SSH (phone@172.16.42.1, sudo asks for the phone's password), flashes boot and userdata, then boots the new kernel with fastboot boot. Use --host user@ip for another address.

  • --boot-only test-boots boot.img and writes nothing.
  • --no-userdata keeps the phone's data and only updates the kernel.

If the phone does not answer SSH, the script asks you to hold Power + Volume Down and keeps waiting. vbmeta is flashed once at install and is not touched here.

Use

  • On the phone: log in on the console with the on-screen keyboard.
  • Over USB: the phone shows up as a USB network adapter and gives your computer an address.
    ssh phone@172.16.42.1

If SSH doesn't connect, run usbinfo on the phone. It shows the USB link state.

The phone boots into revive-shell. Swipe up from the bottom edge to go home. If the shell keeps crashing, tty1 falls back to the text console.

The default login is phone / 1234. Change it with passwd. Each phone generates its own SSH host keys on first boot.

Layout

build.sh                 builds kernel, rootfs, initramfs and images for one device
Dockerfile               the build environment
tools/atl/               builds the Android Translation Layer for the `android` APPS bundle (docs/ANDROID-APPS.md)
tools/revive-port/       revive-port: reports what an APK needs that ATL lacks (docs/ANDROID-APPS.md)
flash.sh                 updates a running phone over USB (reboot to fastboot, flash, boot)
shell/                   revive-shell (Qt 6 / QML layer-shell client on phoc); ./shell/dev-deploy.sh builds it on a phone
shell/system/            Revive.System, the device API (battery, display, power, keys, audio, ...)
devices/<codename>/      everything device-specific (see CONTRIBUTING.md)
rootfs/                  files copied into every device's rootfs

Credits

revive stands on the work of others. Thank you:

  • sdm660-mainline: the mainline Linux kernel for SDM660/SDM636 phones that revive boots, including the Mi A2 device tree and the Qualcomm sensor manager (qcom_smgr) drivers.
  • Gianluca Boiano (@M0Rf30): the Mi A2 camera work (Sony IMX486 and IMX376 drivers, DW9763 actuator, SDM660 CAMSS fixes; sdm660-mainline#267, #270).
  • @setotau: IPA v2.6L support that gives the modem its data path (sdm660-mainline#250).
  • linux-msm: rmtfs, tqftpserv, qrtr and diag-router, which keep the Qualcomm modem alive.
  • Phosh project: phoc, the compositor revive-shell runs on, and the phosh-osk-stevia on-screen keyboard; GNOME and Purism: Calls and Chats.
  • postmarketOS and the mobile Linux community: years of groundwork on mainline phones.
  • Debian: the userland and every package revive installs.

License

MIT, see LICENSE. The Linux kernel and Debian packages keep their own licenses.

About

revive: open-source Linux OS for old Android phones. Mainline kernel + Debian, own Qt/QML touch shell, no Google, no Halium. First device: Xiaomi Mi A2.

Topics

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages