Blog · Varifocal
Bringing up LineageOS 24.0 on the Galaxy A12
What broke when moving the Exynos 850 Galaxy A12 (SM-A127F) onto Android 17, from N23 camera sensors and HWC3 brightness paths to shipping a clean user build.
Getting Android 17 onto a 2021 budget Samsung phone running a 4.19 kernel takes less magic than people assume, and far more deleting of old hacks. Most of our time on LineageOS 24.0 for the Galaxy A12 (SM-A127F, codename a12s) went into stripping out bring-up shortcuts that broke once SELinux went enforcing and the build switched from userdebug to user.
If you maintain an older Exynos 850 tree or want to know what sits behind release-4, these notes walk through the three real blockers we hit, the wrong turns along the way, and the upstream LineageOS Gerrit changes that came out of it.
Release 4 build baseline
- Device
- Samsung Galaxy A12 (SM-A127F / a12s)
- SoC / Kernel
- Exynos 850 (universal3830) · Linux 4.19.325
- ROM
- LineageOS 24.0 (Android 17, SDK 37)
- Build type
- user · SELinux enforcing · 1.06 GiB zip
- Vendor SPL
- 2024-10-01 (stock A127FXXSDDXJ5 blobs)
- Recovery
- LineageOS 24.0 Recovery (recovery.img)
Switching the camera stack to N23
Section titled “Switching the camera stack to N23”The first big snag was the camera provider refusing to enumerate sensors after moving a12s-common (ab339f8) onto the LineageOS 24.0 hardware/samsung_slsi-linaro/camera N23 HAL and AIDL Codec2. The a12s uses four sensors: S5KGM2 (main), SR846 (front), GC5035 (ultrawide), and GC02M1 (macro/depth). When vendor.camera.provider probed the ultrawide and front cameras on exynos3830, the HAL hit an assertion because the sensor info tables had no entries for GC5035 (sensorId 210) or the a12s front module layout.
Why it failed
Section titled “Why it failed”The shared exynos3830 N23 camera code in hardware/samsung_slsi-linaro/camera only registered sensor metadata for devices already shipping on that HAL. Without a matching ExynosCameraSensorInfo class, createExynosCameraSensorInfo() aborts the provider process on startup before cameraserver can register even the working rear main sensor. Zero cameras show up in dumpsys media.camera.
How we fixed it
Section titled “How we fixed it”We added dedicated ExynosCameraSensorGC5035 sensor metadata and separate front sensor info structs (ExynosCameraSensor4HAFront and ExynosCameraSensorSR846Front) directly in hardware/samsung_slsi-linaro/camera, then shipped those as upstream patches rather than hiding them in prebuilt binaries. On the first Gerrit review round, a maintainer rightly pointed out that a generic setFrontLensInfo() helper obscured which sensor owned which lens values, so patchset 2 split them into explicit structs.
Both changes are live on LineageOS Gerrit:
- 515964 adds
GC5035sensor info forexynos3830. - 515965 adds the
4HAandSR846front sensor definitions.
Once both landed in the build, vendor.camera.provider stayed up with zero restarts and all four cameras enumerated cleanly.
Cleaning up the HWC3 brightness error path
Section titled “Cleaning up the HWC3 brightness error path”Display brightness looked broken early in bring-up, and my first instinct was wrong. I chased aftermarket panel workarounds in the kernel and cached brightness values during HWC3 setPowerOn, which masked the real bug for a day and left weird dim-state transitions on wake.
What actually went wrong
Section titled “What actually went wrong”Inside hardware/samsung_slsi-linaro/graphics (libhwc2.1, ExynosDisplay), two things tripped on the brightness sysfs write path:
- Passing a negative float into a
uint32_tbrightness conversion triggers C++ undefined behavior instead of clamping cleanly. - When the sysfs stream hits
-EIO(which happens briefly around panel power transitions),std::ofstreamsets its failbit and stops writing subsequent brightness changes unlessmBrightnessOfs.clear()runs on the error path.
Patchset 1 of our Gerrit commit blamed UINT32_MAX wraparound on arm64, which reviewer feedback caught right away. Checking the actual arm64 conversion showed the real issue was the UB plus the uncleared stream failbit.
The clean fix
Section titled “The clean fix”We reverted the aftermarket kernel display overrides (f60b1b359), dropped the HWC3 setPowerOn caching workaround (2068781), reverted the device brightness overlay overrides (4ef9626), and fixed the error path directly in ExynosDisplay (Gerrit 515963). Stock panel curves came back on their own.
Moving from bring-up to a Charter-compliant user build
Section titled “Moving from bring-up to a Charter-compliant user build”A booting userdebug zip is half the job. Turning it into something you can hand to other people, and eventually submit upstream, meant auditing every shortcut we took while chasing bootloops.
Here is what came out of the tree before tagging release-4:
# What actually had to leave device/samsung/a12s and a12s-common:# - permissive SELinux kernel cmdline + WITH_ADB_INSECURE (100f975)# - bundled TEE blobs and duplicate fstab leftovers (81813a4)# - TARGET_UNOFFICIAL_BUILD_ID override (5b30d95)# - gralloc3 compat handle (replaced by native gralloc4 Mali r38p1 in 6761a21)On the common tree (8874633), we synced proprietary-files.txt to all 178 blobs extracted from stock A127FXXSDDXJ5, regenerated setup-makefiles.py so anyone can reproduce the vendor repo without manual edits, set VENDOR_SECURITY_PATCH to 2024-10-01, and wired both camera and codec2 into lineage.dependencies. We also switched the notch cutout and status bar height back to the stock A127F center cutout (7a8dd87) with symmetric corner padding (76b1581).
The rest was mostly verification. On the final user build (ro.build.type=user, ro.debuggable=0, ro.adb.secure=1), recovery.img flashed cleanly via heimdall --RECOVERY and sideloaded the 1.06 GiB ROM zip without touching any bootloader or radio partition. Still waiting on Gerrit review for the three hardware CLs, so lineage-24.0 currently carries them as local patches in the tree.
Trade-offs and current limits
Section titled “Trade-offs and current limits”Because release-4 is a clean user build without Google Apps, you get fast boot times and plenty of breathing room on 4 GB of RAM, though anyone who relies on Play Services has to sideload a GApps package separately or run microG. Keeping the kernel strictly Charter-compliant (android_kernel_samsung_exynos850) also means no built-in root or out-of-tree hacks here; that work moved to a separate repo (a12s-dev/muru).
Key takeaways
Section titled “Key takeaways”- Fix sensor tables and HWC3 error paths inside
hardware/samsung_slsi-linaro/{camera,graphics}rather than stacking kernel or overlay workarounds on top. - Audit
device/repos for leftoveruserdebugflags (WITH_ADB_INSECURE, permissive cmdline, stray prebuilts) before switching touserbuilds, becauseuserenforces rules thatuserdebugquietly forgives. - Keep
proprietary-files.txtandsetup-makefiles.pyreproducible against one named stock firmware (A127FXXSDDXJ5), so vendor updates stay verifiable instead of turning into mystery dumps. - Never flash
BL,CP,CSC,PIT,PARAM,EFS, orMODEMduring bring-up; keep a testedrecovery.imgas your lifeline.
Try LineageOS 24.0 on your A12
Section titled “Try LineageOS 24.0 on your A12”Grab the signed user build, LineageOS 24.0 recovery, and SHA-256 checksums from the release page, then follow the Galaxy A12 install guide.