History log of /external/qemu/android/main-emulator.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
7654e7efee943bdbaf167170a087388c54681366 11-Jul-2014 David 'Digit' Turner <digit@google.com> emulator-arm64: ARM64 wrapper for QEMU executable.

This patch adds two new binaries (emulator-arm64 and emulator64-arm64)
which act as a wrapper for QEMU-based emulation engines for ARM64
emulation (and ARM64 _only_).

The (prebuilt) qemu binary must be located under:

$PROGRAM_DIR/qemu/$SYSTEM/qemu-system-aarch64$EXE

Where:

$PROGRAM_DIR is the location of the 'emulator-arm64' binary.
$SYSTEM is a host system tag (e.g. linux-x86 or linux-x86_64)
$EXE is the host executable extension.

The program is in charge of parsing command-line arguments,
computing AVD configuration, then calling the QEMU program
with a (very long) list of configuration arguments.

See https://qemu-android.googlesource.com/qemu-ranchu/ for
scripts used to rebuild the QEMU prebuilt binary from
sources.

Change-Id: Ifcb9dd50fc5d83a864a1f957d12b1c199e0504fb
/external/qemu/android/main-emulator.c
0cadcd089dafa412543773c695e10936c9d796a4 20-Jun-2014 David 'Digit' Turner <digit@google.com> emulator: Special case x86_64 emulation engine.

As a special case, if the target AVD CPU is 'x86_64', the
'emulator' launcher program will first try to locate a backend
named 'emulator-x86_64', and if not available, will try to find
'emulator-x86' as a fallback.

Other target CPU architectures are not affected.

The main goal here is to experiment mixing emulator binaries from
the master branch to support x86_64, as well as stable/idea133
binaries for other CPU architectures.

Change-Id: I5d30aa7c6ac1cf6a41ed97f8872ccd0ade90901f
/external/qemu/android/main-emulator.c
74efb2c2aa3475d937f631eb8d81aa21e197c049 17-Jun-2014 David 'Digit' Turner <digit@google.com> resolve merge conflicts of c5f5903 to master.

Conflicts:
android/main-emulator.c

Change-Id: Iffc6f5aaa95a1cdfcc81a26c43172e6c5ba8111a
ee57375c96822790cc7f837b4fdf64a9c1d69b3a 17-Jun-2014 David 'Digit' Turner <digit@google.com> android/utils/host_bitness.c: android_getHostBitness()

This patch moves the host bitness detection code to android/utils/
and also improves it to work properly on Windows, in preparation for
Win64 executables.

+ Ensure 'emulator' launcher uses it.
+ Add basic unit test.

Change-Id: I7d55397efeb749b72c502241c4da4cd16696c082
/external/qemu/android/main-emulator.c
9554550a3ecf2987af84d98d4b683757c74d8b93 05-May-2014 David 'Digit' Turner <digit@google.com> package-release.sh: Add --copy-prebuilts=<path> option.

This patch adds a new option to the package-release.sh script to
copy prebuilt 64-bit binaries for Linux and Darwin to an AOSP
checkout, under $AOSP/prebuilts/android-emulator/<system>/

For the record, this currently adds up to 18 MB (which includes
binaries for both platforms).

This is required to remove the emulator sources / build from the
platform build, and switch to prebuilt binaries instead.

+ Fix the 'emulator' launcher program to probe for either 32-bit
or 64-bit GPU emulation libraries (the copied prebuilts are only
64-bits to save space).

Change-Id: I5a4360da736172b5c35e2622fc02fb753853156b
/external/qemu/android/main-emulator.c
7891dd35fa2439a70f43ab8572778a398365bf24 28-Apr-2014 David 'Digit' Turner <digit@google.com> Support building with newest Mingw64 cross-toolchain.

This modifies android-configure.sh to detect the new Mingw64-based
cross toolchain (i.e. x86_64-w64-mingw32-gcc) and use it when it
is in the user's path.

