What Happens in My Phone Between the Power Button and Android
A Qualcomm boot chain, A/B slots, the storage's LUNs and what protects all of it, told through what I found on my OnePlus 10 Pro before writing a single partition.
In the first entry the bootloader showed up as "the thing you have to unlock". But when I started the port I ran into a bunch of loose pieces: Android running from slot B, slot A marked unbootable, the boot partitions on a disk the project's guard won't write to, a byte that decides whether my data gets decrypted, and a counter in fuses that only goes up. They're all parts of the same machine: how a modern Android boots and what protects it. Before writing any partition I wanted to understand it, because that's exactly where Omarchy is going to plug in. And because it's exactly the question that got me into this: what happens between pressing the power button and something showing up on screen.
A phone boots in four stages before reaching Android
I thought of "the bootloader" as a single program. On a Qualcomm phone it isn't: booting happens in stages, and each one loads the next.
- PBL (Primary Boot Loader). It's burned into the chip's ROM, a memory written only once, at Qualcomm's factory. It doesn't live in any partition and can't be changed.
- XBL, in the
xblpartition. It gets the RAM ready, since at power-on it isn't even usable, and loads the security software that runs in TrustZone, the isolated area of the processor I mentioned in the previous entry. - ABL, in the
ablpartition. This is the bootloader I already knew: the one that shows fastboot mode, unlocks, switches slots and writes the boot partitions. It surprised me that inside it's a UEFI application, the same kind of firmware that boots a PC. - The kernel, from the
bootpartition, along with its device tree, which ABL assembles from several pieces as I described in the previous entry. - Android, which mounts its system partitions and decrypts
userdata.
There's one more fastboot, and it confused me at first. Android's system partitions (system, vendor and friends) aren't regular partitions: they live grouped inside one big partition, super, and ABL doesn't know how to write inside it. For that, Android has a second fastboot, fastbootd, which runs as a regular program inside recovery mode, with a Linux already booted.
Each stage checks the next one's signature
The important part isn't the order but that every stage verifies the next one before handing over control. The PBL checks XBL's signature against a key whose fingerprint is burned into the chip's fuses. XBL checks ABL. ABL checks the boot images. It's a chain of trust that starts somewhere nobody can modify.
Unlocking the bootloader only loosens the last link: ABL stops requiring boot to be signed. XBL and ABL still have to be signed by OnePlus, and that never changes. That's why Omarchy Mobile is forbidden from writing the bootloader: there's no way to sign your own, and if XBL or ABL breaks there's no fastboot left to fix it. There's still an emergency mode in the PBL (EDL) that lets you rewrite the phone over USB, but only with a program signed by the manufacturer, and OnePlus doesn't publish it.
ABL does its checking with AVB (Android Verified Boot). The vbmeta partition holds the signatures of the boot images and what's needed to verify what's inside super. The result of the check is a color:
| State | What it means |
|---|---|
green | Locked, everything signed with the manufacturer's key. |
yellow | Locked, but with a custom key installed. |
orange | Unlocked: ABL warns you and boots whatever it's given. |
red | Verification failed. |
My phone went from green to orange when I unlocked it. The warning that shows up on every boot is ABL saying, literally, that it no longer vouches for what comes next.
Why a phone won't let you go back to an older system version
A chain of trust is useless if someone can install an old, signed version with a known security hole. That's what rollback protection is for (rollback meaning going back), and I ran into two kinds.
The first lives in KeyMint, the service that keeps keys in TrustZone. ABL passes it the patch level from the boot header, and KeyMint refuses to use its keys if that level goes down. That's the one that nearly locked me out of my data when I booted version 401's boot in RAM: I had to change one header byte so it said November 2025. That protection could be sidestepped because, with the bootloader unlocked, nobody checks the header's signature.
The second sits lower and can't be sidestepped: the counter in the chip's fuses, which goes up with certain bootloader updates. A blown fuse can't be "unblown". If an old bootloader boots with the counter already higher, the phone can end up bricked. That's why the full 401 update I downloaded is never going to be installed.
Phones keep two copies of the boot images to update safely
Almost every boot partition exists twice: boot_a and boot_b, abl_a and abl_b, and so on. An update always goes into the inactive slot while the phone keeps running on the other one. On reboot, ABL tries the new slot; if Android comes up fine, it marks it successful. If it fails several times in a row, it falls back to the previous one. That way a broken update doesn't leave you with a dead phone.
That explains what I saw in fastboot getvar all: Android on B, marked successful, and A marked unbootable. Every update switches slots, and the last one left Android on B.
When I saw that flag, I assumed slot A held the leftovers of an older Android version. Reading up on how this works on my phone, I think I overstated what's there. The phone uses a variant called virtual A/B, where the system partitions inside super aren't stored twice. An update writes only the differences against the current system (a differential copy, or snapshot), and once it boots fine it merges them into a single copy. If I understood it right, the only complete pieces left in slot A are the boot partitions that do have two copies (boot_a and the rest), not a whole system. I haven't checked it on my phone; an Android tool that lists what's inside super should tell me. But it changes how I see it: A isn't an old Android waiting around, it's a gap with a few loose images. For what I want, that's free space for the port's images. What I still don't know is what ABL will do with the unbootable flag when I try to boot from there; that question stays open.
There's one partition with no slots: userdata. There's only one, and it holds everything that makes the phone mine: apps, settings, photos, accounts. Omarchy uses it for the Arch system, so whatever is there is lost when it's installed. Slot B isn't touched, so Android would still boot; but going back to it, it would find a userdata that isn't its own anymore and would probably ask to start from scratch, like a freshly unlocked phone. The project's way back is an Android that boots, not my data or my settings. Only a backup protects those, like the one I made before unlocking.
The phone's storage is split into several disks
In the first entry I mentioned that the storage chip shows up as several disks, the LUNs, and that Linux sees each one separately (sda, sdb…). With booting in mind, I understood what they're for. Each LUN has its own partition table, and Qualcomm uses them to keep functions apart: data and the system go on one, almost everything for booting on another, the modem's things on another.
The most curious ones are two tiny LUNs, each holding a single thing: one of the two copies of xbl. The reason is in the first stage. The PBL, the one in ROM, doesn't search the whole storage: it looks for the next stage on a LUN marked for booting, and the UFS standard reserves room for two of those. That's why each slot has its xbl on its own LUN, and the PBL boots the one for the active slot.
For any rule along the lines of "everything read-only except this partition", this matters: you need to know which disk each thing lives on.
My OnePlus 10 Pro's storage, by LUN
How the partitions are spread across the storage.
- sda
- super
- userdata
- persist
- sdb
- xbl_a
- sdc
- xbl_b
- sde
- abl_a
- abl_b
- vbmeta_a
- vbmeta_b
- boot_a
- boot_b
- vendor_boot_a
- vendor_boot_b
- dtbo_a
- dtbo_b
- sdf
- modemst1
- fsg
Five of the storage's LUNs, with some of their partitions. Linux sees each LUN as a separate disk.
Only some of the partitions; there are many more. Each slot keeps its XBL on a different LUN, and the PBL boots the active slot's one.
In the figure, persist is the partition with the phone's calibration, and modemst1 and fsg hold the modem's configuration, IMEI included. Those are the ones that are never touched.
The guard in Omarchy's initramfs makes everything read-only except an explicit list of partitions, and by default it only considers the ones on sda. That's where userdata lives, so for the Pixels it's enough. On my phone, boot_a, vendor_boot_a and dtbo_a are on sde, and from Linux they'd be locked.
My first reaction was that opening sde would be dangerous, because abl and vbmeta live there too, exactly what must not be touched. Reading the initramfs boot script, it turns out the guard doesn't open whole disks: each phone's configuration can add another LUN to it, and it checks that LUN partition by partition, just like sda, only allowing writes to the ones on the list. abl and vbmeta would stay read-only. The project's OnePlus 6 already plans it that way for when it installs to its slot B.
Unlocking the bootloader only opens the last boot stage
The unlock, the boot in RAM and the header change I described in the first entry all happen at the last link of the chain, between ABL and the kernel. The earlier links never noticed. I like it that way: the part that can't be fixed is still out of my reach.
I have questions left for when it's time to install. What does ABL do if I ask it to boot a slot marked unbootable? Is it enough to ask it to switch slots, or do I need to write something working there first? For now the plan is the same: boot in RAM, flash no partition, until the phone tells me it's worth it.