-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathal
More file actions
executable file
·216 lines (181 loc) · 3.53 KB
/
al
File metadata and controls
executable file
·216 lines (181 loc) · 3.53 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/bin/bash
# Helper script for the arm linux kernel and quemu.
# To compile the kernel buildroot is used.
# Configure this script here:
DEFAULT_CMD=emulate
ROOT_DIR="buildroot-2013.08.1"
IMG_PATH="output/images/zImage"
ROOTFS_PATH="output/images/rootfs.cpio.bz2"
BOARD="versatilepb"
SSH_IP="192.168.29.30"
#-------Configs------
CONFIG_DIR="../configs"
SAV_BR_CONFIG="$CONFIG_DIR/br.config"
#--------Script-------
cd $ROOT_DIR
rebuild()
{
clean
repack
compile
}
installD()
{
# !!
compile
}
compile()
{
loadBR
make
}
clean()
{
saveConfigs
make clean
}
config()
{
loadBR
make menuconfig
saveBR
}
configBB()
{
make busybox-menuconfig
saveBB
}
configK()
{
make linux-menuconfig
saveK
}
repack()
{
rmPack
pack
}
rmPack()
{
rm -f dl/show_uptime.tar.gz
rm -f dl/jefa_web.tar.gz
rm -f -r output/build/show_uptime-1.0/
rm -f -r output/build/jefa_web-1.0/
}
pack()
{
cd ../application
tar -czf show_uptime.tar.gz src
cd ../$ROOT_DIR
cd ../website
tar -czf jefa_web.tar.gz src
cd ../$ROOT_DIR
}
download()
{
make source
}
emulate()
{
QEMU_AUDIO_DRV=none qemu-system-arm -kernel $IMG_PATH \
-M $BOARD -nographic \
-initrd $ROOTFS_PATH \
-append "console=ttyAMA0" \
-net nic,macaddr=00:00:00:00:00:1B,vlan=0 \
-net vde,sock="/tmp/vde2-tap0.ctl",vlan=0
# -nographic: Redirect output (inclusive serial) to command line
# -serial: Redirect serial port (standard is stdio)
# -append "rdinit=/bin/sh" to start shell from initramfs (not /init)
}
debug()
{
QEMU_AUDIO_DRV=none qemu-system-arm -kernel $IMG_PATH \
-M $BOARD -nographic \
-initrd $ROOTFS_PATH \
-append "console=ttyAMA0" \
-S \
-gdb tcp::12345 \
-net nic,macaddr=00:00:00:00:00:1B,vlan=0 \
-net vde,sock="/tmp/vde2-tap0.ctl",vlan=0
}
gdb()
{
cd output/build/linux-3.10.7/
/opt/toolchains/Sourcery-CodeBench-ARM-2013.05/bin/arm-none-linux-gnueabi-gdb vmlinux
cd ../../..
}
control()
{
ssh -oBatchMode=yes -oStrictHostKeyChecking=no root@$SSH_IP
}
#---------Config----------
loadBR()
{
make defconfig BR2_DEFCONFIG="$SAV_BR_CONFIG"
}
saveConfigs()
{
saveBR
saveK
saveBB
}
saveK()
{
make linux-update-defconfig
}
saveBB()
{
make busybox-update-config
}
saveBR()
{
make savedefconfig
}
#---------Usage-----------
usage()
{
echo "Usage $0 [-c <command>]" 1>&2
echo -e "-c:\t\tCommand to execute:" 1>&2
echo -e "\t\tcompile, emulate, config, configBB, configKernel, refreshPackages, clean, defconfig, download, pack, control" 1>&2
echo -e "\t\t(Default is -c emulate)" 1>&2
exit 1
}
if [ $# -eq 0 ]
then
command=$DEFAULT_CMD
fi
while getopts ":c:h" opt; do
case $opt in
c)
command=$OPTARG
;;
h)
usage
;;
:)
echo "Option requires an argument." 1>&2
usage
;;
?)
echo "Invalid option." 1>&2
usage
;;
*)
echo "Unimplemented option." 1>&2
command=$DEFAULT_CMD
;;
esac
done
shift $(($OPTIND - 1))
if [ -z $command ]
then
command=$DEFAULT_CMD
fi
if [ $(type -t "$command") == "function" ]
then
echo "Running $command"
$command
else
echo "Unrecognized command." 1>&2
usage
fi