Note that this only builds a 32-bit Windows binary, it just uses
a different toolchain to do it. A future patch will add support
for building both Win32 and Win64 binaries at the same time
(which the new toolchain supports).

Since this switches from GCC 4.2 to 4.8, this introduces a ton of
new warnings that require some cleanups in the sources too.

Only the most important warnings are fixed here.

Change-Id: Iec8c9b8332d4a38a2cb8acf368c8aa5341cf77be
/external/qemu/android/main-emulator.c
fd442bdd16c9debca9088780a78100a7dd1a3ca7 01-Apr-2014 David 'Digit' Turner <digit@google.com> Improve backend selection based on target AVD CPU.

This change improves the way the 'emulator' launcher program
chooses the emulation backend, based on the target AVD CPU
architecture.

+ Introduce emulator_getBackendSuffix and appropriate
unit test.

+ Use it in android/main-emulator.c

+ Remove the hack that forced a target ABI of 'x86_64' to
be mapped internally to 'x86'.

Change-Id: Ifbda9c8e4c032df5e8ca089f1e9272c844c00c32
/external/qemu/android/main-emulator.c
01174a2daca341a893afa33988dd6129418f9dcf 01-Apr-2014 David 'Digit' Turner <digit@google.com> emulator: Enable verbose mode when -verbose is used.

Before this patch, the only way to print debug messages from the
'emulator' launcher program was to define ANDROID_EMULATOR_DEBUG=1
in your environment.

This patch modifies the program to detect one of the following
on the command-line to also enable these debug messages:

-verbose
-debug-all
-debug all

Change-Id: Ide96680f7eb4295cd69a903c5f9c576d7d0f7e88
/external/qemu/android/main-emulator.c
c005246ed03de874fdc432073ba8e5e8ebfed922 25-Feb-2014 David 'Digit' Turner <digit@google.com> Remove trailing spaces in misc sources.

Change-Id: I573d4e816112b7401b3c824fbe773b85a8601531
/external/qemu/android/main-emulator.c
5ea914899e5dbef4e8a7454b40a3c6648173f086 13-Feb-2014 David 'Digit' Turner <digit@google.com> Add boot.prop support.

This patch allows one to specify a custom list of boot properties that
will be injected into the guest system at boot time. The properties
must be placed in a file named 'boot.prop', which can appear in the
following locations:

For AVDs:

1) In the AVD's content directory.
2) Otherwise in the system image's directory.

For Android platform builds:

1) In the $ANDROID_BUILD_OUT directory.
Note that this is different from build.prop which will be read
from $ANDROID_BUILD_OUT/system/ instead (and isn't used to
inject any properties).

Note that any '-boot-property <name>=<value>' on the command-line will
be injected after the content of 'boot.prop', overriding it unless it
begins with a 'ro.' prefix.

The patch refactors a little how information is retrieved for builds
and AVD configurations. It also fixes a few bugs in the auto-detection
logic for the target architecture / ABI.

BUG=12819077

Change-Id: I9f41f21d9de3e4d25de427f0e5a6bb517f34c5ba
/external/qemu/android/main-emulator.c
cef730bbc330b4a0ad84d12c71fdcb010ddb3772 04-Feb-2014 David 'Digit' Turner <digit@google.com> Cleanup: Remove 100+ compiler warnings.

This is a big cleanup that removes compiler warnings by performing
the following:

- Remove unused functions or variables.
- Change pointer cast to be alias safe using unions.
- Use __attribute__((unused)) on some local variable definitions
when their usage depends on conditional defines that are not
always true when compiling the same source several times.
- Fix a couple array indexing bugs.

There are still a few warnings from the JSON lexer, libjpeg and
the TCG helpers though, but the overall compilation is much cleaner.

BUG=NONE

Change-Id: Ic4483e6402b266ecfd7bca8c92a73d8fcf392a1f
/external/qemu/android/main-emulator.c
60d0a1536e4e75cee039c09da65a2e994be2e106 22-Jan-2014 David 'Digit' Turner <digit@google.com> Fix Windows command-line quoting.

