blob: 348edd59203f12f027dd007e71fcd56a93319a8b (
plain)
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
|
#!/bin/sh
#user_name=`whoami`
#if [ $user_name != "root" ]
#then
# echo "Please execute this program with sudo"
# return 1
#fi
LAST_P_VER="6.0"
P_VER_LIST="4.0 5.0 5.5 6.0"
if [ "x$TOPDIR" = "x" ]
then
TOPDIR=./
fi
if [ "x$INFO_DIR" = "x" ]
then
echo "There is no information directory."
exit 1
fi
if [ ! -e $INFO_DIR/.info_list.txt ]
then
echo "There is no infomation file."
exit 1
fi
if [ ! -e $INFO_DIR/.image_list.txt ]
then
echo "There is no image list file."
exit 1
fi
if [ ! -e $INFO_DIR/.part_info.txt ]
then
echo "There is no partition info file."
exit 1
fi
########## including variables ##########
. $INFO_DIR/.info_list.txt
echo $TBB_INFO_PLATFORM_VERSION
echo $TBB_INFO_SNAPSHOT_ID
echo $TBB_INFO_IMAGE_NAME
echo $TBB_INFO_DL_DIR="${TOPDIR}/dl"
########## checking arguments ##########
S_VER=$TBB_INFO_SNAPSHOT_ID
P_VER=$TBB_INFO_PLATFORM_VERSION
P_VER=$P_VER-
echo $P_VER | grep -q "${LAST_P_VER}-$"
if [ $? = 0 ]
then
P_VER=""
else
VALID="0"
for PV in $P_VER_LIST
do
if [ "${PV}-" = "${P_VER}" ]
then
VALID="1"
break
fi
done
if [ $VALID = "0" ]
then
echo "Invalid platform version : $P_VER"
echo -n "format : $P_VER_LIST"
exit 2
fi
fi
if [ $S_VER != "latest" ]
then
echo $S_VER | grep -q "[0-9]\{8\}[.][0-9]$"
if [ $? != 0 && $S_VER != "latest" ]
then
echo "Invalid snapshot version : $S_VER"
echo "format is yyyymmdd.n"
exit 2
fi
S_PATH=tizen-"$P_VER"unified_"$S_VER"
else
S_PATH=$S_VER
fi
INDEX_LOC=http://download.tizen.org/snapshots/tizen/"$P_VER"unified/"$S_PATH"/images/standard/iot-headed-3parts-armv7l-rpi/
echo $INDEX_LOC
wget -q -np -nd -P . $INDEX_LOC
KS_FILE=`grep ks index.html | sed -e 's/^.\+\"\(tizen-.\+\)\".\+$/\1/'`
echo $KS_FILE
rm -f index.html
########## Set varaiables ##########
########## We use rpi headed ks file because it is the same to artik ##########
KS_LOC=http://download.tizen.org/snapshots/tizen/"$P_VER"unified/"$S_PATH"/images/standard/iot-headed-3parts-armv7l-rpi/"$KS_FILE"
DOWNDIR=$TBB_INFO_DL_DIR
if [ "x$BUILD_DIR" = "x" ]
then
BUILD_DIR=./build
fi
IMG_LIST=$INFO_DIR/.image_list.txt
if [ ! -e $DOWNDIR ]
then
mkdir $DOWNDIR
fi
if [ ! -e $BUILD_DIR ]
then
mkdir $BUILD_DIR
fi
########## function : downloading ks files ##########
download_ks_file() {
if [ ! -e $DOWNDIR/$KS_FILE ]
then
wget -r -np -nd -P $DOWNDIR $KS_LOC
return $?
fi
}
########## function : making ks files ##########
### input, list, output
update_building_block_list() {
sed -e '/%packages/,/%end/{/%packages/!{/%end/!d}}' $1 > $3
exec < $2
BB_LIST="\\\n"
while read A
do
if [ $A = "libstdcpp-devel" ]
then
A="libstdc++-devel"
fi
if [ $A = "libsigcpp-devel" ]
then
A="libsigc++-devel"
fi
if [ $A = "libxmlpp-devel" ]
then
A="libsigc++-devel"
fi
BB_LIST="$BB_LIST""$A""\n"
done
sed -i "/%packages/a $BB_LIST" $3
#### Adding custom repo ####
REPO_LIST="${TBB_INFO_PRIVATE_REPO1} ${TBB_INFO_PRIVATE_REPO2} ${TBB_INFO_PRIVATE_REPO3}"
ADD_REPO_LIST="\\\n"
for X in $REPO_LIST
do
REPO="repo --name=repo1 --baseurl=$X --priority=1 --ssl_verify=no"
ADD_REPO_LIST="${ADD_REPO_LIST}${REPO}\n"
done
if [ ! "$ADD_REPO_LIST" = "\\\n" ]
then
echo "Adding Custom repositories..."
sed -i "/repo --name=base_arm/a $ADD_REPO_LIST" $3
fi
#### Changing locale ####
LANG_EN=`grep building-blocks-root-Preset_iot_headed $IMG_LIST`
if [ $? = 0 ]
then
sed -i 's/lang C/lang en_US.UTF-8/g' $3
fi
}
########## function : downlading & update partition ##########
PART_FILE=common-3parts-ramdisk-recovery
PART_LOC=https://git.tizen.org/cgit/profile/common/meta/plain/partitions/common-3parts-ramdisk-recovery?h=tizen_5.0
download_update_partition() {
if [ ! -e $DOWNDIR/$PART_FILE ]
then
wget -r -np -nd -P $DOWNDIR $PART_LOC -O $DOWNDIR/$PART_FILE
if [$? != 0 ]
then
return $?
fi
fi
### Remove original partition ###
sed -i '/^part .\+/d' $1
### Add new partition ###
PART3=n
RAMDISK=n
RECOVERY=n
grep 3part $INFO_DIR/.part_info.txt > /dev/null
if [ $? = 0 ]
then
PART3=y
fi
grep ramdisk $INFO_DIR/.part_info.txt > /dev/null
if [ $? = 0 ]
then
RAMDISK=y
fi
grep recovery $INFO_DIR/.part_info.txt > /dev/null
if [ $? = 0 ]
then
RECOVERY=y
fi
exec < $DOWNDIR/$PART_FILE
PART_LIST="\\\n"
while read A
do
if [ "x$PART3" = "xn" ]
then
echo $A | grep "/opt/usr "
if [ $? = 0 ]
then
continue
fi
fi
if [ "x$RAMDISK" = "xn" ]
then
echo $A | grep "/mnt/initrd "
if [ $? = 0 ]
then
continue
fi
fi
if [ "x$RECOVERY" = "xn" ]
then
echo $A | grep "/mnt/initrd-recovery "
if [ $? = 0 ]
then
continue
fi
fi
PART_LIST="$PART_LIST""$A""\n"
done
sed -i "/timezone.\+/a $PART_LIST" $1
}
echo "1. download ks files : snapshot-tizen-"$P_VER""$S_VER""
download_ks_file
if [ $? != 0 ]
then
"Downlading ks file is failed!!!"
exit 3
fi
echo "2. update the image list to ks file"
update_building_block_list $DOWNDIR/$KS_FILE $IMG_LIST $BUILD_DIR/tic-"$P_VER""$S_VER".ks
echo "3. update the partition information"
download_update_partition $BUILD_DIR/tic-"$P_VER""$S_VER".ks
if [ $? != 0 ]
then
echo "Processing partition is failed!!!"
exit 4
fi
echo "4. make a image"
OUTPUT_FILE=$BUILD_DIR/"$TBB_INFO_IMAGE_NAME"-"$P_VER""$S_VER"_armv7l.tar.gz
if [ -e $OUTPUT_FILE ]
then
mv $OUTPUT_FILE "$OUTPUT_FILE"-`date +%Y%m%d%H%M`
fi
cd $BUILD_DIR
sudo mic cr loop tic-"$P_VER""$S_VER".ks --outdir=./ --pack-to=$OUTPUT_FILE --arch=armv7l --logfile=./tizen-"$P_VER""$S_VER"-`date +%Y%m%d%H%M`_armv7l.log --tmpfs
mic_result=$?
cd $TOPDIR
if [ $mic_result != 0 ]
then
exit 4
fi
echo "5. Done"
exit 0
|