Build Droidian
Documentation to build Droidian, and everything else needed, from source for enchilada (OnePlus 6 A6000) based on Android 9 / LineageOS 16 / OxygenOS 9 / Halium 9. Once I get this working I will try to use Android 11 / Halium 11 to see if it is possible.
For what I have read, this device should be easy to port as there is great linux support for the Snapdragon 845 in mainline Linux.
I will give tips, sources and suggestions for other devices.
I will try to document every step with sources and insight, but some sources are going to be me interpreting 10 different sources and making changes until something works :)
Documentation
Terminology
- Halium: project to unify the Hardware Abstraction Layer for projects which run GNU/Linux on mobile devices with pre-installed Android
- libhybris: use bionic-based HW adaptations in glibc systems
- BioniC: C standard library used by Android
- glibC: C standard library used by Linux
- musl: C standard library used by Alpine Linux (PostmarketOS)
- DT (Device Tree): It’s a description of the hardware (CPUs, memory, buses, GPIOs, sensors, etc.) given to the kernel
- DTS (Device Tree Source):
- DTB (Device Tree Blob): Compiled binary form of a DTS file
-
DTBs (plural)
dts/ → Source tree inside the kernel (e.g., arch/arm64/boot/dts/qcom/enchilada.dts).
.dtb → Compiled from .dts, ends up in arch/arm64/boot/dts/qcom/*.dtb.
dtbs → The collection of all .dtbs bundled together (often packed into boot.img).
dtbo.img → Separate partition/image containing overlays. Built from .dts overlays.
vbmeta.img → Separate image for AVB verification, usually created by avbtool.
Files needed
- Debian sources
- Device sources/tree/blobs/kernel
- Device manifest for Halium
- Halium sources
- Droidian
- Patience
Linux kernel source
You can find them from the manufacturer, LineageOS, custom roms in XDA and other mobile Linux distros like UBPorts and PostmarketOS.
OnePlusOSS/android_kernel_oneplus_sdm845
LineageOS/android_kernel_oneplus_sdm845
What are the differences between the 3?
git clone --depth=1 -b oneplus/SDM845_P_9.0 https://github.com/OnePlusOSS/android_kernel_oneplus_sdm845 OnePlusOSS
git clone --depth=1 -b lineage-16.0 https://github.com/LineageOS/android_kernel_oneplus_sdm845 LineageOS
git clone --depth=1 -b halium-9.0 https://gitlab.com/ubports/porting/community-ports/android9/oneplus-6/kernel-oneplus-sdm845 ubports
diff --brief --recursive dir1/ dir2/
diff --brief --recursive dir1/ dir2/ | grep ^Only
UBPorts kernel is the same as LineageOS but with some modification for apparmor and a few other things. Here you want the one that works, Lineage or UBPorts. I will use the UBPorts kernel for the first build.
Device vendor sources
OnePlusOSS/android_vendor_oneplus_SDM845 I think these are the vendor sources but there is barely anything here and the branch looks like it is for Android 9. Maybe that is why everybody uses Halium 9?
TheMuppets/proprietary_vendor_oneplus_enchilada
Extracting proprietary blobs from LineageOS zip files
Device tree / configuration
LineageOS/android_device_oneplus_enchilada
https://github.com/LineageOS/android_device_oneplus_sdm845-common/blob/lineage-18.1/lineage.dependencies
ubports/oneplus-enchilada-fajita
Device manifest for Halium (WIP)
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- Device configuration -->
<remote name="OP3-halium-9"
fetch="https://github.com/OP3-halium" />
<remote name="OP3Treble"
fetch="https://github.com/OP3Treble" />
<remote name="los"
fetch="https://github.com/LineageOS" />
<project path="kernel/oneplus/msm8996" name="android_kernel_oneplus_msm8996" remote="OP3-halium" revision="halium-9.0" />
<project path="vendor/oneplus" name="proprietary_vendor_oneplus" remote="OP3Treble" revision="lineage-16.0"/>
<project path="device/oneplus/oneplus3" name="android_device_oneplus_oneplus3" remote="OP3-halium" revision="halium-9.0"/>
<project path="device/oppo/common" name="android_device_oppo_common" remote="los" revision="lineage-16.0"/>
</manifest>
Environment
I created a Debian VM with 16GB of RAM, 400GB or disk, 8 vCPU. Installed Debian 12 and will not use docker. Debian 13 does not have all the packages you need.
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install git gnupg flex bison gperf build-essential \
zip bzr curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw-w64-i686-dev tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool \
repo liblz4-tool bc lzop imagemagick libncurses5 rsync
Error: Package 'libgl1-mesa-glx:i386' has no installation candidate Error: Unable to locate package python-markdown Error: Unable to locate package repo Error: Package 'liblz4-tool' has no installation candidate Error: Unable to locate package libncurses5
Prepare files
mkdir enchilada && cd enchilada
git clone https://github.com/droidian-images/droidian.git
git clone --depth=1 -b halium-9.0 https://gitlab.com/ubports/porting/community-ports/android9/oneplus-6/kernel-oneplus-sdm845
git clone --depth=1 https://gitlab.com/ubports/porting/community-ports/android9/oneplus-6/oneplus-enchilada-fajita