Storage Layout & super Dynamic Partition Orchestration
Before modifying any boot image on an ARM64 A/B device, map out how physical boot partitions and super logical partitions fit together. Good storage planning guarantees fast rollback and protects device calibration partitions.
1. Physical Boot Partitions vs super Dynamic Partitions
Modern Android GKI 6.x A/B devices split storage into two tiers:
- Physical A/B Boot Partitions:
boot_{a,b}: Linux GKI kernelImage.init_boot_{a,b}: Generic first-stage ramdisk and PID1/init.vendor_boot_{a,b}: Vendor ramdisk, early.kokernel modules,bootconfig, and earlyfstab.dtbo_{a,b}: Board DeviceTree overlay table.recovery_{a,b}(optional): Dedicated recovery partition on devices that do not pack recovery insidevendor_boot.vbmeta*,misc(Bootloader Control Block / scratch space), anduserdata(/data).
superDynamic Partition (AOSPliblp/ Linuxdm-linear):- A single large physical partition (commonly
8-16 GiB) divided by LP metadata headers into logical partitions (system,vendor,product,odm,system_ext,*_dlkm), mapped at boot via kerneldevice-mapper(dm-linear) under/dev/block/mapper/<name>.
- A single large physical partition (commonly
2. Inspecting Stock super Geometry & Slot Planning
Always inspect the stock super layout first using standard open-source AOSP partition tools (lpdump, lpunpack, lpmake):
lpdump super.img # Inspect total super size, alignment, and slot_a / slot_b group limitsChoose the slot strategy that fits your device's free capacity:
- Dual-Slot Safe Rollback Layout (Recommended during early bring-up):
- Keep all stock
slot_alogical partitions (*_a) completely untouched insidesupersofastboot set_active arestores the stock OS immediately. - Compose the OpenHarmony logical partitions inside
slot_b(*_b) within the remainingsupercapacity.
- Keep all stock
- Full-Capacity Single-Target Layout:
- When the target OpenHarmony rootfs and vendor partitions exceed half of
super, back up the full stocksuper.imgoffline first, then resize LP group limits cleanly withlpmake.
- When the target OpenHarmony rootfs and vendor partitions exceed half of
- External Loop-Mounted Auxiliary Images:
- Large optional runtime images (such as an
AnCocompatibility container rootfs) do not need to occupysuper; keep them as read-only.erofsfiles under/dataand attach them via loop devices on demand.
- Large optional runtime images (such as an
3. Logical Partition Composition Inside super
Both Approach A (pure open-source OpenHarmony build) and Approach B (local user-owned BYOF synthesis) follow the same logical partition structure:
| Logical Partition (Target Slot) | Base Source | Composition & Required Adjustments |
|---|---|---|
system (system_b) | OpenHarmony / target system rootfs (Approach A open-source build, or Approach B local user-owned system image; not stock Android system) | Serves as the post-switch_root root and /system. Overlay cross-silicon UniOHOS/core runtime components (sidecar-runtime, hybris-bridge, device-parts) and incremental .cil SELinux deltas, then repack as read-only EROFS (optionally 64KB-aligned for hot libraries). |
vendor (vendor_b) | Target device stock vendor (or open-source OpenHarmony vendor in pure Approach A) | Under Approach B, keep stock device vendor firmware, HAL libraries, and hardware configs read-only (mounted in the isolated Bionic Sidecar namespace and accessed by the GPU bridge), while injecting/binding SoC hardware adapters (composer_vdi, buffer_vdi, audio/camera/RIL/power VDIs) and OpenHarmony init configs. Repack as read-only EROFS. |
sys_prod (sys_prod_b) | OpenHarmony system product configuration layer | Strip conflicting reference-device triggers or policies and tune system parameters (resolution, DPI, display, power, and peripheral properties) for the target device. |
chip_prod (chip_prod_b) | SoC & board product layer (UniOHOS-Devices/<vendor>-<soc>-bsp/common/ + profiles/<vendor>/<codename>/) | Holds silicon HDF/HDI configs, audio mixer topology, charging/thermal configs, and board-level panel/sensor/modem profiles, keeping system device-independent. |
odm (odm_b) | Target device stock odm (conditional) | Retain read-only if stock odm carries device-specific firmware, camera calibration, speaker amp configs, or NFC/sensor assets (either as a logical partition or mounted for Sidecar access); otherwise trim or omit. |
product / system_ext | Target device stock Android overlays | Not used by OpenHarmony userland. In the target slot (e.g., _b), shrink to zero or drop from the _b LP group to free super space (keep *_a intact if preserving dual-slot rollback). |
vendor_dlkm / odm_dlkm / system_dlkm | Target device stock GKI kernel-module partitions | GKI devices store loadable .ko kernel drivers (Wi-Fi, charging, audio, peripherals) in these logical partitions. Keep read-only (or merge required .ko files into vendor_boot / vendor) so hardware drivers load cleanly on boot. |
4. Physical Partitions Outside super
| Physical Partition | Modification Needed? | Required Adjustments & Safety Notes |
|---|---|---|
boot_{a,b} | Yes (target slot) | Flash the GKI ABI-aligned custom Linux kernel Image (enabling needed EROFS algorithms, HMFS ioctl compatibility, SELinux options, and device patches). Run UniOHOS/gki-sdk offline gates before flashing. |
init_boot_{a,b} | Yes (mandatory on target slot) | Replace stock Android first-stage ramdisk with OpenHarmony / UniOHOS/core/early-bringup first-stage PID1: initializes misc logging and ConfigFS USB ACM, parses super LP metadata to instantiate dm-linear devices, loads early .ko closures, fixes /dev mode (0755), mounts /usr, and executes switch_root /usr /bin/init --second-stage. |
vendor_boot_{a,b} | Yes (repack from stock base) | Unpack the target device's stock vendor_boot as baseline: preserve essential early stock .ko drivers and firmware, add any custom out-of-tree .ko modules (verified with gki-kcfi-ko-gate), update first-stage fstab / fstab.required to match the new super layout (keeping modem/calibration partitions ro,norecovery), and adjust bootconfig / kernel cmdline as needed. |
recovery_{a,b} (optional) | Optional | Dedicated physical recovery partition. Optionally deploy UniOHOS/recovery paired with per-SoC recovery-platform/ supporting HDC Sideload and Fastbootd; verify no OEM trigger wipes system or userdata. |
dtbo_{a,b} | Optional / as needed | Rebuild board DeviceTree overlays from pure-text .dts sources when tuning panel timing, DP Alt-Mode, touch, USB peripheral role, charging nodes, or peripherals; stock dtbo may be reused initially if nodes already match. |
vbmeta* | Yes (verification flags) | On an unlocked bootloader with modified boot/init_boot/vendor_boot/super, flash vbmeta with --disable-verity --disable-verification (or re-sign with your own AVB keys). |
userdata (/data) | Backup & initialize as needed | Keep native F2FS. Back up personal data before first boot into OpenHarmony; initialize /data if needed, or ensure clean directory separation and SELinux xattr labeling. |
misc | Optional offset use only | Preserve the standard BCB region; during Stage 0 bring-up, early logging may write checkpoints to a reserved offset (such as misc+0x1000). |
persist, modem_*, nvram, nvdata, nvcfg, protect1, protect2 | Prerequisite: keep read-only | Critical modem, EFS, and hardware calibration partitions. Keep completely untouched and mount strictly ro,norecovery in both fstab and Sidecar. |
xloader_*, bl2_*, uefi_*, tee_*, GPT table | No changes needed (keep stock recommended) | Low-level bootloader chain and partition table. OpenHarmony porting does not require modifying these partitions; keeping them stock preserves fastboot recovery. |
5. Filesystem Selection & 64KB Alignment
- Read-Only Logical Partitions (
system,vendor,sys_prod,chip_prod,odm): Use EROFS (LZ4/LZ4HC/ZSTD). Verify the kernel enablesCONFIG_EROFS_FSand matching compression algorithms before flashing. Hot shared libraries listed intier0-preload.txtcan be packed with64KBalignment viaUniOHOS/builder/fs-toolsto leverage ARM64 MMUPTE_CONTTLB coalescing. - Writable
/dataPartition: Keep the device's native F2FS filesystem and add lightweightHMFSioctlcompatibility (0xf5xx) in the kernel patch stack instead of destructively reformatting to proprietary filesystems.
Next Step
Once your storage map is defined, proceed to the Device Porting Guide (Stage 0-4) to bring up PID1 logging, GKI ABI verification, display, Sidecar, and SELinux.