summaryrefslogtreecommitdiffstats
path: root/generate-factory-images-common.sh
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-10-01 17:21:08 -0700
committerJean-Baptiste Queru <jbq@google.com>2012-10-01 17:21:08 -0700
commite819834ea17380042bf767c457e89dad24ff4aa2 (patch)
tree08baab4aca15e5b070ff909f951c4f53f4dae873 /generate-factory-images-common.sh
parenta65846cce3812184074cbbbfe2fa721142f549ac (diff)
parent8422277e4c07a3fa77947805a977af321779512b (diff)
downloadandroid_device_common-e819834ea17380042bf767c457e89dad24ff4aa2.tar.gz
android_device_common-e819834ea17380042bf767c457e89dad24ff4aa2.tar.bz2
android_device_common-e819834ea17380042bf767c457e89dad24ff4aa2.zip
resolved conflicts for merge of 8422277e to master
Change-Id: Ic32740bb257916035b23b6e8e88efdbce5da19d6
Diffstat (limited to 'generate-factory-images-common.sh')
-rw-r--r--generate-factory-images-common.sh58
1 files changed, 52 insertions, 6 deletions
diff --git a/generate-factory-images-common.sh b/generate-factory-images-common.sh
index c811bb6..f89bd6f 100644
--- a/generate-factory-images-common.sh
+++ b/generate-factory-images-common.sh
@@ -12,16 +12,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if test "$RADIOSRC" = ""
+# Use the default values if they weren't explicitly set
+if test "$XLOADERSRC" = ""
then
- RADIOSRC=radio.img
+ XLOADERSRC=xloader.img
fi
if test "$BOOTLOADERSRC" = ""
then
BOOTLOADERSRC=bootloader.img
fi
+if test "$RADIOSRC" = ""
+then
+ RADIOSRC=radio.img
+fi
+if test "$SLEEPDURATION" = ""
+then
+ SLEEPDURATION=5
+fi
+
+# Prepare the staging directory
rm -rf tmp
mkdir -p tmp/$PRODUCT-$VERSION
+
+# Extract the bootloader(s) and radio(s) as necessary
+if test "$XLOADER" != ""
+then
+ unzip -d tmp ${SRCPREFIX}$PRODUCT-target_files-$BUILD.zip RADIO/$XLOADERSRC
+fi
if test "$BOOTLOADERFILE" = ""
then
unzip -d tmp ${SRCPREFIX}$PRODUCT-target_files-$BUILD.zip RADIO/$BOOTLOADERSRC
@@ -34,7 +51,10 @@ if test "$CDMARADIO" != "" -a "$CDMARADIOFILE" = ""
then
unzip -d tmp ${SRCPREFIX}$PRODUCT-target_files-$BUILD.zip RADIO/radio-cdma.img
fi
+
+# Copy the various images in their staging location
cp ${SRCPREFIX}$PRODUCT-img-$BUILD.zip tmp/$PRODUCT-$VERSION/image-$PRODUCT-$VERSION.zip
+cp tmp/RADIO/$BOOTLOADERSRC tmp/$PRODUCT-$VERSION/xloader-$DEVICE-$XLOADER.img
if test "$BOOTLOADERFILE" = ""
then
cp tmp/RADIO/$BOOTLOADERSRC tmp/$PRODUCT-$VERSION/bootloader-$DEVICE-$BOOTLOADER.img
@@ -59,10 +79,8 @@ then
cp $CDMARADIOFILE tmp/$PRODUCT-$VERSION/radio-cdma-$DEVICE-$CDMARADIO.img
fi
fi
-if test "$SLEEPDURATION" = ""
-then
- SLEEPDURATION=5
-fi
+
+# Write flash-all.sh
cat > tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
#!/bin/sh
@@ -91,6 +109,12 @@ fastboot erase system
fastboot erase userdata
EOF
fi
+if test "$XLOADER" != ""
+then
+cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
+fastboot flash xloader xloader-$DEVICE-$XLOADER.img
+EOF
+fi
cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
fastboot reboot-bootloader
@@ -116,6 +140,8 @@ 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
+
+# Write flash-all.bat
cat > tmp/$PRODUCT-$VERSION/flash-all.bat << EOF
@ECHO OFF
:: Copyright 2012 The Android Open Source Project
@@ -144,6 +170,12 @@ fastboot erase system
fastboot erase userdata
EOF
fi
+if test "$XLOADER" != ""
+then
+cat >> tmp/$PRODUCT-$VERSION/flash-all.bat << EOF
+fastboot flash xloader xloader-$DEVICE-$XLOADER.img
+EOF
+fi
cat >> tmp/$PRODUCT-$VERSION/flash-all.bat << EOF
fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
fastboot reboot-bootloader
@@ -172,6 +204,8 @@ echo Press any key to exit...
pause >nul
exit
EOF
+
+# Write flash-base.sh
cat > tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
#!/bin/sh
@@ -189,6 +223,14 @@ cat > tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
# See the License for the specific language governing permissions and
# limitations under the License.
+EOF
+if test "$XLOADER" != ""
+then
+cat >> tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
+fastboot flash xloader xloader-$DEVICE-$XLOADER.img
+EOF
+fi
+cat >> tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
fastboot flash bootloader bootloader-$DEVICE-$BOOTLOADER.img
fastboot reboot-bootloader
sleep $SLEEPDURATION
@@ -210,6 +252,10 @@ sleep $SLEEPDURATION
EOF
fi
chmod a+x tmp/$PRODUCT-$VERSION/flash-base.sh
+
+# Create the distributable package
(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
+
+# Clean up
rm -rf tmp