Code Journal

How I Started Porting Omarchy to My OnePlus 10 Pro

NOV 16, 2026

Anecdotes
omarchylinuxandroidhardwarekerneldevice treeexperiments

I know Linux as an operating system, but the kernel was always another world. To understand where hardware and software meet, I want to run Omarchy on a OnePlus 10 Pro nobody has ported. Part one: getting everything ready and learning the basics without flashing anything.

I want to run Omarchy, real Linux with no Android underneath, on my OnePlus 10 Pro, a phone nobody has ported. It's my excuse to understand something I'd never stopped to look at: where the kernel and the hardware meet. This first stage was preparation: finding out how far the phone was from running it, unlocking it, getting root without installing anything and writing the first description of its hardware. All without flashing a single partition.

Part one

The story

Why I wanted to run real Linux on my phone

I've always liked understanding why things work the way they do. It's not enough for me that something works: I want to open it up, see what pieces it has and how they talk to each other. A lot of my projects started that way, more out of curiosity than need.

Linux is a funny case for me. I use it every day, on a PC I built myself that runs Omarchy, and at the operating system level I get around fine: packages, services, configuration, the terminal. But the kernel, the part of the system that talks directly to the hardware, is another world, one I don't pay as much attention to as I should. On a computer it's almost invisible: the kernel discovers the hardware on its own, and the problems I ran into were mostly drivers that didn't exist or weren't compatible. I'd never looked at what happens underneath: how the kernel knows what hardware it has, what goes on between pressing the power button and something showing up on screen, where exactly software and chips meet.

The idea came one day while scrolling X. Someone shared Omarchy Mobile: real Omarchy, with Arch Linux and Hyprland, running on a phone with no Android underneath. Not an app, and not a Linux boxed inside Android: the phone booting straight into Linux. And not just any Linux, but the mainline kernel, which is what people call the official kernel maintained by the community, as opposed to the modified version each manufacturer ships on its phones. I found it interesting, but as usual with these projects, limited to Pixel phones and little else. Until I saw a OnePlus on the list, and that gave me a bit of hope.

I had to wrestle with impostor syndrome for a while, but curiosity won and I thought: why not? I have a OnePlus 10 Pro (model NE2215) that isn't new anymore, but it has 12 GB of RAM and 256 GB of storage. That should be enough to run a full operating system without much trouble. That's how this started, and Omarchy on the phone became the excuse: what I'm really after is understanding the guts, everything that makes a piece of hardware and a piece of software end up working together. A phone is a good place for that, because almost nothing there is generic: every model needs someone to describe its hardware piece by piece. Adapting a system to a specific device like that is called a port.

I'm not doing it alone, either. A few months ago I wrote that AI might actually make this the year of Linux, because agents make its exceptions cheaper to diagnose, and a phone is probably the biggest exception there is. So this is also a way to test that: I'm doing it together with Claude Code. I plug in cables, press buttons, make the calls and ask why; the agent reads the repos, writes scripts and explains what shows up along the way. Almost everything I describe here I understood that way, by asking.

Almost everything here is new to me, so the series follows the order in which I found things out, including the ones I got wrong at first. In this first stage I kept to one limit: I didn't flash any partition on the phone: I didn't install the port or write any of the images the phone uses to boot. Its storage did change for other reasons: unlocking it wiped it, and later I installed an app.

Omarchy Mobile's rules for not damaging the phone

The first thing I read about the project was how it avoids breaking the phone, and to understand it I had to learn how a phone is organized inside.

A phone's storage is split into partitions, like a PC's disk, only there are many more: dozens. One holds the system, another your data (userdata), others the modem firmware, the antenna calibration, the program that boots the phone… The ones needed to boot exist twice, in two identical sets called slots A and B. That way Android can update the set it isn't using while it keeps running on the other one.

Omarchy Mobile takes advantage of that. Android stays untouched in one slot, as the way back, and Omarchy uses the other. It never touches the bootloader (the program that runs at power-on, before any system), the modem or the calibration. At boot, before the real system, the kernel loads a minimal system into RAM called an initramfs, and Omarchy Mobile's ships a guard that makes all storage read-only, except for an explicit list of partitions. And before touching anything, the modem gets backed up, because that's where the IMEI (the number that identifies the phone to the cellular network) lives, and it can't be replaced.

It's a project that assumes you'll make mistakes and plans for them. I liked that.

Which parts of my phone the Linux kernel already knows

