forked from beagleboard/image-builder
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbeagleboard.org_stretch_image.sh
executable file
·141 lines (109 loc) · 5.61 KB
/
beagleboard.org_stretch_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
#!/bin/bash -e
time=$(date +%Y-%m-%d)
DIR="$PWD"
./RootStock-NG.sh -c bb.org-debian-stretch-console-v4.14
./RootStock-NG.sh -c bb.org-debian-stretch-iot-v4.14
./RootStock-NG.sh -c bb.org-debian-stretch-lxqt-v4.14
./RootStock-NG.sh -c bb.org-debian-stretch-lxqt-xm
debian_stretch_console="debian-9.13-console-armhf-${time}"
debian_stretch_iot="debian-9.13-iot-armhf-${time}"
debian_stretch_lxqt="debian-9.13-lxqt-armhf-${time}"
debian_stretch_lxqt_xm="debian-9.13-lxqt-xm-armhf-${time}"
archive="xz -z -8 -v"
beaglebone="--dtb beaglebone --rootfs_label rootfs --hostname beaglebone --enable-cape-universal"
pru_rproc_v414ti="--enable-uboot-pru-rproc-414ti"
pru_rproc_v419ti="--enable-uboot-pru-rproc-419ti"
pru_rproc_mainline="--enable-mainline-pru-rproc"
pru_uio_v419="--enable-uboot-pru-uio-419"
beagle_xm="--dtb omap3-beagle-xm --rootfs_label rootfs --hostname beagleboard"
beagle_x15="--dtb am57xx-beagle-x15 --rootfs_label rootfs --hostname BeagleBoard-X15"
cat > ${DIR}/deploy/gift_wrap_final_images.sh <<-__EOF__
#!/bin/bash
archive_base_rootfs () {
if [ -d ./\${base_rootfs} ] ; then
rm -rf \${base_rootfs} || true
fi
if [ -f \${base_rootfs}.tar ] ; then
${archive} \${base_rootfs}.tar && sha256sum \${base_rootfs}.tar.xz > \${base_rootfs}.tar.xz.sha256sum &
fi
}
extract_base_rootfs () {
if [ -d ./\${base_rootfs} ] ; then
rm -rf \${base_rootfs} || true
fi
if [ -f \${base_rootfs}.tar.xz ] ; then
tar xf \${base_rootfs}.tar.xz
else
if [ -f \${base_rootfs}.tar ] ; then
tar xf \${base_rootfs}.tar
fi
fi
}
archive_img () {
if [ -f \${wfile}.img ] ; then
#prevent xz warning for 'Cannot set the file group: Operation not permitted'
sudo chown 1000:1000 \${wfile}.img
if [ ! -f \${wfile}.bmap ] ; then
if [ -f /usr/bin/bmaptool ] ; then
bmaptool create -o \${wfile}.bmap \${wfile}.img
fi
fi
${archive} \${wfile}.img && sha256sum \${wfile}.img.xz > \${wfile}.img.xz.sha256sum &
fi
}
generate_img () {
if [ ! "x\${base_rootfs}" = "x" ] ; then
if [ -d \${base_rootfs}/ ] ; then
cd \${base_rootfs}/
sudo ./setup_sdcard.sh \${options}
mv *.img ../ || true
mv *.job.txt ../ || true
cd ..
fi
fi
}
###console image (stretch):
base_rootfs="${debian_stretch_console}" ; blend="stretch-console" ; extract_base_rootfs
options="--img-1gb am57xx-\${base_rootfs} ${beagle_x15}" ; generate_img
options="--img-1gb bone-\${base_rootfs} ${beaglebone} ${pru_rproc_v414ti}" ; generate_img
###iot image (stretch):
base_rootfs="${debian_stretch_iot}" ; blend="stretch-iot" ; extract_base_rootfs
options="--img-4gb am57xx-\${base_rootfs} ${beagle_x15}" ; generate_img
options="--img-4gb bone-\${base_rootfs} ${beaglebone} ${pru_rproc_v414ti}" ; generate_img
options="--img-4gb BBB-blank-\${base_rootfs} ${beaglebone} ${pru_rproc_v414ti} --emmc-flasher" ; generate_img
options="--img-4gb BBBL-blank-\${base_rootfs} ${beaglebone} ${pru_rproc_v414ti} --bbbl-flasher" ; generate_img
###lxqt image (stretch):
base_rootfs="${debian_stretch_lxqt}" ; blend="stretch-lxqt" ; extract_base_rootfs
options="--img-4gb am57xx-\${base_rootfs} ${beagle_x15}" ; generate_img
options="--img-4gb am57xx-blank-\${base_rootfs} ${beagle_x15} --emmc-flasher --am57xx-x15-revc-flasher" ; generate_img
options="--img-4gb bone-\${base_rootfs} ${beaglebone} ${pru_rproc_v414ti}" ; generate_img
options="--img-4gb BBB-blank-\${base_rootfs} ${beaglebone} ${pru_rproc_v414ti} --emmc-flasher" ; generate_img
###lxqt image (stretch):
base_rootfs="${debian_stretch_lxqt_xm}" ; blend="stretch-lxqt-xm" ; extract_base_rootfs
options="--img-4gb bbxm-\${base_rootfs} ${beagle_xm}" ; generate_img
###archive *.tar
base_rootfs="${debian_stretch_console}" ; blend="stretch-console" ; archive_base_rootfs
base_rootfs="${debian_stretch_iot}" ; blend="stretch-iot" ; archive_base_rootfs
base_rootfs="${debian_stretch_lxqt}" ; blend="stretch-lxqt" ; archive_base_rootfs
base_rootfs="${debian_stretch_lxqt_xm}" ; blend="stretch-lxqt-xm" ; archive_base_rootfs
###console image (stretch):
base_rootfs="${debian_stretch_console}" ; blend="stretch-console"
wfile="am57xx-\${base_rootfs}-1gb" ; archive_img
wfile="bone-\${base_rootfs}-1gb" ; archive_img
###iot image (stretch):
base_rootfs="${debian_stretch_iot}" ; blend="stretch-iot"
wfile="am57xx-\${base_rootfs}-4gb" ; archive_img
wfile="bone-\${base_rootfs}-4gb" ; archive_img
wfile="BBB-blank-\${base_rootfs}-4gb" ; archive_img
wfile="BBBL-blank-\${base_rootfs}-4gb" ; archive_img
###lxqt image (stretch):
base_rootfs="${debian_stretch_lxqt}" ; blend="stretch-lxqt"
wfile="am57xx-\${base_rootfs}-4gb" ; archive_img
wfile="am57xx-blank-\${base_rootfs}-4gb" ; archive_img
wfile="bone-\${base_rootfs}-4gb" ; archive_img
wfile="BBB-blank-\${base_rootfs}-4gb" ; archive_img
###lxqt-xm image (stretch):
base_rootfs="${debian_stretch_lxqt_xm}" ; blend="stretch-lxqt-xm"
wfile="bbxm-\${base_rootfs}-4gb" ; archive_img
__EOF__
chmod +x ${DIR}/deploy/gift_wrap_final_images.sh