Import sunxi-tools as of 20150915. Note that only the fexc utility has been

tested at this time.

Tools to help hacking Allwinner A10 (aka sun4i) based devices and possibly
it's successors, that's why the 'x' in the package name.

fexc:
	`.fex` file (de)compiler

	Usage: ./fexc [-vq] [-I <infmt>] [-O <outfmt>] [<input> [<output>]]

	infmt:  fex, bin  (default:fex)
	outfmt: fex, bin  (default:bin)

bin2fex:
	compatibility shortcut to call `fexc` to decompile an script.bin
	blob back into `.fex` format used by allwinner's SDK to configure
	the boards.

fex2bin:
	compatiblity shortcut to call `fexc` to compile a `.fex` file into
	the binary form used by the sun4i kernel.

fel:
	script interface for talking to the FEL USB handler built in to
	th CPU. You activate FEL mode by pushing the usboot/recovery
	button at poweron. See http://linux-sunxi.org/FEL/USBBoot for
	a detailed usage guide.

fel-gpio:
	Simple wrapper around fel-pio and fel to allow GPIO manipulations
	via FEL

fel-sdboot:
	ARM native sdcard bootloader forcing the device into FEL mode

fel-pio:
	ARM native helper for fel-gpio

pio:
	Manipulate PIO register dumps

jtag-loop.sunxi:
	ARM native boot helper to force the SD port into JTAG
	and then stop, to ease debugging of bootloaders.

bootinfo:
	Dump information from Allwinner boot files (boot0/boot1)
	--type=sd	include SD boot info
	--type=nand	include NAND boot info (not implemented)

phoenix_info:
	gives information about a phoenix image created by the
	phoenixcard utility and optionally extracts the embedded boot
	code & firmware file from their hidden partitions.
This commit is contained in:
bouyer 2015-10-22 15:51:47 +00:00
parent 85eeb1eac8
commit 03ff56eee7
6 changed files with 150 additions and 0 deletions

View file

@ -0,0 +1,52 @@
Tools to help hacking Allwinner A10 (aka sun4i) based devices and possibly
it's successors, that's why the 'x' in the package name.
fexc:
`.fex` file (de)compiler
Usage: ./fexc [-vq] [-I <infmt>] [-O <outfmt>] [<input> [<output>]]
infmt: fex, bin (default:fex)
outfmt: fex, bin (default:bin)
bin2fex:
compatibility shortcut to call `fexc` to decompile an script.bin
blob back into `.fex` format used by allwinner's SDK to configure
the boards.
fex2bin:
compatiblity shortcut to call `fexc` to compile a `.fex` file into
the binary form used by the sun4i kernel.
fel:
script interface for talking to the FEL USB handler built in to
th CPU. You activate FEL mode by pushing the usboot/recovery
button at poweron. See http://linux-sunxi.org/FEL/USBBoot for
a detailed usage guide.
fel-gpio:
Simple wrapper around fel-pio and fel to allow GPIO manipulations
via FEL
fel-sdboot:
ARM native sdcard bootloader forcing the device into FEL mode
fel-pio:
ARM native helper for fel-gpio
pio:
Manipulate PIO register dumps
jtag-loop.sunxi:
ARM native boot helper to force the SD port into JTAG
and then stop, to ease debugging of bootloaders.
bootinfo:
Dump information from Allwinner boot files (boot0/boot1)
--type=sd include SD boot info
--type=nand include NAND boot info (not implemented)
phoenix_info:
gives information about a phoenix image created by the
phoenixcard utility and optionally extracts the embedded boot
code & firmware file from their hidden partitions.

View file

