Skip to content

Reverse-engineering notes

Most of the facts in this wiki were derived without a public schematic. This page records how they were obtained, so the work can be repeated, checked, or extended. Nothing here requires exotic equipment beyond a host PC, a USB cable, and the phone.

Sources of truth, best first

  1. The stock device tree — panel, GPIOs, regulators, memory reservations.
  2. The stock kernel configuration (if IKCONFIG is embedded) — build choices.
  3. The stock userspace — sensor/camera/audio config and libraries.
  4. On-device reads — chip IDs over I²C/SPI, sysfs, evtest.
  5. Static analysis — boot loader and firmware binaries.
  6. Web / FCC filings — market specs, regulatory IDs, internal photos.

1. Extracting the stock device tree

boot_a is an Android boot image whose kernel is gzip-compressed and followed by a DTB catalog. Decompress the kernel, carve the DTBs, and decompile the XP8 one:

Terminal window
dtc -I dtb -O dts dtb_101.dtb -o stock_xp8.dts

A fresh decompile should match the on-disk bytes. Record the DTB’s SHA-256 so later work is reproducible.

2. Recovering the kernel config

If the vendor built with IKCONFIG, the config is embedded in the kernel image and can be recovered into a .config. It reveals which drivers the vendor compiled in or out — useful for separating real hardware from reference-design leftovers.

3. Extracting the vendor userspace

The system-as-root image is an ext filesystem. Extract it read-only, for example with debugfs:

Terminal window
debugfs -R "rdump / /tmp/vendor-extract" system_a.img

Then read /vendor/etc/camera/camera_config.xml, /vendor/etc/sensors/sensor_def_sonim.conf, mixer_paths_tavil.xml, and the WLAN/NFC config files. Keep the extracted tree private.

4. Reading chip IDs on the unit

To read an I²C/SPI chip ID you need a boot that enables the bus and a small probe program. On a mainline Linux boot:

  • Build a test device tree that enables the target controllers (i2c@c176000, i2c@c178000, i2c@c1b6000, …).
  • Boot it as a one-shot entry, so a bad bus setting cannot brick the default boot.
  • Send only standard query commands, never configuration writes.
  • Power the device under test first (for example PM660L L3 at 2.8 V for the touch controller).

Results from this method on the XP8800: TFA9890 revision 0x0080, the Cypress HID descriptor and system information, and the NXP NCI hardware version 0x51.

A read-only sysfs/procfs collector can capture SoC/PMIC IDs, storage CID, regulators, GPIO state, and deferred probes without touching /dev/mem or performing bus transfers. Omit serial numbers from anything you publish.

5. Static analysis of the boot loader

The ABL is more layered than its filename suggests:

Layer Detail
Outer file ELF32 ARM container (abl.elf)
Payload LZMA blob (e.g. at 0x3078), ~80 KB compressed
Decompressed EFI Firmware Volume (_FVH)
Inside PE32+ EFI application, AArch64 (MZ, three sections)

To analyse it, carve the PE by signature and decompile with Ghidra (analyzeHeadless). A small script can decompile every function to C. On the reference ABL this yielded the complete fastboot command table and the unlock logic (see Bootloader unlock).

Cross-check with radare2 if desired: r2 maps the PE at image base 0x10000, so r2_vaddr = ghidra_addr + 0x10000.

The Firehose programmer is ELF64 ARM with an embedded aarch64 ELF (e.g. at 0x87400); its integrity rests on its SHA-256.

Tooling caveat. floss and capa are x86-only; the aarch64 impapi module is missing, so they cannot analyse these payloads. Use Ghidra or radare2 for ARM/ARM64.

6. Verifying downloaded artifacts

Treat every file from the network as untrusted until its SHA-256 matches a recorded value:

Terminal window
sha256sum FILE

Then, where appropriate:

  • ClamAV for malware (a Firehose blob may trip Heuristics.Broken.Executable — expected).
  • YARA rulesets (e.g. Neo23x0 signature-base, YARA-Rules) for packers, constants, and generic heuristics.
  • jadx / apktool for APK analysis.
  • Ghidra for native binaries.

Keep a trust ledger keyed on SHA-256 + size, with the source, date, method, and verdict, so future work can skip re-analysis when the hash matches.

7. Analysing the stock Android apps

Two shipped apps carry DEX on the reference unit:

  • XP8Updater — network code targets a project update URL; no exec, Runtime, ProcessBuilder, or DexClassLoader.
  • XP8Buttons — uses ServiceManager.checkService reflection to reach the health HAL; no exec/su/network. Several exported activities/receivers are needed for programmable-key broadcasts (a minor hardening note).

All five APKs were signed with the public AOSP test keys.

8. Reading protected registers safely

Some register blocks (for example the aggre2 SMMU) are partly protected by the hypervisor or TrustZone. Reading one bad register can hang the phone. Read one register per boot, from a RAM boot with a one-shot entry, so a hang costs only a power press. On the aggre2 SMMU, offsets 0x00, 0x04, 0x20, 0x24, 0x800, 0xc00 read safely; 0x10 hangs the device.

9. Generating and fixing drivers

  • Panel: linux-mdss-dsi-panel-driver-generator turns the stock DTB panel node into a DRM panel driver. Always clean up the generated draft (see Stock firmware).
  • CPUfreq: the SoC needs a CPRh/OSM driver plus fuse-derived OPP tables; part of the data is in the stock tree, the rest is vendor source.

10. Where to look next

  • FCC internal photos (exhibits under the FCC IDs) are the best remaining source for chip markings: eMMC order code, LPDDR4 vendor, RF front end.
  • Datasheets for parts whose identity is known (see References).