The heart of a phone is a SoC (system on a chip): a single chip that puts together the processors, the GPU, the modem, the memory and storage controllers and a whole lot more. The 10 Pro's is a Snapdragon 8 Gen 1, which the kernel calls SM8450.

I couldn't find anyone who had ported this phone. But the chip is in mainline: the kernel already knows how to drive the SM8450, because other phones use it, like the Galaxy S22 and a couple of Xperias.

This is where the first important distinction clicked. For the kernel to know what hardware there is, someone has to describe it in a file, the device tree (the next entry is about it). That description is split in two. One part describes what's inside the chip, and it already exists. The other describes what the manufacturer soldered around the chip: the display, the touchscreen, the battery, which voltage each piece gets. That part changes with every phone, and it's exactly the part I have to write. A supported chip doesn't mean the phone boots, but it does mean I'm not starting from absolute zero.

My OnePlus 10 Pro, open on the bench

The kernel already knows the chip, but not what surrounds it.

01/04The phone. A OnePlus 10 Pro with its back cover set aside. Inside you can see the main board with the cameras, the battery and, at the other end, the USB-C port.

Illustration: the layout of the parts is approximate, not an exact teardown of the 10 Pro.

Setting up the PC and building the kernel before touching the phone

On the PC I installed the tools for talking to the phone: adb, which talks to it while Android is running, and fastboot, which talks to the bootloader when the phone is in a special boot mode. Before touching the phone I wanted to check that everything worked, so we built the project's kernel unmodified.

That's where I learned the first thing about the kernel's insides. Every driver can be built into the kernel, available from the very first instant, or as a module, a separate file loaded later. The drivers for the chip's most basic parts were built in; the one for the internal storage, a UFS memory chip, was a module. Since the Arch system was going to live on that storage, I understood that the initramfs would have to load that module before it could open the system. I'd never seen so clearly what an initramfs is for.

What you can learn about an Android phone without root

Then I plugged the phone in and we pulled every bit of information we could without changing anything. Android doesn't give you administrator permissions (that's what root means), so I could only see what the system shows anyone. It was enough for a first confirmation: the storage controller was at the same memory address that the chip's description in mainline declares. What already existed in the kernel described this chip.

A problem came up too. Omarchy Mobile assumes Android lives in slot A and only writes to B. On my phone, Android was running from B: following the recipe to the letter would have wiped the working Android.

And something about the storage I didn't know: a UFS chip doesn't show up as a single disk but as several, called LUNs, and Linux sees each one as a separate disk with its own partitions. On my phone, the boot partitions and userdata live on different disks, and Omarchy Mobile's guard only allows writes on one of them. For it, a partition's name isn't enough: which disk it's on matters too.

Before going further I backed up my photos and documents, because the next step wiped the phone.

Why unlocking the bootloader wipes the phone

From the factory, the bootloader is locked: it only boots software signed by the manufacturer. To boot your own kernel you have to unlock it. I rebooted into fastboot, the bootloader mode that takes commands over USB (on Qualcomm phones, that bootloader is called ABL), and asked it everything it knew about itself.

The important part was that slot A was marked unbootable. When an update installs to the inactive slot and boots fine, the old slot ends up like that. On my phone, the way back is slot B, and A is useless. That settled the earlier question: instead of moving Android, the cleanest option was to flip the rule for this phone and only write to A.

When I unlocked it, the phone wiped itself. It's not arbitrary: the data is encrypted, and the keys depend on the boot being the one the manufacturer verified. If the bootloader let you boot unsigned code without wiping anything, anyone holding the phone could load a modified system and go after your data.

OnePlus ships full updates and incremental patches

The usual way to get root is to modify Android's boot image, the boot.img file, which holds the kernel and a small initial system. I needed the one for my exact version, 1302, and OnePlus doesn't publish it. Claude suggested Oxygen Updater, an app that gives you the official links to OnePlus's updates (the OTAs, for over the air). Once I set it up, I saw that 1302 only existed as an incremental patch, 119 MB, and that the only full version available was 401, from January.

I downloaded both to see whether the patch could take me from 401 to 1302. It couldn't: the patch only applies on top of one exact intermediate version, and 401 wasn't it. The 1302 boot.img doesn't come out of any public update; if I wanted it, I had to pull it off the phone itself, and that required root.

I couldn't install 401 either: going back to an older version is risky because of the chip's fuses, bits that get burned once and can't be reverted, and doing it can brick the phone. 401 stayed as study material. Or, maybe, as something to boot without installing.

