Sunxi-Tools for Windows: A Comprehensive Guide to Allwinner Device Management
If you work with Allwinner-based single-board computers like the Orange Pi, Banana Pi, or Pine64, you likely need sunxi-tools to manage hardware configurations and low-level flashing. While these utilities are native to Linux, Windows users can still harness their power to modify script.bin files or interact with devices in FEL mode. What are Sunxi-Tools?
sunxi-tools is a collection of command-line utilities designed for devices based on the Allwinner SoC (System on Chip) family. Key utilities include:
sunxi-fexc (fex2bin/bin2fex): Compiles or decompiles the binary hardware description files (.bin) used by Allwinner kernels into human-readable text (.fex).
sunxi-fel: A powerful tool for interacting with the processor's low-level bootrom (FEL mode) via USB. It allows you to boot over USB OTG or program SPI flash without a functional OS.
sunxi-bootinfo: Dumps information from Allwinner boot headers (boot0/boot1).
sunxi-nand-part: Manages NAND partition tables on Allwinner devices. How to Get Sunxi-Tools on Windows
There is no "official" Windows installer, so users typically choose one of three paths: 1. Using Pre-Compiled Binaries
For a quick setup, you can find community-contributed Windows builds of specific tools like fexc.exe.
Source: Repositories like J-Rios/Sunxi-Tools-Win-src often provide ready-to-use binaries for basic tasks like FEX conversion.
Usage: Place your script.bin in the tool folder and run provided batch files like bin2fex.bat. 2. Installing via WSL (Recommended)
The most stable way to run the full suite is through the Windows Subsystem for Linux (WSL). Sunxi-tools - GitHub
Title: Working with Allwinner Devices on Windows: A Guide to sunxi-tools
Body:
If you're tinkering with Allwinner SoCs (like the A20, H3, H5, or V3s) on SBCs such as the Orange Pi, Banana Pi, or C.H.I.P., you've probably heard of sunxi-tools. This suite is essential for low-level operations—things like flashing bootloaders directly to NAND, generating secure boot images, or poking FEL mode.
But here's the catch: sunxi-tools is a native Linux tool. So what do you do when your daily driver is Windows?
The Short Answer: You have three solid options. sunxi-tools windows
For most Windows-based embedded developers working with Allwinner devices, WSL2 + usbipd-win offers the most complete sunxi-tools experience, with the exception of low-level memory-mapped I/O tools. If only FEL mode operations (flashing, executing code) are required, a native sunxi-fel.exe built with MinGW and libusK is sufficient. Full native porting of the entire suite is impractical due to fundamental OS differences in memory and hardware access.
Launch MSYS2 UCRT64 from Start Menu. Run:
pacman -S mingw-w64-ucrt-x86_64-gcc make git libusb pkg-config
Open Command Prompt (cmd) or PowerShell in your tools directory.
Check Connection:
sunxi-fel.exe version
If everything is working, this will return the specific SoC version (e.g., "AW H3"). If it returns USB device not found, your driver isn't installed correctly or the device isn't in FEL mode.
Useful Commands for Windows Users:
Boot a U-Boot binary over USB (without flashing): Great for testing.
sunxi-fel.exe uboot u-boot-sunxi-with-spl.bin
Write to NAND partitions: If you are unbricking a device or modifying partitions:
sunxi-nand-part.exe /dev/nand partition_table.ini
pacman -Syu
(Close and reopen the terminal if prompted.)pacman -S mingw-w64-x86_64-gcc make git libusb pkg-config
git clone https://github.com/linux-sunxi/sunxi-tools
cd sunxi-tools
make cross=mings-w64- CC=gcc
Note: The Makefile might require adjustments. If you get errors, force the toolchain:
make CC=gcc CROSS_COMPILE=
sunxi-fel.exe, sunxi-nand-image-builder.exe, and sunxi-pio.exe inside the sunxi-tools directory.sunxi-tools on Windows, you primarily need two things: a working USB driver for your Allwinner device and a compiled version of the tools (specifically sunxi-fel.exe 1. Install USB Drivers For Windows to recognize an Allwinner device in , you must install a generic USB driver using
Put your device into FEL mode (typically by holding a specific button or jumpering the FEL pin to ground while powering it via USB). Select the device (it usually appears as Unknown Device USB Device(VID_1f3a_PID_efe8)
as the driver and click "Replace Driver" or "Install Driver". 2. Obtain sunxi-tools for Windows
You can either download pre-compiled binaries or build them yourself using a toolchain like Pre-compiled: Projects like Sunxi-Tools-Win-src sunxi-fex-tools-gui4win provide ready-to-use files for common tasks. Manual Build: If compiling from the official linux-sunxi/sunxi-tools
source, you must use a C99-compliant compiler (like GCC via Code::Blocks/MinGW) and include the mman-win32
library to handle memory management, which is missing in native Windows C. 3. Common Utilities & Commands Once installed, run these from a command prompt or via Common Use Case Command Example Low-level USB boot and flashing sunxi-fel -l (list devices) Convert binary scripts to text ( fexc -I bin -O fex script.bin script.fex Wrapper for to decompile bin2fex.bat Wrapper for to compile fex2bin.bat Important Troubleshooting Note If you compile yourself, you must add the flag to the function in
. Without this flag, Windows may incorrectly process line endings, leading to slightly different binary sizes and corrupted script.bin files that the board will reject. or a guide on flashing U-Boot
The Sunxi-tools suite is a critical collection of open-source command-line utilities designed for developers and enthusiasts working with ARM devices based on the Allwinner SoC family. While the tools are natively developed for Linux, their utility has led to various methods for running them on Windows, allowing users to manage device firmware, hardware descriptions, and low-level recovery without a dedicated Linux machine. Core Functionality The suite primarily assists in three areas: Sunxi-Tools for Windows: A Comprehensive Guide to Allwinner
FEL Mode Interaction: The sunxi-fel tool is the most prominent, acting as a script interface to communicate with the BootROM of Allwinner CPUs over USB OTG. It is essential for "unbricking" devices or booting them over USB when traditional storage (like SD cards) fails.
Hardware Configuration: The sunxi-fexc utility (often used via bin2fex and fex2bin shortcuts) converts .fex hardware description files into binary .bin files used by legacy kernels.
Diagnostics and Forensics: Tools like sunxi-meminfo and sunxi-bootinfo allow users to dump DRAM settings and read bootloader parameters directly from the device. Implementing Sunxi-tools on Windows
Since the official repository is Linux-centric, Windows users generally follow one of three paths:
Manual Compilation: Users can compile the source code using an IDE like Code::Blocks and the MinGW toolchain. This often requires porting Linux-specific headers, such as replacing with a Windows-compatible version like mman-win32.
Pre-compiled Binaries: Third-party repositories, such as those by J-Rios, provide non-GUI base sources or pre-built executables for Windows.
USB Driver Requirements: For tools like sunxi-fel to work on Windows, a specific WinUSB driver must be installed. This is typically achieved using the Zadig utility, which replaces the default Allwinner driver to allow libusb-based communication. Use Cases and Significance
For Windows users, the availability of these tools is particularly vital when dealing with devices like the Orange Pi or NanoPi. Many Allwinner distributions use a script.bin file located on a FAT32 boot partition, which Windows can see but cannot edit without fex2bin. Being able to decompile this file on a Windows desktop allows for rapid adjustments to GPIO settings, display resolutions, and power management without needing a Linux environment for every minor configuration change. Sunxi-tools - linux-sunxi.org
The soft glow of the monitor was the only thing illuminating Alex’s desk at 2:00 AM. In front of him sat a bricked Allwinner-based single-board computer—a silent, plastic slab that refused to boot. Alex was a user in a world of Linux-centric sunxi-tools , and tonight was the night he’d bridge that gap. He started by downloading
, the universal translator for USB drivers. With a deep breath, he held down the tiny recovery button on the board and plugged it in. Windows chimed, but instead of the usual "Device Not Recognized" error, Zadig showed a device with the tell-tale ID
. Alex clicked "Install WinUSB," watching the bar crawl across the screen.
Now came the real challenge: the tools themselves. Alex didn't want to spin up a heavy virtual machine, which often struggled with USB passthrough. Instead, he turned to community-maintained Windows builds like those found in the Sunxi-Tools-Win repository. He unzipped a folder containing sunxi-fel.exe fex2bin.exe
"Let's see if you're alive," he whispered. He opened a command prompt and typed: sunxi-fel.exe version A second of silence, then:
A Beginner’s Guide to Using Sunxi-Tools on Windows Sunxi-tools
a collection of command-line utilities designed for ARM devices powered by Allwinner SoCs
(System on Chips), such as Orange Pi, Banana Pi, and CubieBoard Title: Working with Allwinner Devices on Windows: A
. While originally built for Linux, these tools are essential for Windows users who need to modify device configurations or flash firmware directly via USB. What are Sunxi-Tools?
These tools allow you to interact with the "FEL" mode (a low-level bootloader mode) of Allwinner chips. Key utilities include: sunxi-fexc : Converts binary configuration files ( script.bin ) to human-readable text ( script.fex ) and back again.
: A powerful tool for USB communication with the device, used for uploading bootloaders or flashing memory. : Manages Peripheral Input/Output (PIO) settings. Step 1: Installing USB Drivers with Zadig
on Windows, your computer must recognize the Allwinner device in FEL mode. Enter FEL Mode
: Connect your board to your PC via USB while holding the FEL button (or shorting specific pins, depending on your hardware). : Download and run the Zadig USB tool
In Zadig, find the device (often listed as "Unknown Device" or with ID VID_1f3a_PID_efe8 Select the driver and click Replace Driver Step 2: Getting the Windows Binaries Since the official Sunxi-tools GitHub
provides source code, Windows users typically have two options: Download Pre-compiled Binaries : Use community-maintained repositories like Sunxi-Tools-Win-src which often include batch files like bin2fex.bat fex2bin.bat for easy use. Manual Compilation : Advanced users can compile the tools using an IDE like Code::Blocks toolchain. This requires adding specific dependencies like mman-win32 to handle Linux-style memory management on Windows. Step 3: Common Tasks 1. Modifying Device Configuration (FEX files)
To change hardware settings like GPIO pins or DRAM parameters: : Drag your script.bin bin2fex.bat . This generates a script.fex file you can edit in Notepad. : Once edited, drag script.fex fex2bin.bat to create a new script.bin for your device. 2. Testing FEL Connection Open a Command Prompt in your tools folder and type: sunxi-fel --list --verbose Use code with caution. Copied to clipboard
If successful, this will display a list of all connected Allwinner devices in FEL mode. Important Considerations O_BINARY Flag : If you are compiling the tools yourself, ensure the
flag is set when opening files; otherwise, Windows may corrupt the binary data during the conversion process. Hardware Prep
: Always ensure no SD card or SPI flash is interfering with the boot process if you are trying to force FEL mode.
For more technical details and hardware-specific guides, visit the official Linux-Sunxi Wiki Are you looking to modify a specific board's configuration , or do you need help flashing a new OS image Sunxi-tools - GitHub 26-Oct-2016 —
When called with no arguments, sunxi-fel will display a short usage summary. Note: Unless you select a specific device using the - Sunxi-tools - linux-sunxi.org 20-Nov-2021 —
Because your request is a bit broad, I want to make sure I give you exactly what you need. Could you clarify if you are looking for:
Technical Documentation/Guides: Instructions on how to compile or install sunxi-tools (like sunxi-fel) specifically on a Windows environment (e.g., using MSYS2 or Zadig drivers)?
Academic or Research Paper: A formal document or "white paper" discussing the architecture and utility of sunxi-tools for low-level hardware manipulation?