aboutsummaryrefslogtreecommitdiffstats
path: root/android/avd
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-03-01 14:02:42 +0100
committerDavid 'Digit' Turner <digit@android.com>2011-03-01 15:31:11 +0100
commit0b0194940523fa3f318c380d0693907bd522241c (patch)
tree69d2e8db93e660fc22b468faeb5d097653ff71ad /android/avd
parent25eb6557b94da066d6e137c07aeced39badf5aa6 (diff)
downloadexternal_qemu-0b0194940523fa3f318c380d0693907bd522241c.zip
external_qemu-0b0194940523fa3f318c380d0693907bd522241c.tar.gz
external_qemu-0b0194940523fa3f318c380d0693907bd522241c.tar.bz2
Move kernel/ramdisk initialization to the core.
The QEMU -kernel, -initrd and -append options are still supported for overriding the hardware configuration. Change-Id: I034d9e25d0a23341086aa052f449db5de50b2c8d
Diffstat (limited to 'android/avd')
-rw-r--r--android/avd/hardware-properties.ini15
-rw-r--r--android/avd/hw-config-defs.h15
-rw-r--r--android/avd/info.c82
-rw-r--r--android/avd/info.h10
4 files changed, 80 insertions, 42 deletions
diff --git a/android/avd/hardware-properties.ini b/android/avd/hardware-properties.ini
index 7473e7d..06ac447 100644
--- a/android/avd/hardware-properties.ini
+++ b/android/avd/hardware-properties.ini
@@ -194,15 +194,24 @@ default = yes
abstract = Proximity support
description = Whether there is an proximity in the device.
-# Path to the kernel image.
-name = disk.kernel.path
+# Kernel image.
+#
+# kernel.path specified the path to the kernel image
+# kernel.parameters specifies the string of kernel boot parameters.
+#
+name = kernel.path
type = string
default =
abstract = Path to the kernel image
description = Path to the kernel image.
+name = kernel.parameters
+type = string
+default =
+abstract = kernel boot parameters string.
+
# Path to the ramdisk image.
-name = disk.ramDisk.path
+name = disk.ramdisk.path
type = string
default =
abstract = Path to the ramdisk image
diff --git a/android/avd/hw-config-defs.h b/android/avd/hw-config-defs.h
index a6cce01..c3e0a77 100644
--- a/android/avd/hw-config-defs.h
+++ b/android/avd/hw-config-defs.h
@@ -193,15 +193,22 @@ HWCFG_BOOL(
"Whether there is an proximity in the device.")
HWCFG_STRING(
- disk_kernel_path,
- "disk.kernel.path",
+ kernel_path,
+ "kernel.path",
"",
"Path to the kernel image",
"Path to the kernel image.")
HWCFG_STRING(
- disk_ramDisk_path,
- "disk.ramDisk.path",
+ kernel_parameters,
+ "kernel.parameters",
+ "",
+ "kernel boot parameters string.",
+ "")
+
+HWCFG_STRING(
+ disk_ramdisk_path,
+ "disk.ramdisk.path",
"",
"Path to the ramdisk image",
"Path to the ramdisk image.")
diff --git a/android/avd/info.c b/android/avd/info.c
index 5f110d3..fa32c24 100644
--- a/android/avd/info.c
+++ b/android/avd/info.c
@@ -1139,15 +1139,6 @@ _avdInfo_getImagePaths(AvdInfo* i, AvdInfoParams* params )
imageLoader_init(l, i, params);
- /* pick up the kernel and ramdisk image files - these don't
- * need a specific handling.
- */
- imageLoader_set ( l, AVD_IMAGE_KERNEL );
- imageLoader_load( l, IMAGE_REQUIRED | IMAGE_SEARCH_SDK | IMAGE_DONT_LOCK );
-
- imageLoader_set ( l, AVD_IMAGE_RAMDISK );
- imageLoader_load( l, IMAGE_REQUIRED | IMAGE_SEARCH_SDK | IMAGE_DONT_LOCK );
-
/* the system image
*
* if there is one in the content directory just lock
@@ -1327,31 +1318,12 @@ _avdInfo_getBuildImagePaths( AvdInfo* i, AvdInfoParams* params )
int noSdCard = (params->flags & AVDINFO_NO_SDCARD) != 0;
int noSnapshots = (params->flags & AVDINFO_NO_SNAPSHOTS) != 0;
- char temp[PATH_MAX], *p=temp, *end=p+sizeof temp;
+ char temp[PATH_MAX];
char* srcData;
ImageLoader l[1];
imageLoader_init(l, i, params);
- /** load the kernel image
- **/
-
- /* if it is not in the out directory, get it from prebuilt
- */
- imageLoader_set ( l, AVD_IMAGE_KERNEL );
-
- if ( !imageLoader_load( l, IMAGE_OPTIONAL |
- IMAGE_DONT_LOCK ) )
- {
- p = bufprint(temp, end, "%s/prebuilt/android-%s/kernel/kernel-qemu",
- i->androidBuildRoot, i->targetArch);
- if (p >= end || !path_exists(temp)) {
- derror("bad workspace: cannot find prebuilt kernel in: %s", temp);
- exit(1);
- }
- imageLoader_setPath(l, temp);
- }
-
/** load the data partition. note that we use userdata-qemu.img
** since we don't want to modify userdata.img at all
**/
@@ -1405,12 +1377,6 @@ _avdInfo_getBuildImagePaths( AvdInfo* i, AvdInfoParams* params )
AFREE(srcData);
- /** load the ramdisk image
- **/
- imageLoader_set ( l, AVD_IMAGE_RAMDISK );
- imageLoader_load( l, IMAGE_REQUIRED |
- IMAGE_DONT_LOCK );
-
/** load the system image. read-only. the caller must
** take care of checking the state
**/
@@ -1549,6 +1515,52 @@ avdInfo_isImageReadOnly( AvdInfo* i, AvdImageType imageType )
return (i->imageState[imageType] == IMAGE_STATE_READONLY);
}
+char*
+avdInfo_getKernelPath( AvdInfo* i )
+{
+ const char* imageName = _imageFileNames[ AVD_IMAGE_KERNEL ];
+
+ char* kernelPath = _avdInfo_getContentOrSdkFilePath(i, imageName);
+
+ if (kernelPath == NULL && i->inAndroidBuild) {
+ /* When in the Android build, look into the prebuilt directory
+ * for our target architecture.
+ */
+ char temp[PATH_MAX], *p = temp, *end = p + sizeof(temp);
+
+ p = bufprint(temp, end, "%s/prebuilt/android-%s/kernel/kernel-qemu",
+ i->androidBuildRoot, i->targetArch);
+ if (p >= end || !path_exists(temp)) {
+ derror("bad workspace: cannot find prebuilt kernel in: %s", temp);
+ exit(1);
+ }
+ kernelPath = ASTRDUP(temp);
+ }
+ return kernelPath;
+}
+
+
+char*
+avdInfo_getRamdiskPath( AvdInfo* i )
+{
+ const char* imageName = _imageFileNames[ AVD_IMAGE_RAMDISK ];
+ return _avdInfo_getContentOrSdkFilePath(i, imageName);
+}
+
+char*
+avdInfo_getSystemInitImagePath( AvdInfo* i )
+{
+ const char* imageName = _imageFileNames[ AVD_IMAGE_INITSYSTEM ];
+ return _avdInfo_getContentOrSdkFilePath(i, imageName);
+}
+
+char*
+avdInfo_getDataInitImagePath( AvdInfo* i )
+{
+ const char* imageName = _imageFileNames[ AVD_IMAGE_INITDATA ];
+ return _avdInfo_getContentOrSdkFilePath(i, imageName);
+}
+
int
avdInfo_getHwConfig( AvdInfo* i, AndroidHwConfig* hw )
{
diff --git a/android/avd/info.h b/android/avd/info.h
index adcabfd..d00e9c6 100644
--- a/android/avd/info.h
+++ b/android/avd/info.h
@@ -130,6 +130,16 @@ void avdInfo_free( AvdInfo* i );
*/
const char* avdInfo_getName( AvdInfo* i );
+/* Returns the path to various images corresponding to a given AVD.
+ * NULL if the image cannot be found. Returned strings must be freed
+ * by the caller.
+ */
+char* avdInfo_getKernelPath( AvdInfo* i );
+char* avdInfo_getRamdiskPath( AvdInfo* i );
+
+char* avdInfo_getSystemInitImagePath( AvdInfo* i );
+char* avdInfo_getDataInitImagePath( AvdInfo* i );
+
/* Returns the path to a given AVD image file. This will return NULL if
* the file cannot be found / does not exist.
*/