Getting root by booting an image in RAM, without installing anything

With an unlocked bootloader, fastboot boot loads an image into RAM and boots it without writing it anywhere. If it doesn't work, you reboot and everything is back. The plan: modify the 401 boot.img with Magisk, the most widely used tool for rooting Android, boot it in RAM and, with root, copy the real 1302 boot.

There was a catch. The keys that encrypt my data are kept by a service called KeyMint, which runs in TrustZone, an isolated area of the processor that neither Android nor Linux can get into. KeyMint refuses to use its keys if the system claims to be older than the last one it saw, so nobody can go back to a version with a known hole. The 401 image said "January"; my keys were from November. Changing a single byte of the image so it said November was enough.

It worked: seconds later I had root, with my data intact. And something surprised me: the old 401 kernel loaded almost all of the manufacturer's drivers from the new version without trouble. I asked Claude how that was possible, and it turns out that since Android 12 Google freezes the interface between the kernel and the manufacturers' drivers (it calls this GKI), precisely so you can swap one without rebuilding the other.

With root I got what I was missing: the hardware description the phone actually uses. It showed that OnePlus built the phone from a Qualcomm test board, exactly which display and touchscreen it has, and that its Wi-Fi is connected over PCIe, the same kind of bus a PC's expansion cards use. On reboot, the phone was back to its usual self.

Writing my phone's device tree with the Galaxy S22's as a template

With all that we could write the description of my board. Not a complete one: the minimum for a first test, what these projects call first light (getting the kernel to boot and show something). The template was the Galaxy S22, whose mainline description is very short, and we filled it in with my phone's data: how the bootloader recognizes it, the borrowed screen (the region of RAM where the bootloader is already drawing, the framebuffer), USB so I could get in from the PC, the buttons, and some pins (GPIO) that belong to TrustZone and that Linux must not touch.

There was one check the project's guide insists you never skip: reserved memory. The chip has several processors besides the main ones, and each uses its own chunk of RAM. If the description doesn't tell the kernel which chunks it can't touch, the kernel uses them too and data gets corrupted without any warning. We compared each of Android's regions against what mainline reserves, and filled the gaps that turned up.

There was a fun surprise in the buttons: in OnePlus's description, the volume-down button is called "volume up". A copy-paste by the manufacturer. What counts is the code it sends, not the name.

What's missing to boot Linux on the phone

A hardware description doesn't boot on its own. I still need to figure out how to hand it to the bootloader: the project's OnePlus 13 found that its bootloader doesn't accept what we need the direct way, and had to use a trick to chain two boots together. The 10 Pro's is a generation older, so maybe that won't be needed. I also need this phone's configuration in Omarchy Mobile and an initramfs that brings up networking and a console over the USB cable. And the first boot of a mainline kernel, RAM only, like the Magisk one.

So far I haven't written a single boot partition: the rest has been reading, comparing, compiling and booting an image in RAM, and I already understand a lot more about what sits between the kernel and the hardware than when I started. Next comes finding out whether the phone agrees.

Part two

Under the hood

The two repositories and the project's compiler

Omarchy Mobile has two repositories: derekross/omarchy-mobile, with the build and install tooling and notes on each phone, and derekross/linux-omarchy-mobile, the kernel, with one commit per subsystem so the changes can be proposed upstream.

Besides adb and fastboot, the PC needed tools to open Android images (simg2img, lpunpack, erofs-utils), dtc to compile and decompile device trees, and payload-dumper-go to extract partitions from OnePlus OTAs. The compiler comes from tools/fetch-toolchain: the exact Android clang every kernel in the project is built with, plus mkbootimg and avbtool, each piece verified with SHA-256.

The build runs inside an Ubuntu 24.04 container:

bash
bin/omamobile kernel

The first two attempts didn't even start: one because the log went to a folder that didn't exist, the other because Omarchy doesn't ship /usr/bin/time. The third took 4 minutes 39 seconds and produced a 15 MB Image.gz, 1,827 modules and the DTBs for the SM8450 boards that already exist. In the final .config:

text
CONFIG_PINCTRL_SM8450=y            # the SoC's pins
CONFIG_SM_GCC_8450=y               # the global clock controller
CONFIG_INTERCONNECT_QCOM_SM8450=y  # the internal buses
CONFIG_SCSI_UFS_QCOM=m             # UFS storage
CONFIG_PHY_QCOM_QMP_UFS=m          # the UFS physical layer

