Experimental tools for inspecting Allwinner/PhoenixSuite Android firmware images and rebuilding them into a raw SD-card image that can be written with standard Unix tooling.
This was built for Orange Pi Zero 2W / H618 Android images, where the vendor
firmware is a PhoenixSuite/PhoenixCard container rather than a normal dd-able
SD-card image.
Some Allwinner Android board vendors distribute Android firmware as a PhoenixSuite
.img container. PhoenixCard writes bootloader areas, GPT data, and Android
partition payloads to specific LBAs. Writing the vendor .img directly with
Etcher or dd does not reproduce that layout.
This project reconstructs an experimental raw SD image by extracting those pieces and placing them at the offsets described by the firmware metadata.
- accepts a PhoenixSuite
.imgor a.tar.gzcontaining one; - extracts firmware members via
sunxi-fw; - reads
sunxi_gpt.fexandsys_partition.fex; - writes protective MBR, primary GPT, backup GPT;
- writes Allwinner boot areas such as
boot0_sdcard.fexandboot_package.fex; - writes Android partition payloads to the GPT partition LBAs;
- expands Android sparse images while writing;
- outputs a regular sparse raw image file.
- This does not include vendor firmware files.
- This does not include PhoenixCard, PhoenixSuit, APKs, or proprietary blobs.
- This does not automatically write to an SD card.
- This is not guaranteed to boot every board/image combination.
- Python 3.10+
tar,file,shasum, standard Unix toolssunxi-fwor a compatiblesunxi-fwbinary placed at:
tools/sunxi-fw/sunxi-fw
The analyzer can also use phoenix_info if available at:
tools/sunxi-tools/phoenix_info
git clone https://github.com/the-luap/orangepi-android-sd-image-builder.git
cd orangepi-android-sd-image-builder
# Put or symlink your sunxi-fw binary here:
mkdir -p tools/sunxi-fw
cp /path/to/sunxi-fw tools/sunxi-fw/sunxi-fw
chmod +x tools/sunxi-fw/sunxi-fw
# Inspect the firmware first:
scripts/analyze_allwinner_android_image.sh /path/to/vendor-android-image.tar.gz
# Build an experimental raw SD image:
scripts/build_raw_android_sd_image.py /path/to/vendor-android-image.tar.gz build/orangepi-android.rawThis project intentionally does not automate destructive disk writes. If you write the generated image to real media, identify the target disk manually and use the whole disk device, not a partition.
macOS example:
diskutil list
# verify target disk carefully, e.g. /dev/diskN
diskutil unmountDisk /dev/diskN
sudo dd if=build/orangepi-android.raw of=/dev/rdiskN bs=4m conv=sync status=progress
sync
diskutil eject /dev/diskNLinux example:
lsblk
# verify target disk carefully, e.g. /dev/sdX
sudo umount /dev/sdX* || true
sudo dd if=build/orangepi-android.raw of=/dev/sdX bs=4M conv=fsync status=progress
syncSee docs/safety.md. The short version: a wrong dd target
can destroy your laptop/desktop disk. This tool builds a file; you are responsible
for any physical write.
Experimental. The raw image structure can be validated, but boot success depends on board revision, firmware version, SD card, and Allwinner boot ROM expectations. UART logs are the best next diagnostic if the board powers on but does not show a usable display.
MIT