• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 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  BOOTLOADERSRC=bootloader.img
22fi
23rm -rf tmp
24mkdir -p tmp/$PRODUCT-$VERSION
25if test "$BOOTLOADERFILE" = ""
26then
27  unzip -d tmp ${SRCPREFIX}$PRODUCT-target_files-$BUILD.zip RADIO/$BOOTLOADERSRC
28fi
29if test "$RADIO" != ""
30then
31  unzip -d tmp ${SRCPREFIX}$PRODUCT-target_files-$BUILD.zip RADIO/$RADIOSRC
32fi
33if test "$CDMARADIO" != ""
34then
35  unzip -d tmp ${SRCPREFIX}$PRODUCT-target_files-$BUILD.zip RADIO/radio-cdma.img
36fi
37cp ${SRCPREFIX}$PRODUCT-img-$BUILD.zip tmp/$PRODUCT-$VERSION/image-$PRODUCT-$VERSION.zip
38if test "$BOOTLOADERFILE" = ""
39then
40  cp tmp/RADIO/$BOOTLOADERSRC tmp/$PRODUCT-$VERSION/bootloader-$DEVICE-$BOOTLOADER.img
41else
42  cp $BOOTLOADERFILE tmp/$PRODUCT-$VERSION/bootloader-$DEVICE-$BOOTLOADER.img
43fi
44if test "$RADIO" != ""
45then
46  cp tmp/RADIO/$RADIOSRC tmp/$PRODUCT-$VERSION/radio-$DEVICE-$RADIO.img
47fi
48if test "$CDMARADIO" != ""
49then
50  cp tmp/RADIO/radio-cdma.img tmp/$PRODUCT-$VERSION/radio-cdma-$DEVICE-$CDMARADIO.img
51fi
52if test "$SLEEPDURATION" = ""
53then
54  SLEEPDURATION=5
55fi
56cat > tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
57#!/bin/sh
58
59# Copyright (C) 2011 The Android Open Source Project
60#
61# Licensed under the Apache License, Version 2.0 (the "License");
62# you may not use this file except in compliance with the License.
63# You may obtain a copy of the License at
64#
65#      http://www.apache.org/licenses/LICENSE-2.0
66#
67# Unless required by applicable law or agreed to in writing, software
68# distributed under the License is distributed on an "AS IS" BASIS,
69# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
70# See the License for the specific language governing permissions and
71# limitations under the License.
72
73fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
74fastboot reboot-bootloader
75sleep $SLEEPDURATION
76EOF
77if test "$RADIO" != ""
78then
79cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
80fastboot flash radio radio-$DEVICE-$RADIO.img
81fastboot reboot-bootloader
82sleep $SLEEPDURATION
83EOF
84fi
85if test "$CDMARADIO" != ""
86then
87cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
88fastboot flash radio-cdma radio-cdma-$DEVICE-$CDMARADIO.img
89fastboot reboot-bootloader
90sleep $SLEEPDURATION
91EOF
92fi
93cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
94fastboot -w update image-$PRODUCT-$VERSION.zip
95EOF
96chmod a+x tmp/$PRODUCT-$VERSION/flash-all.sh
97cat > tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
98#!/bin/sh
99
100# Copyright (C) 2011 The Android Open Source Project
101#
102# Licensed under the Apache License, Version 2.0 (the "License");
103# you may not use this file except in compliance with the License.
104# You may obtain a copy of the License at
105#
106#      http://www.apache.org/licenses/LICENSE-2.0
107#
108# Unless required by applicable law or agreed to in writing, software
109# distributed under the License is distributed on an "AS IS" BASIS,
110# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
111# See the License for the specific language governing permissions and
112# limitations under the License.
113
114fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
115fastboot reboot-bootloader
116sleep $SLEEPDURATION
117EOF
118if test "$RADIO" != ""
119then
120cat >> tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
121fastboot flash radio radio-$DEVICE-$RADIO.img
122fastboot reboot-bootloader
123sleep $SLEEPDURATION
124EOF
125fi
126if test "$CDMARADIO" != ""
127then
128cat >> tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
129fastboot flash radio-cdma radio-cdma-$DEVICE-$CDMARADIO.img
130fastboot reboot-bootloader
131sleep $SLEEPDURATION
132EOF
133fi
134chmod a+x tmp/$PRODUCT-$VERSION/flash-base.sh
135(cd tmp ; tar zcvf ../$PRODUCT-$VERSION-factory.tgz $PRODUCT-$VERSION)
136mv $PRODUCT-$VERSION-factory.tgz $PRODUCT-$VERSION-factory-$(sha1sum < $PRODUCT-$VERSION-factory.tgz | cut -b -8).tgz
137rm -rf tmp
138