Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
40e6ff5d
Commit
40e6ff5d
authored
Oct 29, 2016
by
NiteHawk
Committed by
GitHub
Oct 29, 2016
Browse files
Merge pull request #73 from n1tehawk/20161027_issue70
Build system improvements
parents
1351c828
90070ac8
Changes
4
Show whitespace changes
Inline
Side-by-side
.travis.yml
View file @
40e6ff5d
...
...
@@ -3,6 +3,9 @@ sudo: false
language
:
c
# treat all warnings as errors
env
:
EXTRA_CFLAGS=-Werror
os
:
-
linux
-
osx
...
...
@@ -10,7 +13,7 @@ compiler:
-
gcc
-
clang
# OSX uses Apple's flavor of clang anyway, so there's no point in
us
ing "gcc".
# OSX uses Apple's flavor of clang anyway, so there's no point in
try
ing "gcc".
# This excludes the "gcc" compiler from the build matrix for OSX:
matrix
:
exclude
:
...
...
@@ -23,17 +26,24 @@ addons:
packages
:
-
libusb-1.0-0-dev
# take care of the libusb dependency for Mac OS X
# take care of the libusb dependency for Mac OS X
; on Linux use "make all" later
before_install
:
-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
brew install libusb;
else
export TARGET="all CROSS_COMPILE=";
fi
# build using the Makefile
, treat all warnings as errors
# build using the Makefile
script
:
-
make EXTRA_CFLAGS=-Werror
-
make misc EXTRA_CFLAGS=-Werror
-
make ${TARGET} && make misc
# when on Linux: run/simulate a test install
after_success
:
-
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
make install-all install-misc DESTDIR=/tmp PREFIX=/sunxi-tools;
fi
# turn off email notifications
notifications
:
...
...
Makefile
View file @
40e6ff5d
...
...
@@ -39,8 +39,9 @@ TOOLS = sunxi-fexc sunxi-bootinfo sunxi-fel sunxi-nand-part
FEXC_LINKS
=
bin2fex fex2bin
# Tools which are only useful on the target
TARGET_TOOLS
=
sunxi-pio
TARGET_TOOLS
=
sunxi-meminfo
sunxi-pio
# Misc tools (of more "exotic" nature) not part of our default build / install
MISC_TOOLS
=
phoenix_info sunxi-nand-image-builder
# ARM binaries and images
...
...
@@ -56,16 +57,17 @@ BINDIR ?= $(PREFIX)/bin
.PHONY
:
all clean tools target-tools install install-tools install-target-tools
all
:
tools target-tools
tools
:
$(TOOLS) $(FEXC_LINKS)
target-tools
:
$(TARGET_TOOLS)
misc
:
version.h $(MISC_TOOLS)
all
:
tools target-tools
misc
:
$(MISC_TOOLS)
binfiles
:
$(BINFILES)
install
:
install-tools install-target-tools
install
:
install-tools
install-all
:
install-tools install-target-tools
install-tools
:
$(TOOLS)
install
-d
$(DESTDIR)$(BINDIR)
...
...
@@ -82,12 +84,18 @@ install-target-tools: $(TARGET_TOOLS)
install
-m0755
$$
t
$(DESTDIR)$(BINDIR)
/
$$
t
;
\
done
install-misc
:
$(MISC_TOOLS)
install
-d
$(DESTDIR)$(BINDIR)
@
set
-ex
;
for
t
in
$^
;
do
\
install
-m0755
$$
t
$(DESTDIR)$(BINDIR)
/
$$
t
;
\
done
clean
:
@
rm
-vf
$(TOOLS)
$(FEXC_LINKS)
$(TARGET_TOOLS)
$(MISC_TOOLS)
@
rm
-vf
version.h
*
.o
*
.elf
*
.sunxi
*
.bin
*
.nm
*
.orig
$(TOOLS) $(TARGET_TOOLS)
:
Makefile common.h version.h
$(TOOLS) $(TARGET_TOOLS)
$(MISC_TOOLS)
:
Makefile common.h version.h
fex2bin bin2fex
:
sunxi-fexc
ln
-nsf
$<
$@
...
...
@@ -118,6 +126,8 @@ sunxi-nand-part: nand-part-main.c nand-part.c nand-part-a10.h nand-part-a20.h
sunxi-%
:
%.c
$(CC)
$(CFLAGS)
$(LDFLAGS)
-o
$@
$(
filter
%.c,
$^
)
$(LIBS)
phoenix_info
:
phoenix_info.c
$(CC)
$(CFLAGS)
$(LDFLAGS)
-o
$@
$<
$(LIBS)
%.bin
:
%.elf
$(CROSS_COMPILE)
objcopy
-O
binary
$<
$@
...
...
@@ -158,11 +168,14 @@ boot_head_sun5i.elf: boot_head.S boot_head.lds
sunxi-bootinfo
:
bootinfo.c
# target tools
TARGET_CFLAGS
=
-g
-O0
-Wall
-Wextra
-std
=
c99
$(DEFINES)
-Iinclude
/
-static
sunxi-pio
:
pio.c
$(CROSS_COMPILE)
gcc
$(TARGET_CFLAGS)
-o
$@
$<
sunxi-meminfo
:
meminfo.c
$(CROSS_COMPILE)
gcc
-g
-O0
-Wall
-static
-o
$@
$^
$(CROSS_COMPILE)
gcc
$(TARGET_CFLAGS)
-o
$@
$<
sunxi-script_extractor
:
script_extractor.c
$(CROSS_COMPILE)
gcc
-g
-O0
-Wall
-static
-o
$@
$
^
$(CROSS_COMPILE)
gcc
$(TARGET_CFLAGS)
-o
$@
$
<
version.h
:
@
./autoversion.sh
>
$@
...
...
README.md
View file @
40e6ff5d
...
...
@@ -91,6 +91,52 @@ To build this, get a toolchain and run:
make CROSS_COMPILE=arm-linux-gnueabihf- sunxi-script_extractor
---
## Building
Compilation requires the development version of
*libusb-1.0*
(include header
and library) to be installed for
`sunxi-fel`
. Unless you explicitly pass
*LIBUSB_CFLAGS*
and
*LIBUSB_LIBS*
to the make utility,
`pkg-config`
is also
needed.
Available build targets:
*
`make tools`
builds tools that are useful on the host. This is what most people will want,
and our default target (when simply using
`make`
).
*
`make target-tools`
builds tools that are intended for the target (Allwinner SoC), using a
cross-compiler. The toolchain prefix
*CROSS_COMPILE*
defaults to
`arm-none-eabi-`
,
adjust it if needed.
<br>
_Hint:_
When compiling 'natively' on the target platform you may
simply use an empty toolchain prefix here (
`make target-tools CROSS_COMPILE=`
or
`make all CROSS_COMPILE=`
).
*
`make all`
builds both
*tools*
and
*target-tools*
.
*
`make install-tools`
builds
*tools*
and then copies/installs them to a filesystem location. The
destination is affected by settings for
`DESTDIR`
,
`PREFIX`
and possibly
`BINDIR`
. For details, please refer to the
*Makefile*
.
You may use
`make install`
as a shortcut for this.
*
`make install-target-tools`
builds
*target-tools*
and then copies/installs them to a filesystem location
selected by
`DESTDIR`
,
`PREFIX`
and possibly
`BINDIR`
- see
`make install-tools`
above.
*
`make install-all`
builds and installs both
*tools*
and
*target-tools*
.
*
`make misc`
builds miscellaneous (host) utilities that are not part of our 'standard' suite.
Currently this means
`phoenix_info`
and
`sunxi-nand-image-builder`
. There is no
dedicated "install" target for these, you need to copy them manuallly.
*
`make install-misc`
builds
*misc*
and installs the resulting binaries.
## License
This software is licensed under the terms of GPLv2+ as defined by the
Free Software Foundation, details can be read in the
[
LICENSE.md
](
LICENSE.md
)
...
...
autoversion.sh
View file @
40e6ff5d
...
...
@@ -4,7 +4,7 @@
# output (on stdout) can easily be redirected to a file.
#
LATEST_RELEASE
=
"v1.4"
LATEST_RELEASE
=
"v1.4
.1
"
if
VER
=
`
git describe
--tags
--dirty
--always
`
;
then
echo
"Setting version information:
${
VER
}
"
>
&2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment