Running Android 17 on the Google Pixel 3a via LineageOS 24.0
A technical guide to porting the latest Android release onto legacy 4.9 kernel hardware.
1Project Overview and Goals
This project successfully boots Android 17, via LineageOS 24.0, on the Google Pixel 3a. The device, codenamed sargo, relies on an original 4.9 Linux kernel. The primary objective is to keep older hardware functional and secure, preventing premature electronic waste by running the latest operating system release on existing kernel infrastructure.
2System Requirements and Setup
Building the 24.0 tree requires a machine with significant resources, as the source tree occupies 266 GB of storage. The build process utilizes an i7-3770 processor with 31 GB of RAM. Developers must have an unlocked bootloader, adb, fastboot, and the specific local manifest provided in the project release documentation.
3The Role of /init Logger
A custom 4 KB static /init logger is essential for debugging the boot process. It captures kernel logs and logcat output to the metadata partition, which is limited to 10 MB. This tool allows developers to identify why a boot sequence hangs, facilitating rapid iteration and testing of various system patches.
4Kernel Fix for Stability
A critical kernel fix was implemented to address a cgroup BPF reference count issue. Before applying kernel commit e7a12e10fc29, two out of nine boot attempts failed due to hangs. After ensuring the reference count was correctly handled during socket cloning, the system achieved a perfect success rate across eight consecutive boot tests.
5Addressing Gralloc Limitations
Android 17 requires newer IMapper 4.0 interfaces, but the sdm845 display stack only provides IMapper 2.1. To resolve this, the build utilizes the LEGACY_GRALLOC flag in the Soong configuration. This allows the system to fall back to older paths, ensuring the display stack remains compatible with the legacy hardware's graphics memory allocator.
6Fscrypt Keyring Implementation
Because the 4.9 kernel lacks the FS_IOC_ADD_ENCRYPTION_KEY feature, file encryption keys must be managed via a session keyring. The port includes forks in system/core and system/vold to restore this functionality. These changes ensure that init and vold can correctly handle encryption keys without requiring a factory reset of user data.
7BPF and Network Stack
Android 17 expects a 5.10 kernel for BPF programs, causing failures on the 4.9 kernel. The project uses forks in system/bpf and Connectivity modules to bypass these requirements. By marking critical programs as non-critical and skipping missing ring-buffer listeners, the system successfully initializes the network stack despite the kernel version mismatch.
8UEVENTD and Device Nodes
The port addresses permission issues with device nodes like /dev/qseecom and /dev/kgsl-3d0. Android 17’s ueventd only parses /system/etc/ueventd.rc, ignoring older vendor locations. By moving installation rules to the correct vendor/etc directory, the system ensures that essential hardware components receive the necessary permissions to function correctly under the new Android security policy.
9Native App Zygote Adjustments
Chrome renderers failed because the Android 17 zygote attempts to drop capabilities that the 4.9 kernel does not recognize, resulting in EINVAL errors. The project includes a fork in system/zygote that skips these unknown capabilities. This modification allows the zygote to start correctly, enabling sandboxed renderers to function as intended.
10Managing Google Apps APEX
MindTheGapps 17.0.0 uses APEX packages with the EROFS filesystem, which the 4.9 kernel cannot mount. The solution involves a repack-gapps.sh script that installs these as standard APKs in /product/priv-app. Post-install scripts are then required to grant runtime permissions, as Play Services otherwise fails to request location access on a fresh installation.
11Updating Without Data Loss
The update_engine is configured to install full builds into the inactive slot, preserving user data on the /data partition. Users can sync, build, and sideload updates using provided scripts. After the update, a manual step in recovery is required to accept the test-key signature warning before the system boots successfully.
12Final Results and Impact
The Pixel 3a now boots LineageOS 24.0 in 83 seconds with SELinux enforcing. All core features, including Wi-Fi, Bluetooth, and sensors, are fully operational. This project demonstrates that legacy devices can remain viable for years beyond their official support window through targeted kernel backports and careful platform-level modifications.