Porting Android 12 to the PineNote

April 18, 2022

A few weeks ago, I ordered a PineNote from Pine64. Pine64 is an organization that designs and produces open source hardware, and the PineNote is their first venture into E-Ink tablets. I’ve been interested in some of the newer E-Ink tablets on the market, but having used a Kindle and knowing how poor the e-ink experience can be, I’ve held off until now. However, being able to get an open source one that I can mess around with? That’s something I can get behind. Pine64 makes open source hardware, but most of the software is left up to the community. So in preparation for my PineNotes impending arrival, I decided to download the Android Board Support Package provided by Pine64 and start digging around.

The first thing I noticed after downloading the BSP was that it was a full AOSP (Android Open Source Project) source tree, presumably the one that was used to build the stock firmware for the device. Android uses Google’s repo tool to sync over a thousand git repositories (Most of which are external dependencies) to create the source tree, so I started by taking a look at the repo manifests. Here, I noticed that rockchip (the manufacturer of the PineNotes hardware) only changed a handful of the existing android repos, and mostly added new ones to support their hardware. The image below is the manifest file that contains the repos with e-ink specific modifications:

To make my life a bit easier, I uploaded all of the new and modified repos to a github organization so I could have a prettier git view and not have to deal with the cumbersome 70Gb+ tar file. This wasn’t strictly necessary, but in a source tree this big and complicated, it’s nice to stay organized.

I ended up having to create 70 repos to store the new and modified source code, and an extra one to store my notes.

Rockchip included a script that would generate patches for all of their modifications to the default android repos, but it was dependent on syncing with their AOSP git mirror. A couple modifications to make it compare against the official AOSP git repos (specifically, android-11.0.0_r28 as defined in the manifests) and I was able to generate the patches. Next I copied over all the repos Rockchip added to a local copy of the Android 12L AOSP source tree, created a dedicated device tree to house my PineNote specific changes, and got to building!

Most of my work for the rest of the day was getting the sources to compile. Each time I ran into an error, I would check the corresponding repo form the provided source to see if Rockchip made any changes that might alleviate my problem, and if not I would have to work around it myself. But, with a bit of trial and error, I got the sources to compile! Given that I just slapped the hardware support repos into Android 12L and changed the bare minimum to get it to compile, I doubt this version of Android is going to boot on the first try, and without Rockchip’s EinkService the user experience won’t be anything to write home about, but at this point I’ve done all I can without having a physical device to test on. There’s a long road ahead, getting the device to boot and adding in the e-ink specific framework changes are up next, and after that I hope to work on more e-ink friendly versions of SystemUI, Settings, and other system apps. If you have a PineNote and want to help out, or you’re just interested in what makes this device work, feel free to check out the README I put together here!