1 # Copyright (C) 2011 The Android Open Source Project
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 if test "$RADIOSRC" = ""
19 if test "$BOOTLOADERSRC" = ""
21 BOOTLOADERSRC=bootloader.img
24 mkdir -p tmp/$PRODUCT-$VERSION
25 if test "$BOOTLOADERFILE" = ""
27 unzip -d tmp ${SRCPREFIX}$PRODUCT-target_files-$BUILD.zip RADIO/$BOOTLOADERSRC
29 if test "$RADIO" != ""
31 unzip -d tmp ${SRCPREFIX}$PRODUCT-target_files-$BUILD.zip RADIO/$RADIOSRC
33 if test "$CDMARADIO" != ""
35 unzip -d tmp ${SRCPREFIX}$PRODUCT-target_files-$BUILD.zip RADIO/radio-cdma.img
37 cp ${SRCPREFIX}$PRODUCT-img-$BUILD.zip tmp/$PRODUCT-$VERSION/image-$PRODUCT-$VERSION.zip
38 if test "$BOOTLOADERFILE" = ""
40 cp tmp/RADIO/$BOOTLOADERSRC tmp/$PRODUCT-$VERSION/bootloader-$DEVICE-$BOOTLOADER.img
42 cp $BOOTLOADERFILE tmp/$PRODUCT-$VERSION/bootloader-$DEVICE-$BOOTLOADER.img
44 if test "$RADIO" != ""
46 cp tmp/RADIO/$RADIOSRC tmp/$PRODUCT-$VERSION/radio-$DEVICE-$RADIO.img
48 if test "$CDMARADIO" != ""
50 cp tmp/RADIO/radio-cdma.img tmp/$PRODUCT-$VERSION/radio-cdma-$DEVICE-$CDMARADIO.img
52 if test "$SLEEPDURATION" = ""
56 cat > tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
59 # Copyright (C) 2011 The Android Open Source Project
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
65 # http://www.apache.org/licenses/LICENSE-2.0
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.
73 fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
74 fastboot reboot-bootloader
77 if test "$RADIO" != ""
79 cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
80 fastboot flash radio radio-$DEVICE-$RADIO.img
81 fastboot reboot-bootloader
85 if test "$CDMARADIO" != ""
87 cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
88 fastboot flash radio-cdma radio-cdma-$DEVICE-$CDMARADIO.img
89 fastboot reboot-bootloader
93 cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
94 fastboot -w update image-$PRODUCT-$VERSION.zip
96 chmod a+x tmp/$PRODUCT-$VERSION/flash-all.sh
97 cat > tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
100 # Copyright (C) 2011 The Android Open Source Project
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
106 # http://www.apache.org/licenses/LICENSE-2.0
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.
114 fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
115 fastboot reboot-bootloader
118 if test "$RADIO" != ""
120 cat >> tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
121 fastboot flash radio radio-$DEVICE-$RADIO.img
122 fastboot reboot-bootloader
126 if test "$CDMARADIO" != ""
128 cat >> tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
129 fastboot flash radio-cdma radio-cdma-$DEVICE-$CDMARADIO.img
130 fastboot reboot-bootloader
134 chmod a+x tmp/$PRODUCT-$VERSION/flash-base.sh
135 (cd tmp ; tar zcvf ../$PRODUCT-$VERSION-factory.tgz $PRODUCT-$VERSION)
136 mv $PRODUCT-$VERSION-factory.tgz $PRODUCT-$VERSION-factory-$(sha1sum < $PRODUCT-$VERSION-factory.tgz | cut -b -8).tgz