diff --git a/.gitignore b/.gitignore index 9fd669524f..de63aeff2d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,44 @@ -fexc -bin2fex -fex2bin + +Makefile +Makefile.in +*.m4 +compile +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +libtool +ltmain.sh +missing +.deps/ +.libs/ + bootinfo fel -pio +fexc nand-part -nand-part-a20 phoenix_info -fel-pio.bin -jtag-loop.bin -fel-sdboot.bin +pio + boot_head_sun4i.bin +boot_head_sun4i.elf boot_head_sun5i.bin -adb-devprobe.sh -fel-gpio -usb-boot +boot_head_sun5i.elf +fel-pio.bin +fel-pio.elf +fel-sdboot.bin +fel-sdboot.elf +jtag-loop.bin +jtag-loop.elf + +*.a *.o +*.la +*.so* + *.swp *~ -Makefile.in -autom4te.cache -aclocal.m4 -compile -configure -depcomp -install-sh -missing -config.guess -config.sub +autom4te.cache/ diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000000..b91c81f7b7 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,5 @@ + +Alejandro Mery +Henrik Nordstrom +Patrick Wood +Pat Wood diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000000..c35859aee6 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,7 @@ +2014-07-29 Andrey V.Kosteltsev + + * Tag 1.3 created. + + * Sources have been reorganized. + * Build system moved to Autotools. + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000000..a1e89e18ad --- /dev/null +++ b/INSTALL @@ -0,0 +1,370 @@ +Installation Instructions +************************* + +Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, +Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am index d864561d76..ce5bcc731a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,97 +1,14 @@ -AUTOMAKE_OPTIONS = foreign -CFLAGS = -g -O0 -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/ -TOOLS = fexc bin2fex fex2bin bootinfo fel pio nand-part phoenix_info -BINARIES = fel-pio.bin jtag-loop.bin fel-sdboot.bin boot_head_sun4i.bin boot_head_sun5i.bin adb-devprobe.sh fel-gpio usb-boot +ACLOCAL_AMFLAGS = -I m4 -bin_PROGRAMS = $(TOOLS) -exampledir = $(datarootdir)/doc/@PACKAGE@ -example_DATA = $(BINARIES) bin/fel-sdboot.sunxi bin/jtag-loop.sunxi bin/ramboot.scr bin/ramboot.uboot-sh README +EXTRA_DIST = m4 autogen.sh include/common.h include/endian_compat.h include/types.h -fexc_SOURCES = bootinfo.c fel-copy.c fel-sdboot.c jtag-loop.c phoenix_info.c script_bin.c script_fex.c fel.c fel-pio.c fexc.c nand-part.c pio.c script.c script_uboot.c common.h fexc.h nand-part-a20.h nand-part.h script_bin.h script_fex.h script.h script_uboot.h include/endian_compat.h include/types.h -EXTRA_DIST = boot_head.S jtag-loop.S boot_head.lds fel-pio.lds fel-sdboot.lds jtag-loop.lds sunxi-tools.7 adb-devprobe.sh fel-gpio usb-boot bin/fel-pio.bin bin/fel-pio.nm bin/fel-sdboot.sunxi bin/jtag-loop.sunxi bin/ramboot.scr bin/ramboot.uboot-sh makedeb +if HOST_CPU_ARM + MAYBE_SRC = src +endif -nodist_bin2fex_SOURCES = bin2fex.c -nodist_fex2bin_SOURCES = fex2bin.c +SUBDIRS = libfex tools binaries scripts man $(MAYBE_SRC) -man_MANS = sunxi-tools.7 +dist_doc_DATA = COPYING README -CROSS_COMPILE ?= @XCOMPILER@ - -clean-local: - rm -f boot_head_sun4i.elf boot_head_sun5i.elf fel-sdboot.elf fel-pio.elf fel-pio.nm jtag-loop.elf boot_head_sun4i.bin boot_head_sun5i.bin fel-sdboot.bin fel-pio.bin jtag-loop.bin *~ *.deb - -fexc: fexc.h script.h script.c script_uboot.h script_uboot.c script_bin.h script_bin.c script_fex.h script_fex.c - -fex2bin: fexc - ln -sf fexc fex2bin - -bin2fex: fexc - ln -sf fexc bin2fex - -fel: fel.c - $(CC) $(CFLAGS) $(LIBUSB_CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS) $(LIBUSB_LIBS) - -nand-part: nand-part-main.c nand-part.c nand-part-a10.h nand-part-a20.h - $(CC) $(CFLAGS) -c -o nand-part-main.o nand-part-main.c - $(CC) $(CFLAGS) -c -o nand-part-a10.o nand-part.c -D A10 - $(CC) $(CFLAGS) -c -o nand-part-a20.o nand-part.c -D A20 - $(CC) $(LDFLAGS) -o $@ nand-part-main.o nand-part-a10.o nand-part-a20.o $(LIBS) - -%: %.c - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS) - -fel-pio.bin: fel-pio.elf fel-pio.nm - $(CROSS_COMPILE)objcopy -O binary fel-pio.elf fel-pio.bin - -fel-pio.elf: fel-pio.c fel-pio.lds - $(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder fel-pio.c -nostdlib -o fel-pio.elf -T fel-pio.lds - -fel-pio.nm: fel-pio.elf - $(CROSS_COMPILE)nm fel-pio.elf | grep -v " _" >fel-pio.nm - -jtag-loop.elf: jtag-loop.c jtag-loop.lds - $(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder jtag-loop.c -nostdlib -o jtag-loop.elf -T jtag-loop.lds -Wl,-N - -jtag-loop.bin: jtag-loop.elf - $(CROSS_COMPILE)objcopy -O binary jtag-loop.elf jtag-loop.bin - -jtag-loop.sunxi: jtag-loop.bin - mksunxiboot jtag-loop.bin jtag-loop.sunxi - -fel-sdboot.elf: fel-sdboot.c fel-sdboot.lds - $(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder fel-sdboot.c -nostdlib -o fel-sdboot.elf -T fel-sdboot.lds -Wl,-N - -fel-sdboot.bin: fel-sdboot.elf - $(CROSS_COMPILE)objcopy -O binary fel-sdboot.elf fel-sdboot.bin - -fel-sdboot.sunxi: fel-sdboot.bin - mksunxiboot fel-sdboot.bin fel-sdboot.sunxi - -boot_head_sun3i.elf: boot_head_sun3i.S boot_head_sun3i.lds - $(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder boot_head.S -nostdlib -o boot_head_sun3i.elf -T boot_head.lds -Wl,-N -DMACHID=0x1094 - -boot_head_sun3i.bin: boot_head_sun3i.elf - $(CROSS_COMPILE)objcopy -O binary boot_head_sun3i.elf boot_head_sun3i.bin - -boot_head_sun4i.elf: boot_head.S boot_head.lds - $(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder boot_head.S -nostdlib -o boot_head_sun4i.elf -T boot_head.lds -Wl,-N -DMACHID=0x1008 - -boot_head_sun4i.bin: boot_head_sun4i.elf - $(CROSS_COMPILE)objcopy -O binary boot_head_sun4i.elf boot_head_sun4i.bin - -boot_head_sun5i.elf: boot_head.S boot_head.lds - $(CROSS_COMPILE)gcc -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder boot_head.S -nostdlib -o boot_head_sun5i.elf -T boot_head.lds -Wl,-N -DMACHID=0x102A - -boot_head_sun5i.bin: boot_head_sun5i.elf - $(CROSS_COMPILE)objcopy -O binary boot_head_sun5i.elf boot_head_sun5i.bin - -bootinfo: bootinfo.c - -dpkg-deb: - ./makedeb - -.gitignore: Makefile - @for x in $(TOOLS) $(BINARIES) '*.o' '*.swp' '*~' '.deps/*' Makefile.in /autom4te.cache /aclocal.m4 /compile /configure /depcomp /install-sh /missing; do \ - echo "$$x"; \ - done > $@ +docdir = $(datadir)/doc/@PACKAGE@-@VERSION@ diff --git a/NEWS b/NEWS new file mode 100644 index 0000000000..2ee11c27a6 --- /dev/null +++ b/NEWS @@ -0,0 +1,38 @@ + +Sources tree has been reorganized and moved to using autotools. + +NOTE: + If your target CPU is not arm then binaries in 'src' directory will not be built. + Skipping 'src' directory in this case made for building tools without cross compiler + for development PC. + +$ tar xzvf sunxi-tools-1.3.tar.gz +$ mkdir build +$ cd ./build + +configure with cross: +-------------------- + +CC="/bin/arm-a1x-linux-gnueabihf-gcc --sysroot=" \ +OBJCOPY=/bin/arm-a1x-linux-gnueabihf-objcopy \ +NM=/bin/arm-a1x-linux-gnueabihf-nm \ +CFLAGS=-I/usr/include \ +LDFLAGS="-L/lib -L/usr/lib" \ +../sunxi-tools-1.3/configure \ + --prefix=/usr \ + --build=x86_64-slackware-linux \ + --host=arm-a1x-linux-gnueabihf \ + --target=arm-a1x-linux-gnueabihf \ + --prefix=/usr --mandir=/usr/share/man \ + --program-prefix= + +configure on and for developers machine: +--------------------------------------- + +../sunxi-tools-1.3/configure --prefix=/usr + + +$ make +$ make install DESTDIR= + +Enjoy. diff --git a/autogen.sh b/autogen.sh index 581021aeac..3effc9abef 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,6 @@ #!/bin/sh -cd "$(dirname "$0")" -exec autoreconf -ifsv +aclocal +autoconf +libtoolize --force --copy +automake --force --copy --add-missing diff --git a/binaries/Makefile.am b/binaries/Makefile.am new file mode 100644 index 0000000000..ce318f21b4 --- /dev/null +++ b/binaries/Makefile.am @@ -0,0 +1,17 @@ + +EXTRA_DIST = fel-pio.bin \ + fel-pio.nm \ + fel-sdboot.sunxi \ + jtag-loop.sunxi \ + ramboot.scr \ + ramboot.uboot-sh + +binariesdir = $(datadir)/doc/@PACKAGE@-@VERSION@/binaries +binaries_SCRIPTS = fel-pio.bin \ + ramboot.uboot-sh + +extradir = $(datadir)/doc/@PACKAGE@-@VERSION@/binaries +extra_DATA = fel-pio.nm \ + fel-sdboot.sunxi \ + jtag-loop.sunxi \ + ramboot.scr diff --git a/bin/fel-pio.bin b/binaries/fel-pio.bin similarity index 100% rename from bin/fel-pio.bin rename to binaries/fel-pio.bin diff --git a/bin/fel-pio.nm b/binaries/fel-pio.nm similarity index 100% rename from bin/fel-pio.nm rename to binaries/fel-pio.nm diff --git a/bin/fel-sdboot.sunxi b/binaries/fel-sdboot.sunxi similarity index 100% rename from bin/fel-sdboot.sunxi rename to binaries/fel-sdboot.sunxi diff --git a/bin/jtag-loop.sunxi b/binaries/jtag-loop.sunxi similarity index 100% rename from bin/jtag-loop.sunxi rename to binaries/jtag-loop.sunxi diff --git a/bin/ramboot.scr b/binaries/ramboot.scr similarity index 100% rename from bin/ramboot.scr rename to binaries/ramboot.scr diff --git a/bin/ramboot.uboot-sh b/binaries/ramboot.uboot-sh old mode 100644 new mode 100755 similarity index 100% rename from bin/ramboot.uboot-sh rename to binaries/ramboot.uboot-sh diff --git a/configure.ac b/configure.ac index e5a7b78446..1903defbf7 100644 --- a/configure.ac +++ b/configure.ac @@ -2,30 +2,52 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.68]) -AC_INIT([sunxi-tools], [1.0], [https://github.com/linux-sunxi/sunxi-tools]) -AC_CONFIG_SRCDIR([fel-copy.c]) +AC_INIT([sunxi-tools], [1.3], [https://github.com/linux-sunxi/sunxi-tools]) +AC_CONFIG_SRCDIR([tools/fexc.c]) + +AC_CANONICAL_SYSTEM # automake initialisation and check for minimal automake API version 1.9 AM_INIT_AUTOMAKE([1.9]) +LT_INIT + +AC_CANONICAL_HOST # Checks for programs. AC_PROG_CC +AC_PROG_CPP +AM_PROG_AS + +AM_PROG_CC_C_O + + +AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc) +AC_CHECK_PROGS(CXX_FOR_BUILD, g++) +AC_CHECK_PROGS(OBJCOPY, objcopy) +AC_CHECK_PROGS(OBJDUMP, objdump) +AC_CHECK_PROGS(AR, ar) +AC_CHECK_PROGS(NM, nm) + +AC_SUBST([CCC_FOR_BUILD]) +AC_SUBST([CXX_FOR_BUILD]) +AC_SUBST([OBJCOPY]) +AC_SUBST([OBJDUMP]) +AC_SUBST([AR]) +AC_SUBST([NM]) + +AM_CONDITIONAL([HOST_CPU_ARM], [test "$host_cpu" = "arm"]) + +case "$host_cpu" in + arm*) + THUMB_CFLAGS="$THUMB_CFLAGS -mno-thumb-interwork" + ;; +esac + +AC_SUBST([THUMB_CFLAGS]) + + AC_PROG_LN_S -AC_CANONICAL_BUILD - -if test x"$cross_compiling" != x"yes" ; then - AC_CHECK_PROG(ARM_NONE_EABI_CHECK, arm-none-eabi-gcc, yes) - if test x"$ARM_NONE_EABI_CHECK" != x"yes" ; then - AC_CHECK_PROG(ARM_LINUX_GNUEABIHF_CHECK, arm-linux-gnueabihf-gcc, yes) - if test x"$ARM_LINUX_GNUEABIHF_CHECK" != x"yes" ; then - AC_MSG_ERROR([Please install GNU Tools for ARM Embedded Processors.]) - else - XCOMPILER="arm-linux-gnueabihf-" - fi - else - XCOMPILER="arm-none-eabi-" - fi -fi +AC_PROG_MKDIR_P # Checks for libraries. PKG_CHECK_MODULES([LIBUSB], libusb-1.0 >= 1.0.0,, AC_MSG_ERROR([*** Required libusb-1.0 >= 1.0.0 not installed ***])) @@ -42,13 +64,13 @@ AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T +dnl Following macro generates '#define malloc rpl_malloc' it's lead to link stage error: +dnl AC_FUNC_MALLOC +dnl AC_FUNC_REALLOC + # Checks for library functions. -AC_FUNC_MALLOC AC_FUNC_MMAP -AC_FUNC_REALLOC AC_CHECK_FUNCS([memset munmap strchr strerror strtol strtoul]) -AC_SUBST([XCOMPILER]) - -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile libfex/Makefile tools/Makefile src/Makefile binaries/Makefile scripts/Makefile man/Makefile]) AC_OUTPUT diff --git a/common.h b/include/common.h similarity index 100% rename from common.h rename to include/common.h diff --git a/script.h b/include/libfex/script.h similarity index 100% rename from script.h rename to include/libfex/script.h diff --git a/script_bin.h b/include/libfex/script_bin.h similarity index 100% rename from script_bin.h rename to include/libfex/script_bin.h diff --git a/script_fex.h b/include/libfex/script_fex.h similarity index 100% rename from script_fex.h rename to include/libfex/script_fex.h diff --git a/script_uboot.h b/include/libfex/script_uboot.h similarity index 100% rename from script_uboot.h rename to include/libfex/script_uboot.h diff --git a/libfex/Makefile.am b/libfex/Makefile.am new file mode 100644 index 0000000000..c31a1a1ae0 --- /dev/null +++ b/libfex/Makefile.am @@ -0,0 +1,19 @@ + +AM_CFLAGS = -g -O0 -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L -I$(top_srcdir) -I$(top_srcdir)/include +AM_LDFLAGS = + +lib_LTLIBRARIES = libfex.la + +libfex_la_SOURCES = $(top_srcdir)/include/libfex/script.h script.c \ + $(top_srcdir)/include/libfex/script_uboot.h script_uboot.c \ + $(top_srcdir)/include/libfex/script_bin.h script_bin.c \ + $(top_srcdir)/include/libfex/script_fex.h script_fex.c + +libfex_la_includedir = $(includedir)/libfex +libfex_la_include_HEADERS = $(top_srcdir)/include/libfex/script.h \ + $(top_srcdir)/include/libfex/script_uboot.h \ + $(top_srcdir)/include/libfex/script_bin.h \ + $(top_srcdir)/include/libfex/script_fex.h + +libfex_la_CFLAGS = $(CFLAGS) $(AM_CFLAGS) +libfex_la_LDFLAGS = $(LDFLAGS) $(AM_LDFLAGS) diff --git a/script.c b/libfex/script.c similarity index 99% rename from script.c rename to libfex/script.c index 3a9c7e7b22..ac0ab8a030 100644 --- a/script.c +++ b/libfex/script.c @@ -22,7 +22,7 @@ #include #include -#include "script.h" +#include "libfex/script.h" /* */ diff --git a/script_bin.c b/libfex/script_bin.c similarity index 99% rename from script_bin.c rename to libfex/script_bin.c index cd712189fe..bc2f7af3b6 100644 --- a/script_bin.c +++ b/libfex/script_bin.c @@ -23,8 +23,8 @@ #include #include -#include "script.h" -#include "script_bin.h" +#include "libfex/script.h" +#include "libfex/script_bin.h" #define pr_info(...) errf("fexc-bin: " __VA_ARGS__) #define pr_err(...) errf("E: fexc-bin: " __VA_ARGS__) diff --git a/script_fex.c b/libfex/script_fex.c similarity index 99% rename from script_fex.c rename to libfex/script_fex.c index 361e86be9f..2f1d4d03b3 100644 --- a/script_fex.c +++ b/libfex/script_fex.c @@ -22,8 +22,8 @@ #include #include -#include "script.h" -#include "script_fex.h" +#include "libfex/script.h" +#include "libfex/script_fex.h" #define MAX_LINE 255 diff --git a/script_uboot.c b/libfex/script_uboot.c similarity index 99% rename from script_uboot.c rename to libfex/script_uboot.c index 8d5b4744bb..ce34bb9bf1 100644 --- a/script_uboot.c +++ b/libfex/script_uboot.c @@ -20,8 +20,8 @@ #include #include -#include "script.h" -#include "script_uboot.h" +#include "libfex/script.h" +#include "libfex/script_uboot.h" #define pr_info(...) errf("fexc-uboot: " __VA_ARGS__) #define pr_err(...) errf("E: fexc-uboot: " __VA_ARGS__) diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 0000000000..c861ba0e44 --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,10 @@ + +man_MANS = sunxi-tools.7 + +EXTRA_DIST = sunxi-tools.7 + +install-data-hook: + @cd $(DESTDIR)$(mandir)/man7 ; \ + for file in *.7 ; do \ + gzip -9 $$file ; \ + done diff --git a/sunxi-tools.7 b/man/sunxi-tools.7 similarity index 97% rename from sunxi-tools.7 rename to man/sunxi-tools.7 index f2c54ed4ed..c21089b105 100644 --- a/sunxi-tools.7 +++ b/man/sunxi-tools.7 @@ -1,4 +1,4 @@ -.TH SUNXI-TOOLS "7" "August 2013" "Sunxi-Tools for allWinner's A10/A20" +.TH SUNXI-TOOLS "7" "August 2013" "For allWinner's A10/A20" .SH NAME sunxi-tools \- Tools to help hacking Allwinner A10 (aka sun4i) based devices and possibly it's successors, that's why the 'x' in the package name. diff --git a/scripts/Makefile.am b/scripts/Makefile.am new file mode 100644 index 0000000000..845614455d --- /dev/null +++ b/scripts/Makefile.am @@ -0,0 +1,5 @@ + +EXTRA_DIST = usb-boot + +scriptsdir = $(datadir)/doc/@PACKAGE@-@VERSION@/scripts +scripts_SCRIPTS = usb-boot diff --git a/scripts/usb-boot b/scripts/usb-boot new file mode 100755 index 0000000000..c14086fb11 --- /dev/null +++ b/scripts/usb-boot @@ -0,0 +1,79 @@ +#!/bin/sh -e + +top=`dirname $0` + +if [ $# -lt 2 ]; then + echo "Usage: $0 u-boot-spl.bin u-boot.bin [boot.scr] [kernel script.bin [initramfs]]" + exit 1 +fi + +board=$1; shift || (echo "ERROR: u-boot-spl.bin must be specified"; exit 1;) +uboot=$1; shift || (echo "ERROR: u-boot.bin must be specified"; exit 1;) +bootscr=$top/felboot/ramboot.scr +if [ ! -f $bootscr ]; then + bootscr=$top/bin/ramboot.scr +fi + +case "$1" in + *.scr) bootscr="$1"; shift + ;; +esac + +if [ $# -ge 1 ]; then + kernel=$1; shift || true +fi +if [ $# -ge 1 ]; then + scriptbin=$1; shift || true +fi +if [ $# -ge 1 ]; then + initramfs=$1; shift || true +fi + +fel() { + echo fel "$@" + $top/fel $@ +} + +case $board in + */*) felboot=$board + ;; + *) + felboot=$top/felboot/fel-boot-${board}.bin + if [ ! -f $felboot ]; then + felboot=$top/bin/fel-boot-${board}.bin + fi + ;; +esac + +if [ ! -f $felboot ]; then + echo "ERROR: Can't find SPL FEL binary ${board}" + exit 1 +fi + +if [ `wc -c $felboot | cut '-d ' -f1` -gt 15616 ]; then + echo "ERROR: SPL FEL binary too large. Must be the FEL version of SPL" + exit 1 +fi +if [ ! -f $bootscr ]; then + echo "ERROR: Can't fint boot script '${bootscr}'" + exit 1 +fi +fel write 0x2000 $felboot +fel exe 0x2000 +sleep 1 # Wait for DRAM initialization to complete +if [ -n "$uboot" ]; then + fel write 0x4a000000 $uboot +fi +if [ -n "$bootscr" ]; then + fel write 0x41000000 $bootscr +fi +if [ -n "$kernel" ]; then + if [ -n "$scriptbin" ]; then + fel write 0x43000000 $scriptbin + fi + fel write 0x44000000 $kernel + if [ -n "$initramfs" ]; then + fel write 0x4c000000 $initramfs + fi +fi +fel exe 0x4a000000 diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000000..40132ef831 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,88 @@ + +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = adb-devprobe.sh \ + boot_head.S \ + boot_head.lds \ + fel-gpio \ + fel-pio.c \ + fel-pio.lds \ + fel-sdboot.c \ + fel-sdboot.lds \ + jtag-loop.c \ + jtag-loop.lds \ + \ + jtag-loop.S \ + fel-copy.c + +AM_CFLAGS = -g -Os -fpic -fno-common -fno-builtin -ffreestanding -nostdinc \ + -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral \ + -Wno-format-security -fno-toplevel-reorder -nostdlib + + +BINARIES = fel-pio.bin \ + jtag-loop.bin \ + fel-sdboot.bin \ + boot_head_sun4i.bin \ + boot_head_sun5i.bin + +scriptsdir = $(datadir)/doc/@PACKAGE@-@VERSION@/scripts +scripts_SCRIPTS = adb-devprobe.sh fel-gpio + + +clean-local: + rm -f boot_head_sun4i.elf boot_head_sun5i.elf fel-sdboot.elf fel-pio.elf fel-pio.nm jtag-loop.elf boot_head_sun4i.bin boot_head_sun5i.bin fel-sdboot.bin fel-pio.bin jtag-loop.bin *~ + +all: $(BINARIES) + + +fel-pio.bin: fel-pio.elf fel-pio.nm + $(OBJCOPY) -O binary fel-pio.elf fel-pio.bin + +fel-pio.elf: fel-pio.c fel-pio.lds + $(CC) $(CFLAGS) $(AM_CFLAGS) $(THUMB_CFLAGS) $(top_srcdir)/src/fel-pio.c \ + -nostdlib -o fel-pio.elf -T $(top_srcdir)/src/fel-pio.lds + +fel-pio.nm: fel-pio.elf + $(NM) $(CURDIR)/fel-pio.elf | grep -v " _" >fel-pio.nm + +jtag-loop.elf: jtag-loop.c jtag-loop.lds + $(CC) $(CFLAGS) $(AM_CFLAGS) $(THUMB_CFLAGS) $(top_srcdir)/src/jtag-loop.c \ + -o jtag-loop.elf -T $(top_srcdir)/src/jtag-loop.lds -Wl,-N + +jtag-loop.bin: jtag-loop.elf + $(OBJCOPY) -O binary jtag-loop.elf jtag-loop.bin + +#jtag-loop.sunxi: jtag-loop.bin +# mksunxiboot jtag-loop.bin jtag-loop.sunxi + +fel-sdboot.elf: fel-sdboot.c fel-sdboot.lds + $(CC) $(CFLAGS) $(AM_CFLAGS) $(THUMB_CFLAGS) $(top_srcdir)/src/fel-sdboot.c \ + -o fel-sdboot.elf -T $(top_srcdir)/src/fel-sdboot.lds -Wl,-N + +fel-sdboot.bin: fel-sdboot.elf + $(OBJCOPY) -O binary fel-sdboot.elf fel-sdboot.bin + +#fel-sdboot.sunxi: fel-sdboot.bin +# mksunxiboot fel-sdboot.bin fel-sdboot.sunxi + +boot_head_sun3i.elf: boot_head_sun3i.S boot_head_sun3i.lds + $(CC) $(CFLAGS) $(AM_CFLAGS) $(THUMB_CFLAGS) $(top_srcdir)/src/boot_head.S \ + -o boot_head_sun3i.elf -T $(top_srcdir)/src/boot_head.lds -Wl,-N -DMACHID=0x1094 + +boot_head_sun3i.bin: boot_head_sun3i.elf + $(OBJCOPY) -O binary boot_head_sun3i.elf boot_head_sun3i.bin + +boot_head_sun4i.elf: boot_head.S boot_head.lds + $(CC) $(CFLAGS) $(AM_CFLAGS) $(THUMB_CFLAGS) $(top_srcdir)/src/boot_head.S \ + -o boot_head_sun4i.elf -T $(top_srcdir)/src/boot_head.lds -Wl,-N -DMACHID=0x1008 + +boot_head_sun4i.bin: boot_head_sun4i.elf + $(OBJCOPY) -O binary boot_head_sun4i.elf boot_head_sun4i.bin + +boot_head_sun5i.elf: boot_head.S boot_head.lds + $(CC) $(CFLAGS) $(AM_CFLAGS) $(THUMB_CFLAGS) $(top_srcdir)/src/boot_head.S \ + -o boot_head_sun5i.elf -T $(top_srcdir)/src/boot_head.lds -Wl,-N -DMACHID=0x102A + +boot_head_sun5i.bin: boot_head_sun5i.elf + $(OBJCOPY) -O binary boot_head_sun5i.elf boot_head_sun5i.bin diff --git a/adb-devprobe.sh b/src/adb-devprobe.sh similarity index 100% rename from adb-devprobe.sh rename to src/adb-devprobe.sh diff --git a/boot_head.S b/src/boot_head.S similarity index 100% rename from boot_head.S rename to src/boot_head.S diff --git a/boot_head.lds b/src/boot_head.lds similarity index 100% rename from boot_head.lds rename to src/boot_head.lds diff --git a/fel-copy.c b/src/fel-copy.c similarity index 100% rename from fel-copy.c rename to src/fel-copy.c diff --git a/fel-gpio b/src/fel-gpio similarity index 100% rename from fel-gpio rename to src/fel-gpio diff --git a/fel-pio.c b/src/fel-pio.c similarity index 100% rename from fel-pio.c rename to src/fel-pio.c diff --git a/fel-pio.lds b/src/fel-pio.lds similarity index 100% rename from fel-pio.lds rename to src/fel-pio.lds diff --git a/fel-sdboot.c b/src/fel-sdboot.c similarity index 100% rename from fel-sdboot.c rename to src/fel-sdboot.c diff --git a/fel-sdboot.lds b/src/fel-sdboot.lds similarity index 100% rename from fel-sdboot.lds rename to src/fel-sdboot.lds diff --git a/jtag-loop.S b/src/jtag-loop.S similarity index 100% rename from jtag-loop.S rename to src/jtag-loop.S diff --git a/jtag-loop.c b/src/jtag-loop.c similarity index 100% rename from jtag-loop.c rename to src/jtag-loop.c diff --git a/jtag-loop.lds b/src/jtag-loop.lds similarity index 100% rename from jtag-loop.lds rename to src/jtag-loop.lds diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000000..52bcd8bd43 --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,51 @@ + +AM_CFLAGS = -g -O0 -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L -I$(top_srcdir) -I$(top_srcdir)/include +AM_LDFLAGS = -L$(top_srcdir)/libfex + +bin_PROGRAMS = fexc fel bootinfo pio nand-part phoenix_info + +fexc_SOURCES = fexc.c +fexc_CFLAGS = $(CFLAGS) $(AM_CFLAGS) +fexc_LDFLAGS = $(LDFLAGS) $(AM_LDFLAGS) +fexc_LDADD = $(top_builddir)/libfex/.libs/libfex.a + +fel_SOURCES = fel.c +fel_CFLAGS = $(CFLAGS) $(AM_CFLAGS) $(LIBUSB_CFLAGS) +fel_LDFLAGS = $(LDFLAGS) $(AM_LDFLAGS) $(LIBUSB_LIBS) + +bootinfo_SOURCES = bootinfo.c +bootinfo_CFLAGS = $(CFLAGS) $(AM_CFLAGS) +bootinfo_LDFLAGS = $(LDFLAGS) $(AM_LDFLAGS) + +pio_SOURCES = pio.c +pio_CFLAGS = $(CFLAGS) $(AM_CFLAGS) +pio_LDFLAGS = $(LDFLAGS) $(AM_LDFLAGS) + +nand_part_SOURCES = nand-part-main.c +nand_part_CFLAGS = $(CFLAGS) $(AM_CFLAGS) +nand_part_LDFLAGS = $(LDFLAGS) $(AM_LDFLAGS) +nand_part_LDADD = $(top_builddir)/tools/liba10.a \ + $(top_builddir)/tools/liba20.a + +noinst_LIBRARIES = liba10.a liba20.a + +liba10_a_SOURCES = nand-part.c +liba10_a_CFLAGS = $(CFLAGS) $(AM_CFLAGS) -DA10 +liba20_a_SOURCES = nand-part.c +liba20_a_CFLAGS = $(CFLAGS) $(AM_CFLAGS) -DA20 + +phoenix_info_SOURCES = phoenix_info.c +phoenix_info_CFLAGS = $(CFLAGS) $(AM_CFLAGS) +phoenix_info_LDFLAGS = $(LDFLAGS) $(AM_LDFLAGS) + +noinst_HEADERS = fexc.h \ + nand-common.h \ + nand-part-a10.h \ + nand-part-a20.h + + +install-exec-hook: + @( cd $(DESTDIR)$(bindir) ; \ + $(LN_S) -f *fexc$(EXEEXT) fex2bin$(EXEEXT) ; \ + $(LN_S) -f *fexc$(EXEEXT) bin2fex$(EXEEXT) ; \ + ) diff --git a/bootinfo.c b/tools/bootinfo.c similarity index 99% rename from bootinfo.c rename to tools/bootinfo.c index c40e32ef9d..1b8b262641 100644 --- a/bootinfo.c +++ b/tools/bootinfo.c @@ -273,6 +273,7 @@ void print_boot0_private_head(boot0_private_head_t *hdr, loader_type type) void print_script(void *script) { + script = script; } void print_core_para(boot_core_para_t *core) diff --git a/fel.c b/tools/fel.c similarity index 100% rename from fel.c rename to tools/fel.c diff --git a/fexc.c b/tools/fexc.c similarity index 99% rename from fexc.c rename to tools/fexc.c index c32573527f..234b1c92e0 100644 --- a/fexc.c +++ b/tools/fexc.c @@ -68,8 +68,7 @@ static inline char *read_all(int fd, const char *filename, size_t *size) p = buf + count; } } - } else if (errno != EAGAIN || - errno != EINTR) { + } else if (errno != EAGAIN && errno != EINTR) { pr_err("%s: %s: %s\n", filename, "read", strerror(errno)); free(buf); diff --git a/fexc.h b/tools/fexc.h similarity index 87% rename from fexc.h rename to tools/fexc.h index c5b32a9c9b..613fdfb8e5 100644 --- a/fexc.h +++ b/tools/fexc.h @@ -22,9 +22,9 @@ #include #include -#include "script.h" -#include "script_bin.h" -#include "script_fex.h" -#include "script_uboot.h" +#include "libfex/script.h" +#include "libfex/script_bin.h" +#include "libfex/script_fex.h" +#include "libfex/script_uboot.h" #endif diff --git a/nand-common.h b/tools/nand-common.h similarity index 100% rename from nand-common.h rename to tools/nand-common.h diff --git a/nand-part-a10.h b/tools/nand-part-a10.h similarity index 100% rename from nand-part-a10.h rename to tools/nand-part-a10.h diff --git a/nand-part-a20.h b/tools/nand-part-a20.h similarity index 100% rename from nand-part-a20.h rename to tools/nand-part-a20.h diff --git a/nand-part-main.c b/tools/nand-part-main.c similarity index 100% rename from nand-part-main.c rename to tools/nand-part-main.c diff --git a/nand-part.c b/tools/nand-part.c similarity index 100% rename from nand-part.c rename to tools/nand-part.c diff --git a/phoenix_info.c b/tools/phoenix_info.c similarity index 99% rename from phoenix_info.c rename to tools/phoenix_info.c index b76c5e41c0..41d319371b 100644 --- a/phoenix_info.c +++ b/tools/phoenix_info.c @@ -43,7 +43,7 @@ static int save_part(struct phoenix_ptable *ptable, int part, const char *dest, { int l = strlen(dest) + 16; char outname[l]; - FILE *out; + FILE *out = NULL; char *buf = NULL; int ret = 0; snprintf(outname, l, dest, part); diff --git a/pio.c b/tools/pio.c similarity index 99% rename from pio.c rename to tools/pio.c index 7ef4514844..7ee7c21e1a 100644 --- a/pio.c +++ b/tools/pio.c @@ -315,6 +315,7 @@ static void cmd_clean(char *buf) static int do_command(char *buf, const char **args, int argc) { + argc = argc; const char *command = args[0]; if (*command == 'P') { if (strchr(command, '<')) diff --git a/usb-boot b/usb-boot deleted file mode 100755 index 77e87ce61e..0000000000 --- a/usb-boot +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh -e -top=`dirname $0` -if [ $# -lt 2 ]; then - echo "Usage: $0 u-boot-spl.bin u-boot.bin [boot.scr] [kernel script.bin [initramfs]]" - exit 1 -fi -board=$1; shift || (echo "ERROR: u-boot-spl.bin must be specified"; exit 1;) -uboot=$1; shift || (echo "ERROR: u-boot.bin must be specified"; exit 1;) -bootscr=$top/felboot/ramboot.scr -if [ ! -f $bootscr ]; then - bootscr=$top/bin/ramboot.scr -fi -case "$1" in -*.scr) bootscr="$1"; shift - ;; -esac -if [ $# -ge 1 ]; then - kernel=$1; shift || true -fi -if [ $# -ge 1 ]; then - scriptbin=$1; shift || true -fi -if [ $# -ge 1 ]; then - initramfs=$1; shift || true -fi -fel() { - echo fel "$@" - $top/fel $@ -} -case $board in -*/*) felboot=$board - ;; -*) - felboot=$top/felboot/fel-boot-${board}.bin - if [ ! -f $felboot ]; then - felboot=$top/bin/fel-boot-${board}.bin - fi - ;; -esac -if [ ! -f $felboot ]; then - echo "ERROR: Can't find SPL FEL binary ${board}" - exit 1 -fi -if [ `wc -c $felboot | cut '-d ' -f1` -gt 15616 ]; then - echo "ERROR: SPL FEL binary too large. Must be the FEL version of SPL" - exit 1 -fi -if [ ! -f $bootscr ]; then - echo "ERROR: Can't fint boot script '${bootscr}'" - exit 1 -fi -fel write 0x2000 $felboot -fel exe 0x2000 -sleep 1 # Wait for DRAM initialization to complete -if [ -n "$uboot" ]; then - fel write 0x4a000000 $uboot -fi -if [ -n "$bootscr" ]; then - fel write 0x41000000 $bootscr -fi -if [ -n "$kernel" ]; then - if [ -n "$scriptbin" ]; then - fel write 0x43000000 $scriptbin - fi - fel write 0x44000000 $kernel - if [ -n "$initramfs" ]; then - fel write 0x4c000000 $initramfs - fi -fi -fel exe 0x4a000000