summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-04-02 11:04:51 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-04-02 11:04:51 -0700
commit424a6240b43d283109f07f8094cd8ab1f810c9dd (patch)
tree9983d2c84a7a6564a248b0344ef8cf71269cdcef
parent411fad5eb73a21a691bcfd876afd5143983fab27 (diff)
parent36cbd9ab6f83166ad36214d077684a0e53dc6b13 (diff)
downloaddevice_common-424a6240b43d283109f07f8094cd8ab1f810c9dd.zip
device_common-424a6240b43d283109f07f8094cd8ab1f810c9dd.tar.gz
device_common-424a6240b43d283109f07f8094cd8ab1f810c9dd.tar.bz2
am 36cbd9ab: Common part of the factory-image-generator
* commit '36cbd9ab6f83166ad36214d077684a0e53dc6b13': Common part of the factory-image-generator
-rw-r--r--generate-factory-images-common.sh108
1 files changed, 108 insertions, 0 deletions
diff --git a/generate-factory-images-common.sh b/generate-factory-images-common.sh
new file mode 100644
index 0000000..b4e935c
--- /dev/null
+++ b/generate-factory-images-common.sh
@@ -0,0 +1,108 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if test "$RADIOSRC" = ""
+then
+ RADIOSRC=radio.img
+fi
+if test "$BOOTLOADERSRC" = ""
+then
+ RADIOSRC=bootloader.img
+fi
+rm -rf tmp
+mkdir -p tmp/$PRODUCT-$VERSION
+unzip -d tmp signed-$PRODUCT-target_files-$BUILD.zip RADIO/$RADIOSRC RADIO/$BOOTLOADERSRC
+if test "$CDMARADIO" != ""
+then
+ unzip -d tmp signed-$PRODUCT-target_files-$BUILD.zip RADIO/radio-cdma.img
+fi
+cp signed-$PRODUCT-img-$BUILD.zip tmp/$PRODUCT-$VERSION/image-$PRODUCT-$VERSION.zip
+cp tmp/RADIO/$BOOTLOADERSRC tmp/$PRODUCT-$VERSION/bootloader-$DEVICE-$BOOTLOADER.img
+cp tmp/RADIO/$RADIOSRC tmp/$PRODUCT-$VERSION/radio-$DEVICE-$RADIO.img
+if test "$CDMARADIO" != ""
+then
+ cp tmp/RADIO/radio-cdma.img tmp/$PRODUCT-$VERSION/radio-cdma-$DEVICE-$CDMARADIO.img
+fi
+cat > tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
+#!/bin/sh
+
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
+fastboot reboot-bootloader
+sleep 5
+fastboot flash radio radio-$DEVICE-$RADIO.img
+fastboot reboot-bootloader
+sleep 5
+EOF
+if test "$CDMARADIO" != ""
+then
+cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
+fastboot flash radio-cdma radio-cdma-$DEVICE-$CDMARADIO.img
+fastboot reboot-bootloader
+sleep 5
+EOF
+fi
+cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
+fastboot -w update image-$PRODUCT-$VERSION.zip
+EOF
+chmod a+x tmp/$PRODUCT-$VERSION/flash-all.sh
+cat > tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
+#!/bin/sh
+
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
+fastboot reboot-bootloader
+sleep 5
+fastboot flash radio radio-$DEVICE-$RADIO.img
+fastboot reboot-bootloader
+sleep 5
+EOF
+if test "$CDMARADIO" != ""
+then
+cat >> tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
+fastboot flash radio-cdma radio-cdma-$DEVICE-$CDMARADIO.img
+fastboot reboot-bootloader
+sleep 5
+EOF
+fi
+chmod a+x tmp/$PRODUCT-$VERSION/flash-base.sh
+(cd tmp ; tar zcvf ../$PRODUCT-$VERSION-factory.tgz $PRODUCT-$VERSION)
+mv $PRODUCT-$VERSION-factory.tgz $PRODUCT-$VERSION-factory-$(sha1sum < $PRODUCT-$VERSION-factory.tgz | cut -b -8).tgz
+rm -rf tmp