AxionOS is based on the Android Open Source Project (AOSP) with extra performance and some customization features.
This guide will walk you through downloading the source code, setting up the build environment, and configuring your device tree.
First, initialize the repo:
repo init -u https://github.com/AxionAOSP/android.git -b lineage-23.2 --git-lfsThen sync the source code:
repo syncFollow the LineageOS build guide to install the required packages.
Then configure the build environment:
. build/envsetup.shAxionOS builds on top of LineageOS, so you should start from a LineageOS-compatible device tree.
Add this to your device makefile:
TARGET_DISABLE_EPPE := true
$(call inherit-product, vendor/lineage/config/common_full_phone.mk)Optional flags:
- Enable AxionFx
TARGET_INCLUDE_AXFX := true - Enable debugging
(Disabled by default. Meant for debugging purposes - bootloop, aidl/hardware dependency by sepolicy failure, etc)
add in product overrides or set using console: adb shell setprop persist.sys.ax_debug_enabled 1 persist.sys.ax_debug_enabled=1
AxionOS supports custom properties for "About phone" and system optimization.
Set these in your device tree:
# Camera information (multiple sensors supported)
AXION_CAMERA_REAR_INFO := 50,48
AXION_CAMERA_FRONT_INFO := 42
# Maintainer name (underscores become spaces in the UI)
AXION_MAINTAINER := rmp_22
# Processor name (underscores become spaces)
AXION_PROCESSOR := Snapdragon_CPU_1These are automatically exported to system properties at build time.
AxionOS added properties and flags to tune the OS for device experience. You can enable or disable them in your device makefile:
# safely disable libperfmgr without breaking boot (set to true)
TARGET_DISABLES_LIBPERF ?= false
# High Brightness Mode (HBM)
HBM_SUPPORTED := false
HBM_NODE := /sys/class/backlight/panel0-backlight/hbm_mode
# doze flags
# for devices with doze/sensor related issues
TARGET_NEEDS_DOZE_FIX := false
# doze gestures
TARGET_DOZE_TAP_PULSE_SUPPORTED ?= false
TARGET_DOZE_DOUBLE_TAP_PULSE_SUPPORTED ?= false
TARGET_DOZE_PICKUP_PULSE_SUPPORTED ?= false
TARGET_DOZE_SIDE_FPS_PULSE_SUPPORTED ?= false-
Bypass Charging: Allows charging while keeping the battery percentage fixed.
If supported, you must also add a SELinux rule for theinput_suspendnode. -
High Brightness Mode (HBM): Enable if your panel supports a high brightness toggle.
Axion introduces custom but optional power hints which is used by AxDragonite. If not available, fallback powermanager boosts will be used (combination of various powermanager mode/boost).
Adding custom hints example (sm6375): https://github.com/AxionAOSP-devices/android_device_oneplus_sm6375-common/commit/16baba68e7a03a4426ddfa6f83268771c8a8ca94
Ax Kernel Manager configures CPU frequencies, CPU governors, and GPU clocks using sysfs nodes defined in ax_kernel_manager.xml.
If your SoC is not already present in device/axion/common/prebuilts/ax_kernel_manager_$(AXION_SOC).xml, you can create and ship your own configuration in your device tree.
Copy your XML to $(TARGET_COPY_OUT_VENDOR)/etc/ax_kernel_manager.xml (or $(TARGET_COPY_OUT_SYSTEM_EXT)):
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/kernel/ax_kernel_manager.xml:$(TARGET_COPY_OUT_VENDOR)/etc/ax_kernel_manager.xmlThe loader checks /odm/etc, /vendor/etc, /system_ext/etc, and /system/etc in order.
<?xml version="1.0" encoding="utf-8"?>
<kernel-manager>
<!-- CPU clusters -->
<cpu
id="little"
group="Little Cluster"
minId="axion_min_freq"
maxId="axion_max_freq"
governorId="little_cpu_governor"
node="/sys/devices/system/cpu/cpufreq/policy0" />
<cpu
id="big"
group="Big Cluster"
minId="axion_min_freq_big"
maxId="axion_max_freq_big"
governorId="big_cpu_governor"
node="/sys/devices/system/cpu/cpufreq/policy4" />
<!-- GPU (Qualcomm Adreno kgsl or ARM Mali devfreq) -->
<gpu
node="/sys/class/kgsl/kgsl-3d0/devfreq"
currentNode="/sys/class/kgsl/kgsl-3d0/gpuclk"
usageNode="/sys/class/kgsl/kgsl-3d0/gpu_busy_percentage"
frequencyMultiplier="1"
values="255000000,500000000,835000000,1000000000" />
</kernel-manager>-
<cpu>attributes:node: Policy directory (e.g./sys/devices/system/cpu/cpufreq/policy0). Automatically resolves child nodes:scaling_min_freq,scaling_max_freq,scaling_cur_freq,scaling_available_frequencies,scaling_governor, andscaling_available_governors. You can override any node individually (minNode,maxNode,curFreqPath,availablePath,governorNode,governorAvailablePath).id&group: Identifier and UI display name.cpuIds: Core range for metrics (e.g.0-3).minId/maxId/governorId: Settings keys used to persist frequencies and governors (e.g.axion_min_freq,axion_max_freq,little_cpu_governor).
-
<gpu>attributes:node: Base devfreq path. Automatically resolvesmin_freqandmax_freq(overridable withminNodeandmaxNode).currentNode: Active clock path (gpuclkon Adreno,cur_freqon Mali).usageNode: GPU load or utilization path (gpu_busy_percentageon Adreno,utilizationon Mali).values: Comma-separated list of supported frequencies (or setavailablePath).frequencyMultiplier: Set1for Hz (Adreno) or1000for kHz (Mali).
Because system_server applies frequency and governor values at runtime, sysfs nodes must be writable:
init.<device>.rc:on post-fs-data chown system system /sys/devices/system/cpu/cpufreq/policy0/scaling_governor chown system system /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq chown system system /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq chmod 0660 /sys/devices/system/cpu/cpufreq/policy0/scaling_governor chmod 0660 /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq chmod 0660 /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq- SEPolicy: Grant
system_serverread/write access to CPU and GPU sysfs nodes (e.g.sysfs_devices_system_cpu,vendor_sysfs_kgsl,vendor_sysfs_devfreq).
If no XML is provided, Ax Kernel Manager automatically falls back to discovering CPU policies under /sys/devices/system/cpu/cpufreq/ and GPU nodes under /sys/class/kgsl/ or /sys/class/devfreq/.
Run once before building:
gk -sTo configure your device build:
axion <device_codename> [user|userdebug|eng] [gms|pico|core|full|va]Build type defaults to userdebug if omitted.
GMS variants:
gms/full→ Full Google Mobile Servicespico→ Minimal Google Mobile Servicescore→ Core Google Mobile Servicesva/vanilla→ Non-GMS build
Optional GMS package flags:
# Telecom-related Google apps/services bundle.
# Defaults: false for pico, true for core/gms.
TARGET_INCLUDE_GOOGLE_TELECOMM := true/false
# Google setup/partner setup bundle.
# Defaults: false for pico/core, true for gms.
TARGET_INCLUDE_PARTNER_SETUP := true/falseThese flags are overridable from your device/product makefile. For example, use
TARGET_INCLUDE_GOOGLE_TELECOMM := true to include the telecom bundle on pico,
or TARGET_INCLUDE_PARTNER_SETUP := false to exclude setup packages from core/gms.
If no GMS variant is specified, axion defaults to a non-GMS build.
The build flavor shown in the output zip/version is one of:
GMSPICOCOREVANILLA
Example:
axion panther gms
axion panther pico
axion panther core
axion panther vaaxion has scripts for writing flags without needing to add flags to tree
writeFlag TARGET_INCLUDE_GOOGLE_TELECOMM false
removeFlag TARGET_INCLUDE_GOOGLE_TELECOMM
clearFlags -- removes all flags written via writeFlagTo update your source after the first sync:
axionSyncFinally, compile:
ax -br -j<count>Replace <count> with the number of CPU threads you want to use (e.g. ax -j16).
AxionOS is based on the work of the Android Open Source Project (AOSP) and LineageOS.
Thanks to all contributors for their hard work.