Zerone Laboratories / operating systems

ztOS

A phone operating system with Windows Phone 8.1's look and motion, on Arch Linux ARM and mainline Linux.

ztOS is the ztMETRO shell, its own apps, an updater and an SDK for apps in Python and Qt, on an ordinary Arch Linux ARM system. It runs on the Samsung Galaxy S9 (SM-G960N, starlte) and in the QEMU emulator. Everything that moves is drawn by the GPU.

It is alpha software. The S9 port runs a mainline 7.1 kernel with the phone's GPU, display, touch, Wi-Fi, 4G data, sound and sensors working. ztConflo, its image builder, is how it reaches other phones.

Screenshots

Taken from the live display of a Galaxy S9.

Start: live tiles in the Windows Phone layout
Start
The alphabetical app list
App list
Settings, cellular and SIM, with signal and registration
Cellular and SIM
ZrnDevTest showing live sensor readings
Sensors, in ZrnDevTest
Settings, about: the device and ztOS version
About

ztMETRO

The shell, and the only one installed.

ztMETRO is a Wayland compositor, built on wlroots, that is also the whole phone interface: Start with its live tiles, the app list and search, the action centre, the app switcher, the lock screen and the on-screen keyboard. Its look and motion are Windows Phone 8.1's, measured frame by frame against screen recordings of real Lumias.

It renders itself with OpenGL ES: every tile, bar and app surface is a textured quad with its own matrix, which is what lets tiles tilt under a finger and whole screens swing. Text is drawn once and kept as a texture, and frames are drawn only while something moves.

Start and tiles
Pin, move and resize tiles; the turnstile when an app opens and when you come back.
Action centre
Notifications, quick actions, brightness, and a media banner.
Keyboard
On-screen, lifting the app so the text box stays in sight.
Animation speed
One setting for the whole interface, shell and apps, 75% by default.
Haptics
Strength per kind of touch, set in Settings.
Other apps
Firefox, Chromium and any Linux app run as windows inside it.

Apps

What comes installed.

AppWhat it doesWritten with
SettingsWi-Fi, cellular and SIM, haptics, quick actions, theme, developer optionsZrnMetroCore (C)
Phone, Messaging, PeopleCalls, SMS and contacts, in the same styleZrnMetroCore (C)
ZrnDevTestWhat the hardware reports: system, sensors live, the journal and kernel logZrnMetroCore (C)
WelcomeThe first-start tour: Start, getting around, your apps, making appsztOS SDK (Python)
UpdatesShows available updates and installs themztOS SDK (Python)
Firefox, Chromium, terminalOrdinary Linux apps, shown as windowsArch packages

The native apps share ZrnMetroCore, a small toolkit with the shell's own widgets, page turns, pivots and press tilt.

The SDK

Apps in Python and Qt that look and move like the built-in ones.

The ztOS SDK builds an app into a single file: a small C launcher with the app's Python code, pages, pictures and the ztos runtime zipped behind it. Pages, lists, pivots, entries, toggles, round buttons, app bars and dialogs all come from the runtime, with the toolkit's own numbers for every motion.

ztos-sdk new "Notes"     # a new app, from the template
ztos-sdk run             # try it on the computer
ztos-sdk deploy          # build, install on the phone, open it
ztos-sdk logs -f         # what it prints, on the phone

Keeping it fast

  • Motion on the GPU. While a page turns, a list scrolls or a button leans, a GPU layer over the app shows pictures of the pages as textured quads, drawn by a small C renderer. Widgets are rasterised once, not every frame.
  • A warm runtime. ztos-zygote loads Qt for Python once and forks each app from itself, which saves about a second of CPU per launch.
  • Compiled code. Apps ship with their Python already compiled, so the phone never compiles it on start.

System services

ztOS's parts below the shell.

NameWhat it does
ztOSCoreSensorFrameworkStarts and watches every piece of hardware support and reports what fails; runs the sensor hub and the sensors
ztOSCoreNetworkingThe modem, calls, messages and mobile data, and joining Wi-Fi
ztOSCirrusAudioSound: the audio DSP and the Cirrus speaker amplifiers
zrnperfdPower: dynamic boost from the efficiency cores up, and core power-down
ztos-updateThe updater: a daily check, a notification, and the Updates app

The Galaxy S9 port

Mainline Linux on an Exynos 9810.

