-
Notifications
You must be signed in to change notification settings - Fork 2
/
ts7800
executable file
·105 lines (84 loc) · 1.66 KB
/
ts7800
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/sh
# Some functions for managing my TS7800 from FreeBSD.
err()
{
echo "$(basename $0): $1" >&2
exit 1
}
usage()
{
cat <<__EOF__
Usage: $(basename $0) <cmd> <args>
Commands:
uboot -- Rebuild the u-boot bootloader.
kernel -- Build a FreeBSD kernel for the TS7800 and install it to
${HOME}/tftp/TS7800.
Options:
-c -- Clean before building anything.
__EOF__
exit 1
}
kernel()
{
local ret
if [ $# -gt 1 -o \( $# -eq 1 -a "$1" != "-c" \) ]; then
usage
elif [ $# -eq 0 ]; then
export ARGS="-DKERNFAST -DNO_CLEAN"
else
export ARGS=""
fi
(
set -e
cd ${HOME}/src/freebsd
dst=${HOME}/tftp/TS7800
mkdir -p $dst
nice make kernel-toolchain -j8 TARGET_ARCH=arm __MAKE_CONF=/dev/null \
SRCCONF=/dev/null ${ARGS}
nice make buildkernel -j8 TARGET_ARCH=arm __MAKE_CONF=/dev/null \
SRCCONF=/dev/null KERNCONF=TS7800 ${ARGS}
cp -f /usr/obj/arm.arm/home/mark/src/freebsd/sys/TS7800/kernel.bin $dst
)
ret=$?
unset ARGS
return $ret
}
uboot()
{
local ret
if [ $# -gt 1 -o \( $# -eq 1 -a "$1" != "-c" \) ]; then
usage
elif [ "$1" = "-c" ]; then
export CLEAN=yes
else
export CLEAN=
fi
(
set -e
cd ${HOME}/src/u-boot
export CROSS_COMPILE=arm-none-eabi-
if [ -n "$CLEAN" ]; then
gmake distclean
gmake ts7800_config
fi
nice gmake ts7800 -j8
)
ret=$?
unset CLEAN
return $?
}
# Execution starts here.
if [ $# -eq 0 ]; then
usage
fi
case $1 in
kernel|uboot)
cmd=$1
shift
;;
*)
usage
;;
esac
eval \$cmd $@
exit $?