distrib/package-release.sh: Add PC Bios files.

This patch ensures that package-release.sh includes PC Bios
files under tools/lib/pc-bios/ in the generated binary packages,
when possible.

This makes the emulator binaries directly usable to emulate
x86 system images, which require these files.

Change-Id: I88df2f33cb0e417029feac71de101a1f038a37cf
diff --git a/android-configure.sh b/android-configure.sh
index 1f2c4d1..95a3e2b 100755
--- a/android-configure.sh
+++ b/android-configure.sh
@@ -28,6 +28,8 @@
 GLES_SUPPORT=no
 GLES_PROBE=yes
 
+PCBIOS_PROBE=yes
+
 HOST_CC=${CC:-gcc}
 OPTION_CC=
 
@@ -66,6 +68,8 @@
   ;;
   --no-gles) GLES_PROBE=no
   ;;
+  --no-pcbios) PCBIOS_PROBE=no
+  ;;
   *)
     echo "unknown option '$opt', use --help"
     exit 1
@@ -93,9 +97,9 @@
     echo "  --static                 build a completely static executable"
     echo "  --verbose                verbose configuration"
     echo "  --debug                  build debug version of the emulator"
-    echo "  --gles-include=PATH      specify path to GLES emulation headers"
     echo "  --gles-libs=PATH         specify path to GLES emulation host libraries"
     echo "  --no-gles                disable GLES emulation support"
+    echo "  --no-pcbios              disable copying of PC Bios files"
     echo ""
     exit 1
 fi
@@ -274,6 +278,24 @@
     done
 fi
 
+if [ "$PCBIOS_PROBE" = "yes" ]; then
+    PCBIOS_DIR=$(dirname "$0")/../../prebuilts/qemu-kernel/x86/pc-bios
+    if [ ! -d "$PCBIOS_DIR" ]; then
+        log2 "PC Bios    : Probing $PCBIOS_DIR (missing)"
+        PCBIOS_DIR=../pc-bios
+    fi
+    log2 "PC Bios    : Probing $PCBIOS_DIR"
+    if [ ! -d "$PCBIOS_DIR" ]; then
+        log "PC Bios    : Could not find prebuilts directory."
+    else
+        mkdir -p objs/lib/pc-bios
+        for BIOS_FILE in bios.bin vgabios-cirrus.bin; do
+            log "PC Bios    : Copying $BIOS_FILE"
+            cp -f $PCBIOS_DIR/$BIOS_FILE objs/lib/pc-bios/$BIOS_FILE
+        done
+    fi
+fi
+
 # For OS X, detect the location of the SDK to use.
 if [ "$HOST_OS" = darwin ]; then
     OSX_VERSION=$(sw_vers -productVersion)
diff --git a/distrib/package-release.sh b/distrib/package-release.sh
index ac289a3..1df4c68 100755
--- a/distrib/package-release.sh
+++ b/distrib/package-release.sh
@@ -146,6 +146,7 @@
   dump "Retrieving Darwin binaries from: $HOST"
   rm -rf objs/*
   run scp $HOST:$DST_DIR/$PKG_FILE_PREFIX/qemu/objs/emulator* objs/
+  # TODO(digit): Retrieve GPU emulation libraries + PC Bios files.
   run ssh $HOST rm -rf $DST_DIR/$PKG_FILE_PREFIX
 }
 
@@ -431,7 +432,7 @@
     if [ -d "objs/lib" ]; then
         dump "[$PKG_NAME] Copying GLES emulation libraries."
         run mkdir -p "$TEMP_PKG_DIR"/tools/lib
-        run2 cp -p objs/lib/* "$TEMP_PKG_DIR"/tools/lib/
+        run2 cp -rp objs/lib/* "$TEMP_PKG_DIR"/tools/lib/
     fi
 
     dump "[$PKG_NAME] Creating README file."