ztOS's first phone is the Galaxy S9, SM-G960N (starlte). It runs mainline Linux 7.1 with the Exynos 9810 drivers, booting from the phone's internal storage, with Arch on BOOT and TWRP left in RECOVERY. The phone's hardware support is built as loadable kernel modules, so drivers can be developed without reflashing. The modem and sensor hub still use Samsung's own Android daemons, run from the phone's stock partitions.

Installing

This erases the phone Android and everything in its storage are replaced. The phone's IMEI and modem calibration are never touched. Read the known quirks below first.

You need a Linux computer with about 15 GB free, an internet connection, a USB cable, and the phone charged above 50%. The bootloader must already be unlocked with TWRP installed in RECOVERY.

  1. Boot the phone into TWRPTurn the phone off, then hold Volume Up, Bixby and Power until TWRP appears. Connect it to the computer with the USB cable.
  2. Get ztOS on the computergit clone https://github.com/Zerone-Laboratories/ztOS.git
    cd ztOS
  3. Run the installerinstaller/ztos install --target starlte
    Choose 1, then pick a user name and password. The build takes 30 to 60 minutes.
  4. Confirm the installAnswer yes to write the boot image, then type ERASE when asked. Leave the cable in until it says done.
  5. Restart the phoneHold Power, Volume Up and Volume Down. The first start takes about a minute, then the Welcome app shows how ztOS is used.

If something fails, the phone goes back to TWRP by itself. Start again from step 3. To try ztOS without a phone, run installer/ztos install --target qemu instead. It opens ztOS in a phone-shaped window on the computer.

Hardware status

PartStatusNotes
Display, 1440×2960WorksManual and automatic brightness
GPUWorksMali-G72 MC18 through Panfrost, OpenGL ES 3.1
TouchscreenWorksS6SY761, multi-touch
CPU, all 8 coresWorksFrequency scaling; big cores powered down when idle
Battery and chargerWorksMAX17042 gauge, MAX77705 charger
Wi-FiWorksBCM4361, joined from Settings
Mobile data, SIM, signalWorks4G through ztOSCoreNetworking
SpeakerWorksThrough ztOSCirrusAudio
Light sensor, vibration, notification lightWorks
SMSPartialSending works; receiving is untested
CallsPartialThey connect, but the call's sound is not routed yet
Motion sensorsPartialReadable; nothing in the shell uses them yet
SuspendBrokenThe big cores don't come back; the screen-off state runs at the lowest clocks instead
Bluetooth, camera, GPS, microphoneNot started

Known quirks

  • The modem or sensor hub doesn't come up. It tends to follow a forced reboot or a crash. One pass through TWRP brings them back: reboot into recovery, then back into ztOS.
  • A driver that crashed while loading is skipped at the next boot, so a crash can't become a boot loop. Remove its mark file under /var/lib to try again.
  • Reboot rather than unload a driver module to try a new build; a failed unload has left the phone unable to shut down.
  • The clock resets at every boot until the network sets it.
  • Keep the stock Android partitions. The installer writes only BOOT and USERDATA, and the modem needs the rest.

Getting back in

Nothing can leave the phone unbootable, and every layer has a way back. If Arch doesn't come up, the initramfs opens a rescue shell on the same USB network. If the kernel hangs, a watchdog resets the phone into TWRP after 30 seconds. If nothing appears on USB at all, the boot stage resets the phone after ten minutes. And download mode, which can't be overwritten, has everything needed to put the stock firmware back.

ztConflo: other phones

How ztOS leaves the S9.

ztConflo takes a phone's codename and builds a flashable ztOS image for it: Arch Linux ARM with ztMETRO, on a kernel and boot setup that postmarketOS already boots. It looks in the ztOS device registry first and falls back to postmarketOS for phones nobody has ported ztOS to yet. It never ports new hardware.

Eligible phones
135 today, with a mainline aarch64 kernel; 71 of them archived by postmarketOS, and flagged.
GPU check
Phones without a Mesa GPU driver still build, with a warning that ztMETRO won't start.
Registry
One TOML file per phone; a phone moves from untested to boots to tested through a hardware checklist.
Interface
A command line and a terminal UI in ztOS's own look, which installs its tools on first run.

Status and next

Where ztOS is today.

Alpha ztOS 0.1.0 alpha 2 runs daily on one Galaxy S9. The installer's phone path is implemented but not yet validated end to end on a fresh install, and no ztConflo image has booted on another phone yet.
  • The first phone besides the S9 booting a ztConflo build.
  • The sound of calls, and receiving SMS.
  • Suspend on the S9, for idle battery life closer to Android's.
  • Native apps drawing with OpenGL ES the way the shell does, and a ztOS package repository for updates.

See also