-
Notifications
You must be signed in to change notification settings - Fork 1
/
make-rtl865xb
executable file
·138 lines (116 loc) · 3.8 KB
/
make-rtl865xb
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/sh
INSTALL_DIR=/home/`whoami`/public
mkdir -vp ${INSTALL_DIR}/download
rm -vrf ./dl
ln -vs ${INSTALL_DIR}/download dl
download_component(){
# Download stripped Netgear kernel, sorry
wget -c -O dl/linux-2.4.26-rp614v4v106.tar.bz2 \
http://midge.vlad.org.ua/zig/source/rtl865xb/linux-2.4.26-rp614v4v106.tar.bz2
# Download pre-compiled toolchain, sorry
wget -c -O dl/toolchain_mips_nofpu-3.3.5.tar.bz2 \
http://midge.vlad.org.ua/zig/source/rtl865xb/toolchain_mips_nofpu-3.3.5.tar.bz2
# Download RTL865xB source for Flash
wget -c -O dl/rtl865x-flash.tgz \
http://midge.vlad.org.ua/zig/source/rtl865xb/rtl865x-flash.tgz
}
hack_toolchain(){
# This is very stupid install toolchain, sorry
STAGDIR="staging_dir_mips_nofpu"
#
rm -rf $STAGDIR; mkdir -p $STAGDIR
tar xvfj dl/toolchain_mips_nofpu-3.3.5.tar.bz2 -C $STAGDIR --strip-components 1 toolchain_mips_nofpu
ln -vf $STAGDIR/mips-linux-uclibc/lib/* $STAGDIR/lib/
#
mkdir -vp /opt/gcc-3.3.5/toolchain_build_mips_nofpu/ccache-2.3/cache
ln -vfs `pwd`/${STAGDIR} /opt/toolchain_mips_nofpu
mkdir $STAGDIR/stampfiles
touch \
$STAGDIR/stampfiles/.toolchain_binutils-compile \
$STAGDIR/stampfiles/.toolchain_binutils-install \
$STAGDIR/stampfiles/.toolchain_binutils-prepare \
$STAGDIR/stampfiles/.toolchain_gcc-compile \
$STAGDIR/stampfiles/.toolchain_gcc-install \
$STAGDIR/stampfiles/.toolchain_gcc-prepare \
$STAGDIR/stampfiles/.toolchain_gdb-compile \
$STAGDIR/stampfiles/.toolchain_gdb-install \
$STAGDIR/stampfiles/.toolchain_gdb-prepare \
$STAGDIR/stampfiles/.toolchain_kernel-headers-prepare \
$STAGDIR/stampfiles/.toolchain_libnotimpl-compile \
$STAGDIR/stampfiles/.toolchain_libnotimpl-install \
$STAGDIR/stampfiles/.toolchain_libnotimpl-prepare \
$STAGDIR/stampfiles/.toolchain_uClibc-compile \
$STAGDIR/stampfiles/.toolchain_uClibc-install \
$STAGDIR/stampfiles/.toolchain_uClibc-prepare
#
echo "3.3.5" > $STAGDIR/gcc_version
echo "0.9.27" > $STAGDIR/uclibc_version
}
clean_root(){
make clean_root
}
clean_linux(){
rm -rf build_mips_nofpu/linux*
}
clean_build(){
rm -rf build_mips_nofpu
}
install(){
mkdir -vp $INSTALL_DIR/firmware/
cp -va build_mips_nofpu/linux-2.4-rtl865xb/br6214k.bix $INSTALL_DIR/firmware/br6214k-`date +%Y%m%d%H%M`.bix
cp -vaf build_mips_nofpu/linux-2.4-rtl865xb/br6214k.bix /var/www/download/br6214k/br6214k.bix
chmod 644 /var/www/download/br6214k/br6214k.bix
#
mkdir -vp $INSTALL_DIR/packages-mips-midge-rtl865xb/
cp -vf bin/packages/* $INSTALL_DIR/packages-mips-midge-rtl865xb/
rm -vrf bin
}
build(){
local ver=$1
local config=$2
clean_linux
temp=`tempfile -p linux -s -config`
if [ -r target/linux/rtl865xb-$ver/config-$config ]; then
cp target/linux/rtl865xb-$ver/config $temp
cp target/linux/rtl865xb-$ver/config-$config target/linux/rtl865xb-$ver/config
fi
cp target/linux/rtl865xb-$ver/system-$config .config
make oldconfig DEVELOPER=1
make --jobs=2 V=99
ret=$?
if [ "$ret" = 0 ]; then
rename "s/.bin/-$config.bin/" bin/*
install $config
fi
if [ -s $temp ]; then
cp $temp target/linux/rtl865xb-$ver/config
fi
rm $temp
[ "$ret" != 0 ] && exit 1
}
make_snapshot() {
dir=$(basename `pwd`)
cd ..
mkdir -p $INSTALL_DIR/snapshot/
tar cvfj $INSTALL_DIR/snapshot/snapshot-`date +%Y%m%d%H%M`.tar.bz2 \
--exclude $dir/dl \
--exclude $dir/download \
--exclude $dir/bin \
--exclude $dir/build_mips \
--exclude $dir/build_mips_nofpu \
--exclude $dir/build_mipsel \
--exclude $dir/staging_dir_mips \
--exclude $dir/staging_dir_mips_nofpu \
--exclude $dir/staging_dir_mipsel \
--exclude $dir/toolchain_build_mips \
--exclude $dir/toolchain_build_mips_nofpu \
--exclude $dir/toolchain_build_mipsel \
$dir
}
download_component
hack_toolchain
#
clean_linux
clean_root
build 2.4 test-eddy
#make_snapshot