am 71e23bec: am 7541807f: Don\'t delete tilapia files when preparing blob lists.

# Via Android Git Automerger (1) and Jean-Baptiste Queru (1)
* commit '71e23bec393ce3930822c1224ffad80f2918a957':
  Don't delete tilapia files when preparing blob lists.
diff --git a/clear-factory-images-variables.sh b/clear-factory-images-variables.sh
index e0c6758..df9c251 100644
--- a/clear-factory-images-variables.sh
+++ b/clear-factory-images-variables.sh
@@ -12,9 +12,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+unset XLOADER
+unset XLOADERSRC
 unset BOOTLOADER
 unset BOOTLOADERFILE
 unset BOOTLOADERSRC
+unset TWINBOOTLOADERS
 unset BUILD
 unset CDMARADIO
 unset DEVICE
diff --git a/generate-blob-lists.sh b/generate-blob-lists.sh
index 0bd8821..a560526 100755
--- a/generate-blob-lists.sh
+++ b/generate-blob-lists.sh
@@ -42,7 +42,7 @@
 fi
 shift
 
-DEVICES="maguro toro toroplus grouper tilapia manta"
+DEVICES="phantasm"
 export LC_ALL=C
 
 repo sync -j32 -n
diff --git a/generate-factory-images-common.sh b/generate-factory-images-common.sh
index d6674bc..0ff6868 100644
--- a/generate-factory-images-common.sh
+++ b/generate-factory-images-common.sh
@@ -1,4 +1,4 @@
-# Copyright (C) 2011 The Android Open Source Project
+# Copyright 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.
@@ -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 @@
 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/$XLOADERSRC tmp/$PRODUCT-$VERSION/xloader-$DEVICE-$XLOADER.img
 if test "$BOOTLOADERFILE" = ""
 then
   cp tmp/RADIO/$BOOTLOADERSRC tmp/$PRODUCT-$VERSION/bootloader-$DEVICE-$BOOTLOADER.img
@@ -49,14 +69,12 @@
 then
   cp tmp/RADIO/radio-cdma.img tmp/$PRODUCT-$VERSION/radio-cdma-$DEVICE-$CDMARADIO.img
 fi
-if test "$SLEEPDURATION" = ""
-then
-  SLEEPDURATION=5
-fi
+
+# Write flash-all.sh
 cat > tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
 #!/bin/sh
 
-# Copyright (C) 2011 The Android Open Source Project
+# Copyright 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.
@@ -81,8 +99,22 @@
 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
+EOF
+if test "$TWINBOOTLOADERS" = "true"
+then
+cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
+fastboot flash bootloader2 bootloader-$DEVICE-$BOOTLOADER.img
+EOF
+fi
+cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
 fastboot reboot-bootloader
 sleep $SLEEPDURATION
 EOF
@@ -106,6 +138,8 @@
 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
@@ -134,8 +168,22 @@
 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
+EOF
+if test "$TWINBOOTLOADERS" = "true"
+then
+cat >> tmp/$PRODUCT-$VERSION/flash-all.bat << EOF
+fastboot flash bootloader2 bootloader-$DEVICE-$BOOTLOADER.img
+EOF
+fi
+cat >> tmp/$PRODUCT-$VERSION/flash-all.bat << EOF
 fastboot reboot-bootloader
 ping -n $SLEEPDURATION 127.0.0.1 >nul
 EOF
@@ -162,10 +210,12 @@
 pause >nul
 exit
 EOF
+
+# Write flash-base.sh
 cat > tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
 #!/bin/sh
 
-# Copyright (C) 2011 The Android Open Source Project
+# Copyright 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.
@@ -179,7 +229,23 @@
 # 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
+EOF
+if test "$TWINBOOTLOADERS" = "true"
+then
+cat >> tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
+fastboot flash bootloader2 bootloader-$DEVICE-$BOOTLOADER.img
+EOF
+fi
+cat >> tmp/$PRODUCT-$VERSION/flash-base.sh << EOF
 fastboot reboot-bootloader
 sleep $SLEEPDURATION
 EOF
@@ -200,6 +266,10 @@
 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