Linux on a Calculator: The HP Prime G2 Gets a Full Port

Your graphing calculator might run Doom, but can it run Linux? For the HP Prime G2, the answer is now yes. A developer has updated an old, unsupported Linux port for the device, bringing a working console, X11 server, and even Doom to the 2018 graphing calculator.

The Hardware: Overkill for Math

The HP Prime G2 is a graphing calculator released in 2018. Its specs are absurd for a calculator:

  • CPU: i.MX 6 UltraLite ARM Cortex-A7
  • RAM: 256 MB DDR3
  • Storage: 512 MB internal

That's more powerful than many embedded Linux devices. The developer notes, "It's closer to a small embedded Linux machine with a calculator keyboard attached than to a traditional calculator." For comparison, the TI-84+ CE runs a 48 MHz eZ80, and the Numworks N0110 has a 216 MHz Cortex-M7 with 256 KB SRAM. The Prime G2 outclasses them all.

The Port: From Broken to Bootable

The original port existed with a 4.14 kernel, but it was unusable: the repo had the wrong branch, buildroot failed, the devicetree was messed up, and there was no console login. The developer reconstructed the repos using Software Heritage and got a build working.

Key improvements:

  • Keyboard fix: The original port only sent orange-labeled letters. The developer patched the kernel keyboard driver (imx_keypad.c) to map the ALT key (Alpha) to numbers and special characters like pipe, dash, and underscore.
  • Larger RAM images: The original uuu script maxed out at 15 MB. By changing offsets in the kernel config, uuu, and u-boot, the developer now runs images up to 130 MB.
  • Console login: Configured getty in init scripts to get a login prompt.
  • Touchscreen driver: The developer's unit had a newer Ilitek ILI211X touchscreen controller (the old Goodix GT5688 is out of production). The old kernel lacked a driver, so the developer wrote one based on the newer kernel driver, stripped down to essentials. He also created a calibration tool fbtouch_test.

Running Linux on the HP Prime G2

Want to try it? Here's the process:

  1. Download the pre-built package and uuu tool.
  2. Open the calculator (remove 4 screws, pry open the case).
  3. Connect via USB and short two pads on the board while pressing RESET.
  4. Run uuu ./run_linux_in_ram.uu.

The system boots entirely in RAM, so you don't risk overwriting the original calculator OS. The developer warns: "You might damage it, unrecoverable, not being able to boot into the HP software."

What Works

Once booted, you get:

  • Serial console over USB (the kernel module for usb serial was compiled in to avoid a crash)
  • X11 server with startx launching twm, xeyes, xclock, and xcalc
  • Doom (prboom) at a "great framerate"
  • TCC (Tiny C Compiler) for on-device development

You can compile your own code: tcc hello.c -o hello and run ./hello.

Why This Matters

This port shows how far calculators have come. The HP Prime G2 is essentially a small Linux machine. For developers, it's a fun hack, but it also highlights the security and control issues around modern devices. The developer's philosophy: "Once I buy a device, it is mine and I decide what to do with it. Not the manufacturer."

The Bigger Picture

Other calculators are also Linux-capable. The TI Nspire CX II can run Arch Linux, and the Numworks has an open-source OS (though later firmware is locked down). The HP Prime G2 is unique in its power and the fact that HP hasn't locked it down completely.

Try It Yourself

The developer has published the source code on GitHub:

And a pre-built package is available for direct download.

So, can your calculator run Linux? The HP Prime G2 can. And it can run Doom. That's a win in any developer's book.