What the capture without root showed

bash
bin/omamobile capture wly-stock

The command saves everything outside any repository, because it includes the serial number, the IMEI and the MAC addresses. It kept stopping halfway: it reads several /proc files in a single cat, Android 15 without root won't let you read /proc/cmdline, the cat fails and set -e aborts everything. We finished the rest by hand.

ItemValueSource
SoCSM8450 (taro to Qualcomm)ro.soc.model, ro.board.platform
CPUs4 × Cortex-A510, 3 × Cortex-A710, 1 × Cortex-X2/proc/cpuinfo
RAM12 GB/proc/meminfo
StorageUFS at 1d84000.ufshcro.boot.bootdevice
SoftwareOxygenOS 15.0.0.1302, Android 15, kernel 5.10.226getprop, uname -r
Active slot_bro.boot.slot_suffix

1d84000 is the same address sm8450.dtsi declares in mainline (ufs_mem_hc: ufshc@1d84000).

The links in /dev/block/by-name showed which LUN each partition lives on: boot_a and boot_b on sde; userdata on sda. Omarchy Mobile's guard only opens sda.

The manufacturer's module list (373 .ko files) had candidates for each piece: three touch controllers (oplus_bsp_tp_ft3658u, oplus_bsp_tp_gt9966, oplus_bsp_tp_tcm_S3910), cnss2 and qca_cld3_qca6490 for Wi-Fi, wcd938x and wsa883x for audio, oplus_chg for the charger and oplus_bsp_kookong_ir_spi for the infrared blaster.

The backup used adb pull -a (which keeps timestamps) instead of MTP: 12,942 files, 2.5 GB, compared folder by folder and with a SHA256SUMS next to it.

What the bootloader answered

fastboot getvar all returned 282 lines. The important ones:

VariableValue
current-slotb
slot-successful:b / slot-unbootable:byes / no
slot-unbootable:ayes
unlocked / secureno / yes
max-download-size768 MiB
battery-voltage~7.66 V

The 7.66 V come from two cells in series, which is what makes fast charging possible (65 W on the NE2215; 80 W on the global model). The OnePlus 13's descriptor already had an OMAMOBILE_SLOT option to choose its own slot.

After fastboot flashing unlock, ro.boot.verifiedbootstate went from green to orange, ro.boot.vbmeta.device_state from locked to unlocked, and the slot and version stayed the same.

What OnePlus updates carry inside

OnePlus OTAs are named after the SHA-1 of their contents, so the name doesn't tell you the version. Their metadata does:

bash
unzip -p OTA.zip META-INF/com/android/metadata
text
version_name=NE2215_15.0.0.401(EX01)
security_patch=2025-01-01

The 1302 incremental says where it starts from: pre-build-incremental=S.2004fbc…. 401 is S.1be1d7a….

Inside each OTA, payload.bin starts with a protobuf manifest: the list of partitions and, for each one, its operations. Claude wrote a minimal reader that decodes that format by hand:

Partition1302 incremental401 full
bootZERO ×90, SOURCE_COPY ×40, BROTLI_BSDIFF ×3ZERO ×71, REPLACE_XZ ×24
vendor_bootZERO ×85, SOURCE_COPY ×14, BROTLI_BSDIFF ×1ZERO ×83, REPLACE_XZ ×12
dtboZERO ×9, SOURCE_COPY ×5, BROTLI_BSDIFF ×1ZERO ×7, REPLACE_XZ ×4

REPLACE_XZ writes compressed bytes as they are. SOURCE_COPY copies blocks from the old version and BROTLI_BSDIFF applies a patch on top of them; each operation carries the hash of the blocks it expects to read, so applying them to a different version fails. The reader's first version used the operation-number table from an older version of the format and showed 90 DISCARD operations in boot; with the right table they were ZERO.

The patch-level byte

A v4 boot.img header has a 32-bit field, os_version: the top 21 bits are the Android version (12.0.0 here) and the bottom 11 the patch level, (year − 2000) << 4 | month:

python
(2025 - 2000) << 4 | 1    # 0x191: January 2025
(2025 - 2000) << 4 | 11   # 0x19b: November 2025

Since the year is the same, only the 4 month bits change, and they sit in the least significant byte. The field is stored little-endian and starts at offset 16 (after ANDROID! and the kernel and ramdisk sizes), so it's byte 17 of the file. cmp -l between the Magisk image and the modified one showed a single difference, at byte 17: 221 → 233, in octal, which is 0x91 → 0x9B; the field went from 0x18000191 to 0x1800019b.

