Skip to content

Add support for Android EROFS (Enhanced Read-Only File System) #1156

@qkaiser

Description

@qkaiser

Summary

Android has adopted EROFS (Enhanced Read-Only File System) as the default read-only filesystem format for system partitions starting from Android 10. To improve unblob’s ability to extract and analyze Android firmware images, we should add support for EROFS.

Format Summary

EROFS is a high-performance read-only filesystem originally developed by Huawei and now used extensively in AOSP. It offers features like compression (LZ4, LZMA), inline data, and reduced storage overhead, making it ideal for read-only system images.

Key characteristics:

  • Read-only, block-based filesystem
  • Supports transparent compression (LZ4, LZMA)
  • Used in Android system, vendor, and product partitions
  • Magic: 0xE0F5E1E2

Implementation Hints

  • Detection: EROFS images can be identified by the magic number EROFS_SUPER_MAGIC_V1 = 0xE0F5E1E2 at offset 0x400. The superblock starts at that offset.
  • Parsing: The superblock structure is defined in include/uapi/linux/erofs_fs.h.
  • Decompression: LZ4 and LZMA are supported. Likely need to use external tools or Python libraries (lz4.frame, pylzma) for decompression.

Tools for reference testing:

  • erofs-utils: Use dump.erofs and mount.erofs for validation and comparison.

References

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions