forked from beagleboard/image-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrcn-ee_image.sh
executable file
·373 lines (305 loc) · 9.4 KB
/
rcn-ee_image.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
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
#!/bin/sh -e
#
# Copyright (c) 2009-2014 Robert Nelson <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
SYST=$(uname -n)
time=$(date +%Y-%m-%d)
DIR=$PWD
if [ ! -d ${DIR}/ignore ] ; then
mkdir -p ${DIR}/ignore
fi
tempdir=$(mktemp -d -p ${DIR}/ignore)
if [ -f ${DIR}/config ] ; then
. ${DIR}/config
fi
image_type="console"
wheezy_release="7.3"
minimal_armel () {
rm -f "${DIR}/.project" || true
#Actual Releases will use version numbers..
case "${release}" in
wheezy)
#http://www.debian.org/releases/wheezy/
export_filename="${distro}-${wheezy_release}-${image_type}-${dpkg_arch}-${time}"
;;
quantal)
export_filename="${distro}-12.10-${image_type}-${dpkg_arch}-${time}"
;;
raring)
export_filename="${distro}-13.04-${image_type}-${dpkg_arch}-${time}"
;;
saucy)
export_filename="${distro}-13.10-${image_type}-${dpkg_arch}-${time}"
;;
*)
export_filename="${distro}-${release}-${image_type}-${dpkg_arch}-${time}"
;;
esac
# if [ -f ${DIR}/release ] ; then
# chroot_KERNEL_HTTP_DIR="\
#http://rcn-ee.net/deb/${release}-${dpkg_arch}/v3.13.0-armv7-x9/ \
#http://rcn-ee.net/deb/${release}-${dpkg_arch}/v3.8.13-bone37/"
# fi
tempdir=$(mktemp -d -p ${DIR}/ignore)
cat > ${DIR}/.project <<-__EOF__
tempdir="${tempdir}"
export_filename="${export_filename}"
distro="${distro}"
release="${release}"
dpkg_arch="${dpkg_arch}"
time="${time}"
deb_mirror="${deb_mirror}"
deb_components="${deb_components}"
apt_proxy="${apt_proxy}"
include_pkgs_list="${include_pkgs_list}"
exclude_pkgs_list="${exclude_pkgs_list}"
base_pkg_list="${base_pkg_list}"
image_hostname="${image_hostname}"
user_name="${user_name}"
full_name="${full_name}"
password="${password}"
include_firmware="${include_firmware}"
chroot_very_small_image="${chroot_very_small_image}"
chroot_generic_startup_scripts="${chroot_generic_startup_scripts}"
chroot_ENABLE_DEB_SRC="${chroot_ENABLE_DEB_SRC}"
chroot_KERNEL_HTTP_DIR="${chroot_KERNEL_HTTP_DIR}"
chroot_enable_bborg_repo="${chroot_enable_bborg_repo}"
chroot_COPY_SETUP_SDCARD="${chroot_COPY_SETUP_SDCARD}"
chroot_hook="${chroot_hook}"
chroot_script="${chroot_script}"
chroot_uenv_txt="${chroot_uenv_txt}"
__EOF__
cat ${DIR}/.project
/bin/sh -e "${DIR}/RootStock-NG.sh" || { exit 1 ; }
}
compression () {
echo "Starting Compression"
cd ${DIR}/deploy/
tar cvf ${export_filename}.tar ./${export_filename}
if [ -f ${DIR}/release ] ; then
if [ "x${SYST}" = "x${RELEASE_HOST}" ] ; then
if [ -d /mnt/farm/testing/pending/ ] ; then
cp -v ${export_filename}.tar /mnt/farm/testing/pending/${export_filename}.tar
fi
fi
elif [ -f ${DIR}/compress ] ; then
xz -z -7 -v "${export_filename}.tar"
if [ -n "${release_dir}" ] ; then
mv "${export_filename}.tar.xz" "${release_dir}"
fi
fi
cd ${DIR}/
}
production () {
echo "Starting Production Stage"
cd ${DIR}/deploy/
unset actual_dir
if [ -f ${DIR}/release ] ; then
if [ "x${SYST}" = "x${RELEASE_HOST}" ] ; then
if [ -d /mnt/farm/testing/pending/ ] ; then
cp -v arm*.tar /mnt/farm/images/
actual_dir="/mnt/farm/testing/pending"
fi
fi
fi
cat > ${DIR}/deploy/gift_wrap_final_images.sh <<-__EOF__
#!/bin/bash
#This script's only purpose is to remember a mundane task from release to release for the release manager.
xz -z -7 -v ubuntu-13.04-${image_type}-armhf-${time}.tar
xz -z -7 -v ubuntu-13.10-${image_type}-armhf-${time}.tar
xz -z -7 -v ubuntu-trusty-${image_type}-armhf-${time}.tar
xz -z -7 -v debian-${wheezy_release}-${image_type}-armhf-${time}.tar
xz -z -7 -v debian-jessie-${image_type}-armhf-${time}.tar
tar xf debian-${wheezy_release}-${image_type}-armhf-${time}.tar.xz
tar xf ubuntu-13.10-${image_type}-armhf-${time}.tar.xz
cd debian-${wheezy_release}-${image_type}-armhf-${time}/
sudo ./setup_sdcard.sh --img BBB-eMMC-flasher-debian-${wheezy_release}-${time} --uboot bone --beagleboard.org-production --bbb-flasher
sudo ./setup_sdcard.sh --img bone-debian-${wheezy_release}-${time} --uboot bone --beagleboard.org-production
mv *.img ../
cd ..
rm -rf debian-${wheezy_release}-${image_type}-armhf-${time}/ || true
cd ubuntu-13.10-${image_type}-armhf-${time}/
sudo ./setup_sdcard.sh --img BBB-eMMC-flasher-ubuntu-13.10-${time}.img --uboot bone --beagleboard.org-production --bbb-flasher
sudo ./setup_sdcard.sh --img bone-ubuntu-13.10-${time}.img --uboot bone --beagleboard.org-production
mv *.img ../
cd ..
rm -rf ubuntu-13.10-${image_type}-armhf-${time}/ || true
xz -z -7 -v BBB-eMMC-flasher-debian-${wheezy_release}-${time}-2gb.img
xz -z -7 -v bone-debian-${wheezy_release}-${time}-2gb.img
xz -z -7 -v BBB-eMMC-flasher-ubuntu-13.10-${time}-2gb.img
xz -z -7 -v bone-ubuntu-13.10-${time}-2gb.img
__EOF__
chmod +x ${DIR}/deploy/gift_wrap_final_images.sh
if [ ! "x${actual_dir}" = "x" ] ; then
cp ${DIR}/deploy/gift_wrap_final_images.sh ${actual_dir}/gift_wrap_final_images.sh
chmod +x ${actual_dir}/gift_wrap_final_images.sh
fi
cd ${DIR}/
}
kernel_chooser () {
if [ -f ${tempdir}/LATEST-${SUBARCH} ] ; then
rm -rf ${tempdir}/LATEST-${SUBARCH} || true
fi
wget --no-verbose --directory-prefix=${tempdir}/ http://rcn-ee.net/deb/${release}-${dpkg_arch}/LATEST-${SUBARCH}
FTP_DIR=$(cat ${tempdir}/LATEST-${SUBARCH} | grep "ABI:1 ${KERNEL_ABI}" | awk '{print $3}')
FTP_DIR=$(echo ${FTP_DIR} | awk -F'/' '{print $6}')
}
select_rcn_ee_net_kernel () {
SUBARCH="armv7"
KERNEL_ABI="STABLE"
kernel_chooser
chroot_KERNEL_HTTP_DIR="${mirror}/${release}-${dpkg_arch}/${FTP_DIR}/"
SUBARCH="omap-psp"
KERNEL_ABI="STABLE"
kernel_chooser
chroot_KERNEL_HTTP_DIR="${chroot_KERNEL_HTTP_DIR} ${mirror}/${release}-${dpkg_arch}/${FTP_DIR}/"
}
pkg_list () {
base_pkg_list=""
if [ ! "x${no_pkgs}" = "xenable" ] ; then
. ${DIR}/var/pkg_list.sh
include_pkgs_list="git-core,initramfs-tools,locales,sudo,wget"
if [ "x${include_firmware}" = "xenable" ] ; then
base_pkg_list="${base_pkgs} ${extra_pkgs} ${firmware_pkgs}"
else
base_pkg_list="${base_pkgs} ${extra_pkgs}"
fi
fi
}
is_ubuntu () {
image_hostname="arm"
distro="ubuntu"
user_name="ubuntu"
password="temppwd"
full_name="Demo User"
deb_mirror="ports.ubuntu.com/ubuntu-ports/"
deb_components="main universe multiverse"
pkg_list
}
is_debian () {
image_hostname="arm"
distro="debian"
user_name="debian"
password="temppwd"
full_name="Demo User"
deb_mirror="ftp.us.debian.org/debian/"
deb_components="main contrib non-free"
pkg_list
exclude_pkgs_list=""
# chroot_very_small_image="enable"
}
#12.10
quantal_release () {
extra_pkgs="devmem2"
firmware_pkgs="linux-firmware"
is_ubuntu
release="quantal"
select_rcn_ee_net_kernel
minimal_armel
compression
}
#13.04
raring_release () {
extra_pkgs="devmem2"
firmware_pkgs="linux-firmware"
is_ubuntu
release="raring"
select_rcn_ee_net_kernel
minimal_armel
compression
}
#13.10
saucy_release () {
extra_pkgs="devmem2"
firmware_pkgs="linux-firmware"
is_ubuntu
release="saucy"
select_rcn_ee_net_kernel
minimal_armel
compression
}
#14.04
trusty_release () {
extra_pkgs="devmem2"
firmware_pkgs="linux-firmware"
is_ubuntu
release="trusty"
select_rcn_ee_net_kernel
minimal_armel
compression
}
wheezy_release () {
extra_pkgs="systemd"
firmware_pkgs="atmel-firmware firmware-ralink firmware-realtek libertas-firmware zd1211-firmware"
is_debian
release="wheezy"
select_rcn_ee_net_kernel
minimal_armel
compression
}
jessie_release () {
extra_pkgs="systemd"
firmware_pkgs="atmel-firmware firmware-ralink firmware-realtek libertas-firmware zd1211-firmware"
is_debian
release="jessie"
select_rcn_ee_net_kernel
minimal_armel
compression
}
sid_release () {
extra_pkgs="systemd"
firmware_pkgs="atmel-firmware firmware-ralink firmware-realtek libertas-firmware zd1211-firmware"
is_debian
release="sid"
select_rcn_ee_net_kernel
minimal_armel
compression
}
if [ -f ${DIR}/releases.sh ] ; then
. ${DIR}/releases.sh
fi
if [ ! "${apt_proxy}" ] ; then
apt_proxy=""
fi
if [ ! "${mirror}" ] ; then
mirror="http://rcn-ee.net/deb"
fi
if [ -f ${DIR}/rcn-ee.host ] ; then
. ${DIR}/host/rcn-ee-host.sh
fi
mkdir -p ${DIR}/deploy/
if [ -f ${DIR}/release ] ; then
chroot_ENABLE_DEB_SRC="enable"
fi
chroot_COPY_SETUP_SDCARD="enable"
#FIXME: things to add to .config:
include_firmware="enable"
chroot_generic_startup_scripts="enable"
#chroot_script=""
#chroot_enable_bborg_repo=""
#no_pkgs="enable"
dpkg_arch="armhf"
DEFAULT_RELEASES="raring saucy trusty wheezy jessie"
for REL in ${RELEASES:-$DEFAULT_RELEASES} ; do
${REL}_release
done
production
rm -rf ${tempdir} || true
echo "done"