forked from cubieboard/u-boot-nand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·71 lines (60 loc) · 1.91 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# build.sh
#
# (c) Copyright 2013
# Allwinner Technology Co., Ltd. <www.allwinnertech.com>
# James Deng <csjamesdeng@allwinnertech.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Notice:
# 1. Board option is useless.
# 2. We Only support to copy u-boot.bin to common directory right now.
function build_uboot()
{
case "$1" in
clean)
make distclean CROSS_COMPILE=arm-linux-gnueabi-
;;
*)
make distclean CROSS_COMPILE=arm-linux-gnueabi-
make -j8 ${LICHEE_CHIP} CROSS_COMPILE=arm-linux-gnueabi-
[ $? -ne 0 ] && exit 1
cp -f u-boot.bin ../out/${LICHEE_PLATFORM}/common/
;;
esac
}
if [ $(basename `pwd`) != "u-boot" ] ; then
echo "Please run at the top directory of u-boot"
exit 1
fi
if [ -n "${LICHEE_CHIP}" ] ; then
build_uboot $1
exit 0
fi
. ../buildroot/scripts/shflags/shflags
# define option, format:
# 'long option' 'default value' 'help message' 'short option'
DEFINE_string 'platform' 'sun7i' 'platform to build, e.g. sun7i' 'p'
DEFINE_string 'board' '' 'board to build, e.g. evb' 'b'
DEFINE_string 'module' '' 'module to build, e.g. clean' 'm'
# parse the command-line
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
LICHEE_CHIP=${FLAGS_platform%%_*}
LICHEE_PLATFORM=${FLAGS_platform##*_}
LICHEE_BOARD=${FLAGS_board}
if [ "${LICHEE_CHIP}" = "${LICHEE_PLATFORM}" ] ; then
LICHEE_PLATFORM="linux"
fi
tooldir="$(dirname `pwd`)/out/${LICHEE_PLATFORM}/common/buildroot/external-toolchain"
if [ -d ${tooldir} ] ; then
if ! echo $PATH | grep -q "$tooldir" ; then
export PATH=${tooldir}/bin:$PATH
fi
else
echo "Please build buildroot first"
exit 1
fi
build_uboot ${FLAGS_module}