blob: b4e935c7e5b607a2f79a65bf160ec754c0a885aa [file] [log] [blame]
Jean-Baptiste Queru36cbd9a2012-04-02 11:01:12 -07001# Copyright (C) 2011 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15if test "$RADIOSRC" = ""
16then
17 RADIOSRC=radio.img
18fi
19if test "$BOOTLOADERSRC" = ""
20then
21 RADIOSRC=bootloader.img
22fi
23rm -rf tmp
24mkdir -p tmp/$PRODUCT-$VERSION
25unzip -d tmp signed-$PRODUCT-target_files-$BUILD.zip RADIO/$RADIOSRC RADIO/$BOOTLOADERSRC
26if test "$CDMARADIO" != ""
27then
28 unzip -d tmp signed-$PRODUCT-target_files-$BUILD.zip RADIO/radio-cdma.img
29fi
30cp signed-$PRODUCT-img-$BUILD.zip tmp/$PRODUCT-$VERSION/image-$PRODUCT-$VERSION.zip
31cp tmp/RADIO/$BOOTLOADERSRC tmp/$PRODUCT-$VERSION/bootloader-$DEVICE-$BOOTLOADER.img
32cp tmp/RADIO/$RADIOSRC tmp/$PRODUCT-$VERSION/radio-$DEVICE-$RADIO.img
33if test "$CDMARADIO" != ""
34then
35 cp tmp/RADIO/radio-cdma.img tmp/$PRODUCT-$VERSION/radio-cdma-$DEVICE-$CDMARADIO.img
36fi
37cat > tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
38#!/bin/sh
39
40# Copyright (C) 2011 The Android Open Source Project
41#
42# Licensed under the Apache License, Version 2.0 (the "License");
43# you may not use this file except in compliance with the License.
44# You may obtain a copy of the License at
45#
46# http://www.apache.org/licenses/LICENSE-2.0
47#
48# Unless required by applicable law or agreed to in writing, software
49# distributed under the License is distributed on an "AS IS" BASIS,
50# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
51# See the License for the specific language governing permissions and
52# limitations under the License.
53
54fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
55fastboot reboot-bootloader
56sleep 5
57fastboot flash radio radio-$DEVICE-$RADIO.img
58fastboot reboot-bootloader
59sleep 5
60EOF
61if test "$CDMARADIO" != ""
62then
63cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
64fastboot flash radio-cdma radio-cdma-$DEVICE-$CDMARADIO.img
65fastboot reboot-bootloader
66sleep 5
67EOF
68fi
69cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
70fastboot -w update image-$PRODUCT-$VERSION.zip
71EOF
72chmod a+x tmp/$PRODUCT-$VERSION/flash-all.sh
73cat > tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
74#!/bin/sh
75
76# Copyright (C) 2011 The Android Open Source Project
77#
78# Licensed under the Apache License, Version 2.0 (the "License");
79# you may not use this file except in compliance with the License.
80# You may obtain a copy of the License at
81#
82# http://www.apache.org/licenses/LICENSE-2.0
83#
84# Unless required by applicable law or agreed to in writing, software
85# distributed under the License is distributed on an "AS IS" BASIS,
86# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
87# See the License for the specific language governing permissions and
88# limitations under the License.
89
90fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
91fastboot reboot-bootloader
92sleep 5
93fastboot flash radio radio-$DEVICE-$RADIO.img
94fastboot reboot-bootloader
95sleep 5
96EOF
97if test "$CDMARADIO" != ""
98then
99cat >> tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
100fastboot flash radio-cdma radio-cdma-$DEVICE-$CDMARADIO.img
101fastboot reboot-bootloader
102sleep 5
103EOF
104fi
105chmod a+x tmp/$PRODUCT-$VERSION/flash-base.sh
106(cd tmp ; tar zcvf ../$PRODUCT-$VERSION-factory.tgz $PRODUCT-$VERSION)
107mv $PRODUCT-$VERSION-factory.tgz $PRODUCT-$VERSION-factory-$(sha1sum < $PRODUCT-$VERSION-factory.tgz | cut -b -8).tgz
108rm -rf tmp