Merge "Add goldfish images to emu extra img zip"
diff --git a/fvp.mk b/fvp.mk
index 3f3d4fa..7c64873 100644
--- a/fvp.mk
+++ b/fvp.mk
@@ -86,6 +86,7 @@
     device/generic/goldfish/fvpbase/fstab.fvpbase:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.fvpbase \
     device/generic/goldfish/fvpbase/fstab.fvpbase.initrd:$(TARGET_COPY_OUT_RAMDISK)/fstab.fvpbase \
     device/generic/goldfish/fvpbase/init.fvpbase.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.fvpbase.rc \
+    device/generic/goldfish/fvpbase/required_images:required_images \
     frameworks/av/services/audiopolicy/config/audio_policy_configuration_generic.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \
     frameworks/av/services/audiopolicy/config/primary_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/primary_audio_policy_configuration.xml \
     frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \
diff --git a/fvpbase/required_images b/fvpbase/required_images
new file mode 100644
index 0000000..741ddc5
--- /dev/null
+++ b/fvpbase/required_images
@@ -0,0 +1,5 @@
+bl1.bin
+boot.img
+fip.bin
+system-qemu.img
+userdata.img
diff --git a/fvpbase/run_model b/fvpbase/run_model
index 61d0fc0..d678837 100755
--- a/fvpbase/run_model
+++ b/fvpbase/run_model
@@ -1,6 +1,6 @@
 #!/bin/sh -eu
 #
-# Copyright 2019 The Android Open Source Project
+# Copyright 2020 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.
@@ -19,29 +19,9 @@
 trap "rm -rf $tmp" EXIT
 mkfifo $tmp/port
 
-env LD_PRELOAD=$ANDROID_HOST_OUT/lib64/bind_to_localhost.so \
-"$MODEL_BIN" \
-  -C bp.secureflashloader.fname="$ANDROID_PRODUCT_OUT/bl1.bin" \
-  -C bp.flashloader0.fname="$ANDROID_PRODUCT_OUT/fip.bin" \
-  -C cluster0.cpu0.semihosting-cwd="$ANDROID_PRODUCT_OUT" \
-  -C bp.virtioblockdevice.image_path="$ANDROID_PRODUCT_OUT/system-qemu.img" \
-  -C bp.mmc.p_mmc_file="$ANDROID_PRODUCT_OUT/userdata.img" \
-  -C bp.secure_memory=0 \
-  -C cache_state_modelled=0 \
-  -C bp.pl011_uart0.unbuffered_output=1 \
-  -C bp.pl011_uart0.out_file="$ANDROID_PRODUCT_OUT/uart0.log" \
-  -C bp.pl011_uart1.out_file="$ANDROID_PRODUCT_OUT/uart1.log" \
+"$(dirname $0)/run_model_only" \
+  -C bp.terminal_0.start_telnet=1 \
   -C bp.terminal_0.terminal_command="echo %port > $tmp/port" \
-  -C bp.terminal_1.start_telnet=0 \
-  -C bp.ve_sysregs.mmbSiteDefault=0 \
-  -C bp.ve_sysregs.exit_on_shutdown=1 \
-  -C bp.virtio_net.hostbridge.userNetworking=1 \
-  -C bp.virtio_net.hostbridge.userNetPorts=5555=5555 \
-  -C bp.virtio_net.enabled=1 \
-  -C cluster0.NUM_CORES=1 \
-  -C cluster0.cpu0.clock_multiplier=20 \
-  -C cluster0.cpu0.enable_crc32=1 \
-  -C cluster1.NUM_CORES=0 \
   "$@" &
 
 read port < $tmp/port
diff --git a/fvpbase/run_model_only b/fvpbase/run_model_only
new file mode 100755
index 0000000..c2cfe6f
--- /dev/null
+++ b/fvpbase/run_model_only
@@ -0,0 +1,42 @@
+#!/bin/sh -eu
+#
+# Copyright 2020 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.
+#
+
+export LD_PRELOAD="$ANDROID_HOST_OUT/lib64/bind_to_localhost.so"
+
+exec "$MODEL_BIN" \
+  -C bp.secureflashloader.fname="$ANDROID_PRODUCT_OUT/bl1.bin" \
+  -C bp.flashloader0.fname="$ANDROID_PRODUCT_OUT/fip.bin" \
+  -C cluster0.cpu0.semihosting-cwd="$ANDROID_PRODUCT_OUT" \
+  -C bp.virtioblockdevice.image_path="$ANDROID_PRODUCT_OUT/system-qemu.img" \
+  -C bp.mmc.p_mmc_file="$ANDROID_PRODUCT_OUT/userdata.img" \
+  -C bp.secure_memory=0 \
+  -C cache_state_modelled=0 \
+  -C bp.pl011_uart0.unbuffered_output=1 \
+  -C bp.pl011_uart0.out_file="$ANDROID_PRODUCT_OUT/uart0.log" \
+  -C bp.pl011_uart1.out_file="$ANDROID_PRODUCT_OUT/uart1.log" \
+  -C bp.terminal_0.start_telnet=0 \
+  -C bp.terminal_1.start_telnet=0 \
+  -C bp.ve_sysregs.mmbSiteDefault=0 \
+  -C bp.ve_sysregs.exit_on_shutdown=1 \
+  -C bp.virtio_net.hostbridge.userNetworking=1 \
+  -C bp.virtio_net.hostbridge.userNetPorts=5555=5555 \
+  -C bp.virtio_net.enabled=1 \
+  -C cluster0.NUM_CORES=1 \
+  -C cluster0.cpu0.clock_multiplier=20 \
+  -C cluster0.cpu0.enable_crc32=1 \
+  -C cluster1.NUM_CORES=0 \
+  "$@"
diff --git a/fvpbase/tools/Android.bp b/fvpbase/tools/Android.bp
index a163725..3534198 100644
--- a/fvpbase/tools/Android.bp
+++ b/fvpbase/tools/Android.bp
@@ -18,4 +18,5 @@
 cc_library_host_shared {
   name: "bind_to_localhost",
   srcs: ["bind_to_localhost.cpp"],
+  stl: "none",
 }