OSDN Git Service

am 7e33db5d: Add grouper
[android-x86/device-common.git] / generate-factory-images-common.sh
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
15 if test "$RADIOSRC" = ""
16 then
17   RADIOSRC=radio.img
18 fi
19 if test "$BOOTLOADERSRC" = ""
20 then
21   BOOTLOADERSRC=bootloader.img
22 fi
23 rm -rf tmp
24 mkdir -p tmp/$PRODUCT-$VERSION
25 unzip -d tmp signed-$PRODUCT-target_files-$BUILD.zip RADIO/$RADIOSRC RADIO/$BOOTLOADERSRC
26 if test "$CDMARADIO" != ""
27 then
28   unzip -d tmp signed-$PRODUCT-target_files-$BUILD.zip RADIO/radio-cdma.img
29 fi
30 cp signed-$PRODUCT-img-$BUILD.zip tmp/$PRODUCT-$VERSION/image-$PRODUCT-$VERSION.zip
31 cp tmp/RADIO/$BOOTLOADERSRC tmp/$PRODUCT-$VERSION/bootloader-$DEVICE-$BOOTLOADER.img
32 cp tmp/RADIO/$RADIOSRC tmp/$PRODUCT-$VERSION/radio-$DEVICE-$RADIO.img
33 if test "$CDMARADIO" != ""
34 then
35   cp tmp/RADIO/radio-cdma.img tmp/$PRODUCT-$VERSION/radio-cdma-$DEVICE-$CDMARADIO.img
36 fi
37 cat > 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
54 fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
55 fastboot reboot-bootloader
56 sleep 5
57 fastboot flash radio radio-$DEVICE-$RADIO.img
58 fastboot reboot-bootloader
59 sleep 5
60 EOF
61 if test "$CDMARADIO" != ""
62 then
63 cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
64 fastboot flash radio-cdma radio-cdma-$DEVICE-$CDMARADIO.img
65 fastboot reboot-bootloader
66 sleep 5
67 EOF
68 fi
69 cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
70 fastboot -w update image-$PRODUCT-$VERSION.zip
71 EOF
72 chmod a+x tmp/$PRODUCT-$VERSION/flash-all.sh
73 cat > 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
90 fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
91 fastboot reboot-bootloader
92 sleep 5
93 fastboot flash radio radio-$DEVICE-$RADIO.img
94 fastboot reboot-bootloader
95 sleep 5
96 EOF
97 if test "$CDMARADIO" != ""
98 then
99 cat >> tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
100 fastboot flash radio-cdma radio-cdma-$DEVICE-$CDMARADIO.img
101 fastboot reboot-bootloader
102 sleep 5
103 EOF
104 fi
105 chmod a+x tmp/$PRODUCT-$VERSION/flash-base.sh
106 (cd tmp ; tar zcvf ../$PRODUCT-$VERSION-factory.tgz $PRODUCT-$VERSION)
107 mv $PRODUCT-$VERSION-factory.tgz $PRODUCT-$VERSION-factory-$(sha1sum < $PRODUCT-$VERSION-factory.tgz | cut -b -8).tgz
108 rm -rf tmp