forked from anmaped/openfang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildopenfang.sh
executable file
·100 lines (70 loc) · 2.97 KB
/
buildopenfang.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
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
#!/bin/sh
TAG=rc05_01
set -e
CPW=$(pwd)
DIR=_build
[ -d $DIR ] || { printf '%s does not exist!\n' "$DIR"; mkdir $DIR; }
date=$(date +"%Y-%m-%d %H:%M")
#ID="($(git rev-parse HEAD)) $date"
ID="$(git describe --tags)"
SHORTID=$(git rev-parse --short HEAD)
echo "$ID" > fs/opt/version
cp fs $DIR/ -r;
sed -i "s/VERSION=.*/VERSION=\"$date\"/g" $DIR/fs/opt/autoupdate.sh
sed -i "s/TAG=.*/TAG=\"$TAG\"/g" $DIR/fs/opt/autoupdate.sh
sed -i "s/ID=.*/ID=\"$SHORTID\"/g" $DIR/fs/opt/autoupdate.sh
[ "$1" = "stamp" ] && { exit 0; }
cd $DIR
BUILDROOT_VERSION=2016.02
[ -d "buildroot-$BUILDROOT_VERSION" ] || {
wget https://buildroot.org/downloads/buildroot-$BUILDROOT_VERSION.tar.gz;
tar xvf buildroot-$BUILDROOT_VERSION.tar.gz;
rm buildroot-$BUILDROOT_VERSION.tar.gz;
cd buildroot-$BUILDROOT_VERSION
patch -p1 < "$CPW"/patches/add_fp_no_fused_madd.patch
cd ..
}
cd buildroot-$BUILDROOT_VERSION
# update config files
cp "$CPW"/config/buildroot.config ./.config
cp "$CPW"/config/busybox.config ./package/busybox
cp "$CPW"/config/uClibc-ng.config ./package/uclibc
[ -d "dl" ] || { mkdir dl; }
cp ../../kernel-3.10.14.tar.xz dl/
cp ../../uboot-v2013.07.tar.xz dl/
WDIR=$CPW/$DIR/buildroot-$BUILDROOT_VERSION
# Patch buildroot if gcc >= 5
#
GCCVER=$(gcc -dumpversion | cut -d'.' -f1)
echo "GCC version: $GCCVER"
if [ "$GCCVER" -ge "5" ]; then
cp "$CPW"/patches/automake.in.patch "$WDIR"/package/automake
cp "$CPW"/patches/python/python2.7_gcc8__fix.patch "$WDIR"/package/python
cp "$CPW"/patches/lzop-gcc6.patch "$WDIR"/package/lzop
fi
# copy python patches to address host-python build failing
# when host has openssl 1.1.0 headers installed
cp -f "$CPW"/patches/python/111-optional-ssl.patch "$WDIR"/package/python
cp "$CPW"/patches/python/019-force-internal-hash-if-ssl-disabled.patch "$WDIR"/package/python
# copy custom openfang packages to buildroot directory
rm -r "$WDIR"/package/ffmpeg # use updated package version instead
#rm -r "$WDIR"/package/python # use updated package version instead
#rm -r "$WDIR"/package/uclibc # use updated package version instead
cp "$CPW"/buildroot/* . -rf
make
#
# compile different versions of uboot
#
[ -f "output/images/u-boot-lzo-with-spl.bin" ] && mv output/images/u-boot-lzo-with-spl.bin output/images/u-boot-lzo-with-spl_t20_128M.bin
# change uboot configuration
sed -i "s/BR2_TARGET_UBOOT_BOARDNAME=.*/BR2_TARGET_UBOOT_BOARDNAME=\"isvp_t20_sfcnor\"/g" .config
make uboot-dirclean
make uboot
[ -f "output/images/u-boot-lzo-with-spl.bin" ] && mv output/images/u-boot-lzo-with-spl.bin output/images/u-boot-lzo-with-spl_t20_64M.bin
# end uboot compilation
# constructs release with git hash label
echo "Compressing toolchain..."
tar -c -C "$WDIR"/output/host --transform s/./mipsel-ingenic-linux-uclibc/ --checkpoint=.1000 . | xz --best > "$CPW"/toolchain-$SHORTID.tar.xz
echo "Compressing rootfs images..."
tar -c -C "$WDIR"/output/images --transform s/./openfang-images/ --checkpoint=.1000 . | xz --best > "$CPW"/images-$SHORTID.tar.xz
echo "Build completed successfully."