A few days ago, I needed an Android phone for some experiments, so I fished out an old Nexus 5 "Hammerhead" from a drawer where I keep the assorted lengths of wires.
However, it had a pretty outdated Android 6 OS, and some apps refused to install. So I decided to get it a slightly newer LineageOS 14.1 (based on Android 7). Feeling adventurous, I decided to build one myself instead of downloading a ready build (from god-knows-where, by the way).
I used this guide.
Overall, it was surprisingly comprehensive. Still, I encountered a few obstacles, writing them down here for reference.
- libwxgtk3.0-dev was renamed to libwxgtk3.0-gtk3-dev in Ubuntu 20.04
- to access USB devices in WSL, I had to run
adbin tcp bridge mode (see https://github.com/microsoft/WSL/issues/4619#issuecomment-596990676)
Getting the source files in place
- I'm using zsh, and it doesn't normally execute .profile, so my
$HOME/binwasn't included in the path --
repodidn't run. I got lazy and just dropped it in the sources folder, and was punished on one of the next steps: failure to execute
repowas breaking the
breakfastpipeline. Luckily, the error was logged.
- Proprietary blobs for the device: this seemed like a Catch-22 situation; then I realised that I could get those from TheMuppets (https://github.com/TheMuppets/proprietary_vendor_lge/tree/cm-14.1); note the branch in the path.
- TheMuppets repo must be included in the .repo/local_manifests/roomservice.xml like this:
<?xml version="1.0" encoding="UTF-8"?> <manifest> <project name="LineageOS/android_device_lge_hammerhead" path="device/lge/hammerhead" remote="github" /> <project name="LineageOS/android_kernel_lge_hammerhead" path="kernel/lge/hammerhead" remote="github" /> <project name="TheMuppets/proprietary_vendor_lge" path="vendor/lge" remote="github" revision="cm-14.1" /> </manifest>
- After rerunning
repo syncthe blobs were added to the source files.
- The build process was inexplicably failing somewhere around 2%. I ran
prebuilts/sdk/tools, but it wasn't detecting any issues. Neither the jack-server logs had anything of note in them.
- I suspected that jack-server was quietly crashing due to insufficient memory, and did several things at once:
- increased WSL memory limit from 6Gb to 8Gb (my laptop has 16Gb total),
jack.server.max-serviceto 1 instead of 4,
- and upgraded jack-server package as suggested here.
Not sure which exact part was crucial, but after doing this the build went on smoothly.
Loading the firmware
- The TWRP recovery wouldn't start from the bootloader, so I had to use this command:
fastboot boot <recovery.img>instead.
- I had to install the "pico" (smallest) Google Apps package along the OS ROM, otherwise it wouldn't fit in without repartitioning.
The first boot of LineageOS took a while, and I had to reboot it once when it got stuck at "looking for updates" step.
After the initial setup, it has been working pretty well! On with the experiments!