When the 'emulator.exe' program invokes the real emulation program
(e.g. 'emulator-arm.exe' or 'emulator-x86.exe'), it passes its own
command-line arguments through execv().

Unfortunately, on Windows this doesn't work, as the command-line
arguments must be quoted in a special way. This is describ
is described in detail in the MSDN blog post named
"Everyone quotes command line arguments the wrong way" [1]

The code under android/main-emulator.c had several problems:

- It only quoted the first parameter (the program name), but
not any other one.

- The quoting was too naive to work in the general case.

This patch adds a utility function named win32_cmdline_quote()
to perform correct quoting, and changes android/main-emulator.c
to use it.

Fix for http://b.android.com/18317

[1] http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx

Change-Id: I7cfd6ddd10706c7aeb6c7df56e20398277d78409
/external/qemu/android/main-emulator.c
5ed60d1e0865d948f3e7bba38c98bcfbb58fc24b 20-Nov-2013 Jesse Hall <jessehall@google.com> Handle long library search paths

Before launching the arch-specific emulator, the emulator wrapper adds
a directory to the library search path (LD_LIBRARY_PATH or PATH).
There were two problems that this change fixes:

- The new path was assembled in a 2048 byte buffer. If the assembled
path was longer than that, it would be truncated, in effect removing
some directories. This change dynamically allocates the buffer so
truncation doesn't happen.

- On Windows, the new directories were appended instead of prepended
to the existing search path. If the path was truncated due to the
previous problem, the new directory wouldn't be added to the path,
and the arch-specific emulator would fail to load. This isn't a real
problem now that truncation doesn't occur, but this change makes
the Windows version prepend the directory for consistency's sake.

Bug: http://b.android.com/33336
Change-Id: I13068c4871254f8507eea265f6a1b698e5e1e3ce
/external/qemu/android/main-emulator.c
342a01fc826881e6b12b7673c7d2c280295f4d9e 21-Jun-2012 Duane Sand <duanes@mips.com> [MIPS] Fix startup segfault in emulator64-mips

Avoid truncation of 64-bit host addresses for 32-bit Mips physaddrs.
Revert workaround I17fe688d19e3cd7f328721e6363bacd6e6689ca;
allow emulator to again default to emulator64-mips.

Change-Id: I0c83d8bf60fc52a758b84d8131b2bad53375aa61
Signed-off-by: Duane Sand <duanes@mips.com>
/external/qemu/android/main-emulator.c
9e15745b9f828db4eedf90a811becac95e02d5d3 04-May-2012 Duane Sand <duanes@mips.com> Emulator64-mips segfaults, disable it for now.

Signed-off-by: Duane Sand <duanes@mips.com>

Change-Id: I17fe688d19e3cd7f328721e6363bacd6e6689ca2
/external/qemu/android/main-emulator.c
ddd4ef7f7c8d07e95dc88ca897634f537666d5f3 21-Mar-2012 Andrew Hsieh <andrewhsieh@google.com> New option '-force-32bit' to always use 32-bit emulator on 64-bit platforms

Useful for both QA and trouble-shooting

Change-Id: I09eac8b94e29e8a201188bf17d3511c15cfee4b4
/external/qemu/android/main-emulator.c
c7389bd69e570a2c8432b37399aff1976b021f0f 13-Mar-2012 Andrew Hsieh <andrewhsieh@google.com> 64-bit emulator

Patch to allow emulator searches for emulator64-${ARCH} first on
64-bit OS. If none is found, the original behavior which searchs
for 32-bit emulator-${ARCH} is performed as usual.

64-bit emulator (which still emulates Android built in 32-bit) offers
up to 20% speedup compared to its 32-bit counterpart.

Details:

android/main-emulator.c
1) search emulator64 based on the OS
2) dlopen lib64OpenglRender in 64-bit

