Pinnacle
Blog

Pinnacle on the Fairphone 4

Until 2 December Pinnacle had only run in QEMU. Two days later it runs on a Fairphone 4, with touch, Bluetooth, Wi-Fi to the internet and sound from the loudspeaker. The phone is the test of a process in which AI agents write phone software, try it on the device and improve it, round after round.

Agents and a software factory

Pinnacle tests how fast phone software can be written by AI agents. Drivers for a phone's chips have taken large teams years to write. Here an agent writes a driver, tries it on the phone, reads what goes wrong and changes it, round after round, until it works. A person chooses what to work on and decides what goes in.

The agents work in Midas, a software factory built for this. It gives each session a build machine, a way onto the phone and the checks a change must pass before it goes in, and runs many sessions at once. The Fairphone 4 is the first real phone the process was tried on: in two days it went from a logo that would not go away to a phone with Wi-Fi and sound.

The phone on the table

The Fairphone lies on the dining table, on a USB cable to a Mac mini, under a webcam on a wooden stand. The AI agents that write Pinnacle work in sessions in Midas, where Cartopolis is made too. The Mac mini runs Midas's bench, through which a session reaches the phone.

The webcam is for what the phone cannot say itself: a screen that stays black, a logo that does not go away, colours that come out wrong.

A webcam on a home-made wooden stand, clamped to a table, looking down at the place where the phone lies
The webcam on its stand, clamped to the table.
The webcam's view from above: the Fairphone on the table showing Pinnacle's home screen, a mouse and a hand beside it
What the webcam sees: the home screen.

On the cable Pinnacle shows up as two serial ports: one with the kernel's log from its first line, one that takes commands. Through that second port a session asks for a screenshot, taps, swipes and types, and sends a new kernel, which runs fourteen seconds later. The phone does not need a hand for any of it, only when it is off.

Pinnacle's home screen on the Fairphone: fifteen apps under the Pinnacle mark, mountains behind them
The home screen, read from the phone over USB.
Settings on the Fairphone: name, hardware, disks, remote access, agent, updates, devices, date and time, keyboard
Settings.
The Energy app on the Fairphone: 2.30 W used from the charger, a graph of the last two minutes, and the battery's voltage and state
Energy, on the charger.

A session

The loop is what is being built, as much as the software. Each time a try needed a hand, the next work went into taking that hand away: the log over USB, the control port, a restart straight into fastboot.

A session starts with one line, typed on a phone, such as "can you get Bluetooth working on the Fairphone?". The agent finds how the chip is driven, writes the driver, sends it to the phone, reads the log, and tries again until the chip answers. Several sessions worked at the same time, the modem, the graphics chip and Bluetooth each in their own, and took turns on the one phone. Before a change goes into Pinnacle its tests run in QEMU; on the phone the kernel tests itself at every start. At the end a session reports what it did and what it measured, and asks whether it may land.

A Midas session on a phone: the report of the session that made the Energy app, with what the phone uses with the screen on and off
The end of a session in Midas: the Energy app, and what the phone uses with its screen on and off.

The first day

The first tries ended on the Fairphone logo. After a restart the phone's bootloader had switched to its second system, whose leftovers stopped every image sent to it. Switching back before each start fixed that.

Then the kernel ran, and the screen stayed black. The screen reads the fourth byte of every pixel as how opaque it is, and Pinnacle left it at zero; the display also reads past the processor's caches, so what was drawn has to be written out first. After that the log appeared. Writing to memory above a certain address stopped the phone without any error, so Pinnacle now uses 522 MB of the 8 GB. On the morning of 3 December the home screen came up.

The Fairphone 4 on a table, showing the Fairphone logo, with coloured stripes drawn over parts of the screen
An early try: the Fairphone logo stays, and only stripes of Pinnacle's colour test show through.
The phone's screen full of Pinnacle's boot log, each self-check ending in ok
The boot log, one self-check after another.
The phone's screen in four bands from dark blue to white, under a few lines of log
The display's self-check.

What works now

In two days the loop brought up the screen, touch, Wi-Fi, Bluetooth, sound, the battery and the modem, mostly without a hand on the phone. It still needs one for a phone that is off, and for a driver that stops the phone so hard that its USB goes too: sound did that three times before it worked.

  • Touch, two-finger scrolling, the power and volume buttons, and an interface drawn at the size this dense screen needs.
  • Wi-Fi joins a WPA2 network and reaches the internet. Bluetooth lists the devices around.
  • Apps play sound through the two loudspeakers.
  • The battery and charger, with the Energy app; a short press on power locks the phone and turns the screen off.
  • The graphics chip copies each frame to the screen.
  • The modem starts and finds the mobile network.

The modem, Wi-Fi, Bluetooth, the graphics chip and the sound processor run Qualcomm's closed firmware, which Pinnacle loads; the drivers around it are Pinnacle's own, in Rust.

Not yet

It starts from the computer each time and keeps nothing at the next restart. It uses 522 MB of the 8 GB. No calls, text messages or mobile data, no microphones, earpiece, cameras or GPS. To try it you need a Fairphone 4 with an unlocked bootloader (unlocking wipes it); the steps are in docs/hardware.md in Pinnacle's source.