aboutsummaryrefslogtreecommitdiffstats
path: root/android/main-ui.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-02-01 17:48:37 +0100
committerDavid 'Digit' Turner <digit@android.com>2011-02-01 19:19:12 +0100
commit622f1530c8a6badfbcaf8c59976348678fbe248b (patch)
tree3847a94f8f82f0fd81ef69f3e04f02c72fee7ade /android/main-ui.c
parentf4d4ca164dea606cee27e1f68d4742a3c57b0954 (diff)
downloadexternal_qemu-622f1530c8a6badfbcaf8c59976348678fbe248b.zip
external_qemu-622f1530c8a6badfbcaf8c59976348678fbe248b.tar.gz
external_qemu-622f1530c8a6badfbcaf8c59976348678fbe248b.tar.bz2
Generate temporary hardware.ini from configuration settings.
This patch generates a temporary hardware.ini from the hardware configuration. The idea is to move as much hw config info as possible to a single file that the core can read. Other patches will change how various config info is passed to the core, from command-line options to the generated hardware.ini.
Diffstat (limited to 'android/main-ui.c')
-rw-r--r--android/main-ui.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/android/main-ui.c b/android/main-ui.c
index ac5bfbe..541d83b 100644
--- a/android/main-ui.c
+++ b/android/main-ui.c
@@ -48,6 +48,7 @@
#include "android/utils/bufprint.h"
#include "android/utils/dirscanner.h"
#include "android/utils/path.h"
+#include "android/utils/tempfile.h"
#include "android/cmdline-option.h"
#include "android/help.h"
@@ -1944,6 +1945,31 @@ int main(int argc, char **argv)
}
args[n] = 0;
+ /* Generate a temporary hardware.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.
+ *
+ * The new temp file will group all definitions and will be used to
+ * launch the core with the -android-hw <file> option.
+ */
+ {
+ TempFile* tempHw = tempfile_create();
+ if (tempHw == NULL) {
+ derror("Could not create temporary hardware.ini: %s", strerror(errno));
+ exit(2);
+ }
+
+ const char* tempHwPath = tempfile_path(tempHw);
+ IniFile* hwIni = iniFile_newFromMemory("", NULL);
+ androidHwConfig_write(hw, hwIni);
+ if (iniFile_saveToFile(hwIni, tempHwPath) < 0) {
+ derror("Could not write temporary hardware.ini: %s", tempHwPath);
+ exit(2);
+ }
+ args[n++] = "-android-hw";
+ args[n++] = strdup(tempHwPath);
+ }
+
if(VERBOSE_CHECK(init)) {
int i;
printf("QEMU options list:\n");