Makefile.*
1) Rules to build 64-bit executable emulator64-{x86,arm} and libraries
emulator64-{libui,libqemu,target-i386,target-arm,libelff,common}
2) remove -Wa,-32
3) Changes prebuit toolchain path

android-configure.h
android/build/common.h
1) no longer force 32-bit build (because now prebuilts/tools/gcc-sdk/gcc
can now handle 64-bit
2) set ANDROID_PREBUILTS to correctly locate ccache

android/config/*/config-host.h
1) Detect HOST_X86_64 and HOST_X86_64/HOST_I386

Misc 64-bit porting clean-up
1) use %zx to print variable of type size_t in hex
2) use %zu to print variable of type size_t in dec
3) Initialize query_parm to NULL
4) use PRIu64 to replace PDUd64
5) use PRId64/PRIu64/PRIX64 to print 64-bit
6) drop PRUx64 because PRIx64 does the same
7) cast pointer arith to intptr_t before casting to int
8) fixed 1ULL<<63

Change-Id: Ife62a20063a6ec38d4a9b23977e840af1fce149a
/external/qemu/android/main-emulator.c
dca64d13258f05ec3385403a99eff7da4773ce24 13-Sep-2011 David 'Digit' Turner <digit@google.com> emulator: fix Win32 runtime crash

Change-Id: I5ca4b1393211c1d8a5caba332c3f6164afb4661b
/external/qemu/android/main-emulator.c
bfcfa46044116a54ebe11ee2881142fd38a87939 24-Aug-2011 David 'Digit' Turner <digit@android.com> emulator: probe shared library search path

This patch modifies the 'emulator' launcher program to probe
for a adequate directory containing shared libraries that will
be required by the emulator core to implement GLES emulation
properly.

It does that by looking for a library named libOpenglRender.so
(or .dll, or .dylib depending on the platform) in various directories
around the one containing the executable program.

When such a directory is found, it modifies the value of the PATH
or LD_LIBRARY_PATH environment variable before calling exec()

This is necessary because there is no way to change the list
of search directories at runtime, i.e. between the program's start
and the moment it calls dlopen() to load such a library.

Change-Id: I7346d26597382f44931cdf08936b051e74d3641a
/external/qemu/android/main-emulator.c
add001c9d30ef442e87ee18ec59342929401bd49 15-Jul-2011 David Turner <digit@android.com> Fix Windows space-in-path handling for 'emulator'.

This modifies the 'emulator' launcher program to work
correctly on Windows when it is installed in a path that
contains spaces.

The program computed the path of the program to be launched
correctly, but it turns out that the problem is in the
implementation of execv() in either mingw or MSVCRT.DLL:

experimentation shows that one needs to quote argv[0] when
it contains spaces. However, you must *not* quote the first
argument to execv(), otherwise the call will fail.

Change-Id: If291c5a8bd507f96b40634ecbc946ba38346ee4e
/external/qemu/android/main-emulator.c
2d238fd9871687b1557f15b8878a6cf3e9634b57 25-Mar-2011 David 'Digit' Turner <digit@android.com> Add 'emulator' launcher program.

This patch renames the current ARM-specific emulator binary to 'emulator-arm'
and introduces a new tiny (less than 20KB) 'emulator' launcher program.

The role of 'emulator' is to launch either 'emulator-arm' or 'emulator-x86'
based on the target AVD or platform build being used.

This program will be replaced in the future by what is currently known
as 'emulator-ui', but is a good placeholder until this work is completed.

+ Move some utility functions from android/avd/info.[hc] to
android/avd/util.[hc] so that 'emulator' can use them directly.

IMPORTANT: For platform builds, the target architecture is detected
automatically by parsing the build.prop file.

For SDK AVDs however, there is no easy way to determine the
target architecture, so the patch adds a new hw.cpu.arch
property which can have value 'arm' or 'x86'

Change-Id: I0084c196695a75c8b9230ba716b3cd2e12610ded
/external/qemu/android/main-emulator.c