aboutsummaryrefslogtreecommitdiffstats
path: root/android/main.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-06-15 17:29:50 +0200
committerDavid 'Digit' Turner <digit@android.com>2011-06-16 00:22:06 +0200
commit2ed457ee5259b236bf39701404897f4c486326e8 (patch)
tree6ffbe7d33719b567ec1e5d3ab7b6e3e1666cd7c8 /android/main.c
parent60a19863995cdfb9be645242983be24e424f37bc (diff)
downloadexternal_qemu-2ed457ee5259b236bf39701404897f4c486326e8.zip
external_qemu-2ed457ee5259b236bf39701404897f4c486326e8.tar.gz
external_qemu-2ed457ee5259b236bf39701404897f4c486326e8.tar.bz2
arm: Automic ARMv7-A support for platform builds.
This patches forces the emulator-arm program to emulate a Cortex A8 when it detects that it is launching a platform build that was built for the ARMv7-A architecture. This is done by parsing the build.prop file and comparing the target ABI to the value 'armeabi-v7a'. When this is the case, this will also automatically adjust which prebuilt kernel image is selected from the Android tree. Note that nothing is changed for SDK AVDs in this change. They will still need to define 'hw.cpu.model = cortex-a8' in their config.ini to enable ARMv7-A support. Change-Id: Ibba2a9a4bafbea3c33cb2dd365a881d488de15a9
Diffstat (limited to 'android/main.c')
-rw-r--r--android/main.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/android/main.c b/android/main.c
index 37bf34a..77d3c69 100644
--- a/android/main.c
+++ b/android/main.c
@@ -169,6 +169,8 @@ int main(int argc, char **argv)
int serial = 2;
int shell_serial = 0;
+ int forceArmv7 = 0;
+
AndroidHwConfig* hw;
AvdInfo* avd;
AConfig* skinConfig;
@@ -430,8 +432,7 @@ int main(int argc, char **argv)
*/
kernelFileLen = strlen(kernelFile);
if (kernelFileLen > 6 && !memcmp(kernelFile + kernelFileLen - 6, "-armv7", 6)) {
- args[n++] = "-cpu";
- args[n++] = "cortex-a8";
+ forceArmv7 = 1;
}
}
@@ -1064,6 +1065,27 @@ int main(int argc, char **argv)
}
args[n] = 0;
+ /* If the target ABI is armeabi-v7a, we can auto-detect the cpu model
+ * as a cortex-a8, instead of the default (arm926) which only emulates
+ * an ARMv5TE CPU.
+ */
+ if (!forceArmv7 && hw->hw_cpu_model[0] == '\0')
+ {
+ char* abi = avdInfo_getTargetAbi(avd);
+ if (abi != NULL) {
+ if (!strcmp(abi, "armeabi-v7a")) {
+ forceArmv7 = 1;
+ }
+ AFREE(abi);
+ }
+ }
+
+ if (forceArmv7 != 0) {
+ AFREE(hw->hw_cpu_model);
+ hw->hw_cpu_model = ASTRDUP("cortex-a8");
+ D("Auto-config: -qemu -cpu %s", hw->hw_cpu_model);
+ }
+
/* Generate a hardware-qemu.ini for this AVD. The real hardware
* configuration is ususally stored in several files, e.g. the AVD's
* config.ini plus the skin-specific hardware.ini.