With the bootloader locked, ABL would check boot against its signature in vbmeta and reject it, but that signature had stopped matching once Magisk replaced the ramdisk. Unlocked, ABL just warns. The v4 header carries no checksum of its own.

text
Sending 'boot.img' (196608 KB)   OKAY [  4.380s]
Booting                          OKAY [  0.449s]

uname -r said 5.10.209-android12-9, the 401 kernel, running the 1302 system. 509 of the manufacturer's modules loaded; only oplus_score failed, over three symbols that didn't exist in 209 (Unknown symbol __udp4_lib_lookup). That's the limit of GKI's frozen KMI (android12-5.10): whatever was added later.

What the live device tree revealed

With root, boot_b, vendor_boot_b, dtbo_b and vbmeta_b were copied with a read-only dd, checking the SHA-256 on the phone and on the PC. boot_b carried 5.10.226 with the 2025-11 patch: the exact 1302 boot.img.

/sys/firmware/fdt gave the final device tree (39,213 lines, 3,171 nodes), along with dmesg, /proc/iomem and /proc/interrupts:

text
Machine model: Qualcomm Technologies, Inc. Waipio MTP with PM8010, wly
compatible: qcom,waipio-mtp qcom,waipio qcom,mtp
  • waipio is the SM8450 in Qualcomm's kernel, and MTP its reference board.
  • The command line names the panel: qcom,mdss_dsi_panel_samsung_amb670yf07_1440_3216_dsc_cmd, a 1440×3216 Samsung AMB670YF07 in command mode with DSC compression. Its controller is an S6E3HC3.
  • It also names the touchscreen: synaptics-s3908.
  • The Wi-Fi is qcom,cnss-qca6490: the QCA6490 over PCIe, which ath11k handles in mainline.

The pieces of the first device tree

sm8450-oneplus-wly.dts ended up at 228 lines, with the structure of sm8450-samsung-r0q.dts (145 lines):

  • The IDs for ABL, copied from the live tree:
    text
    qcom,msm-id = <0x1e2 0x20000 0x1c9 0x10000 0x1c9 0x20000 0x228 0x10000 0x1e2 0x10000>;
    qcom,board-id = <0x10008 0x00>;
    
    0x1c9 is QCOM_ID_SM8450 and 0x1e2 is QCOM_ID_SM8450_3; the 8 in 0x10008 is QCOM_BOARD_ID_MTP.
  • The framebuffer, at 0xb8000000 with 0x2b00000 bytes, like the S22. The 1080×2412 resolution came from the mode marked as default in the panel node (fhd_sdc_60).
  • The USB 2.0 PHY, with the same three regulators as the S22: ldob5 (0.88–0.912 V), ldoc1 (1.8 V) and ldob2 (3.072 V).
  • The buttons: power and volume up on the PMK8350's PON block; volume down on GPIO 6 of the PM8350, with a node named vol_up and label = "volume_up" in OnePlus's tree, but linux,code = 0x72 (KEY_VOLUMEDOWN).
  • The reserved GPIOs: stock's qcom,gpios-reserved = <0x1c … 0x27>, which in mainline is gpio-reserved-ranges = <28 4>, <36 4>; (the S22 only reserves 36–39).

For reserved memory, Claude wrote a script that compares the two decompiled reserved-memory sections. Its first version found only 3 stock regions: the regular expression didn't expect labels before each node name (hyp_mem: hyp_region@80000000 {). Once fixed, it found 39 regions and four gaps:

Stock regionGapWhat's going on
slpi_region (sensors)1 MiB at the startOnePlus starts it at 0x87f00000; mainline at 0x88000000
video_region4.5 MiBOnePlus moved the video firmware right where mainline puts rmtfs
device_info_mem32 KiBOnePlus-specific
botloader_mem32 KiBthe bootloader's log

slpi_mem was adjusted, and the video tail and both OnePlus regions were reserved (the bootloader log without no-map, so Linux can read it). Result: 39 stock regions, 44 in mainline, no gaps.

bash
make ARCH=arm64 LLVM=1 W=1 qcom/sm8450-oneplus-wly.dtb
fdtget sm8450-oneplus-wly.dtb / model   # OnePlus 10 Pro

With W=1 there were only two warnings, from the DSI nodes in sm8450.dtsi, shared by every SM8450 board.