@ -0,0 +1,36 @@
# $NetBSD: Makefile,v 1.1 2015/10/22 15:51:47 bouyer Exp $
#
VERSION= 20150915
DISTNAME= sunxi-tools-${VERSION}
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_GITHUB:=linux-sunxi/}
GITHUB_PROJECT= sunxi-tools
GITHUB_TAG= 568c7a0e81fc5d52189710c6d832677aa8770b16
MAINTAINER= bouyer@NetBSD.org
HOMEPAGE= http://linux-sunxi.org/
COMMENT= tools to help hacking Allwinner A10 (and successors) devices
LICENSE= gnu-gpl-v2
USE_LANGUAGES= c
USE_TOOLS+= gmake
INSTALLATION_DIRS= bin libdata/sunxi-tools
do-install:
.for f in fexc fel pio bootinfo phoenix_info
${INSTALL_PROGRAM} ${WRKSRC}/${f} ${DESTDIR}${PREFIX}/bin/${f}
.endfor
.for f in bin2fex fex2bin
${LN} ${DESTDIR}${PREFIX}/bin/fexc ${DESTDIR}${PREFIX}/bin/${f}
.endfor
.for f in fel-gpio
${INSTALL_SCRIPT} ${WRKSRC}/${f} ${DESTDIR}${PREFIX}/bin/${f}
.endfor
.for f in fel-pio.bin fel-sdboot.sunxi ramboot.scr fel-pio.nm jtag-loop.sunxi ramboot.uboot-sh
${INSTALL_DATA} ${WRKSRC}/bin/${f} ${DESTDIR}${PREFIX}/libdata/sunxi-tools/${f}
.endfor
.include "../../devel/libusb1/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -0,0 +1,15 @@
@comment $NetBSD: PLIST,v 1.1 2015/10/22 15:51:47 bouyer Exp $
bin/fexc
bin/bin2fex
bin/fex2bin
bin/fel
bin/fel-gpio
bin/pio
bin/bootinfo
bin/phoenix_info
libdata/sunxi-tools/fel-pio.bin
libdata/sunxi-tools/fel-sdboot.sunxi
libdata/sunxi-tools/ramboot.scr
libdata/sunxi-tools/fel-pio.nm
libdata/sunxi-tools/jtag-loop.sunxi
libdata/sunxi-tools/ramboot.uboot-sh

View file

@ -0,0 +1,7 @@
$NetBSD: distinfo,v 1.1 2015/10/22 15:51:47 bouyer Exp $
SHA1 (sunxi-tools-20150915-568c7a0e81fc5d52189710c6d832677aa8770b16.tar.gz) = 294576067bea1d7d1c66148870b1a4767881762b
RMD160 (sunxi-tools-20150915-568c7a0e81fc5d52189710c6d832677aa8770b16.tar.gz) = 6e1318bfea20bd57c740e13b14b1059530df073f
Size (sunxi-tools-20150915-568c7a0e81fc5d52189710c6d832677aa8770b16.tar.gz) = 51232 bytes
SHA1 (patch-Makefile) = 3748970711ddd5ed1303d8817961d6ec8641f57d
SHA1 (patch-include_endian_compat.h) = f2e6fd1305c25a9b34f26fe70ad223ec5156211b

View file

@ -0,0 +1,27 @@
$NetBSD: patch-Makefile,v 1.1 2015/10/22 15:51:47 bouyer Exp $
--- Makefile.orig 2015-09-13 22:56:46.000000000 +0200
+++ Makefile 2015-10-01 16:29:36.000000000 +0200
@@ -18,11 +18,11 @@
CC = gcc
CFLAGS = -g -O0 -Wall -Wextra
-CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200112L
+CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE
CFLAGS += -Iinclude/
TOOLS = fexc bin2fex fex2bin bootinfo fel pio
-TOOLS += nand-part
+#TOOLS += nand-part
MISC_TOOLS = phoenix_info
@@ -30,7 +30,7 @@
.PHONY: all clean
-all: $(TOOLS)
+all: $(TOOLS) $(MISC_TOOLS)
misc: $(MISC_TOOLS)

View file

@ -0,0 +1,13 @@
$NetBSD: patch-include_endian_compat.h,v 1.1 2015/10/22 15:51:47 bouyer Exp $
--- include/endian_compat.h.orig 2015-10-01 16:09:19.000000000 +0200
+++ include/endian_compat.h 2015-10-01 16:20:48.000000000 +0200
@@ -29,6 +29,8 @@
#define le32toh(x) CFSwapInt32LittleToHost(x)
#define htole16(x) CFSwapInt16HostToLittle(x)
#define le16toh(x) CFSwapInt16LittleToHost(x)
+#elif defined(__NetBSD__)
+#include <sys/endian.h>
#else
#include <endian.h>
#endif