Support EXT4 cache partition images.
Recent Android kernels (3.10) do not support YAFFS2 anymore, as such
the cache partition must be formatted as EXT4 when they are used.
This patch adds the necessary code to do the following:
- Auto-detect whether a YAFFS2 or EXT4 cache partition is needed
based on the kernel version.
- Add a hardware property to override the auto-detected result,
in case of problem (kernel.supportsYaffs2)
- Create either an empty YAFFS2 or EXT4 cache partition when the
file doesn't exist yet in the AVD's content directory.
This uses the new android_createEmptyExt4Image() function that
was introduced in a previous patch.
Change-Id: Idd0e49501422993f655f77f14db651d5d2eb4ca2
diff --git a/android/main.c b/android/main.c
index c01fa92..363c923 100644
--- a/android/main.c
+++ b/android/main.c
@@ -454,15 +454,17 @@
}
}
+ KernelType kernelType = KERNEL_TYPE_LEGACY;
+ if (!android_pathProbeKernelType(hw->kernel_path, &kernelType)) {
+ D("WARNING: Could not determine kernel device naming scheme. Assuming legacy\n"
+ "If this AVD doesn't boot, and uses a recent kernel (3.10 or above) try setting\n"
+ "'kernel.newDeviceNaming' to 'yes' in its configuration.\n");
+ }
+
// Auto-detect kernel device naming scheme if needed.
if (androidHwConfig_getKernelDeviceNaming(hw) < 0) {
- KernelType kernelType;
const char* newDeviceNaming = "no";
- if (!android_pathProbeKernelType(hw->kernel_path, &kernelType)) {
- D("WARNING: Could not determine kernel device naming scheme. Assuming legacy\n"
- "If this AVD doesn't boot, and uses a recent kernel (3.10 or above) try setting\n"
- "'kernel.newDeviceNaming' to 'yes' in its configuration.\n");
- } else if (kernelType == KERNEL_TYPE_3_10_OR_ABOVE) {
+ if (kernelType == KERNEL_TYPE_3_10_OR_ABOVE) {
D("Auto-detect: Kernel image requires new device naming scheme.");
newDeviceNaming = "yes";
} else {
@@ -472,6 +474,19 @@
hw->kernel_newDeviceNaming = ASTRDUP(newDeviceNaming);
}
+ // Auto-detect YAFFS2 partition support if needed.
+ if (androidHwConfig_getKernelYaffs2Support(hw) < 0) {
+ const char* newYaffs2Support = "no";
+ if (kernelType == KERNEL_TYPE_3_10_OR_ABOVE) {
+ D("Auto-detect: Kernel does not support YAFFS2 partitions.");
+ } else {
+ D("Auto-detect: Kernel does support YAFFS2 partitions.");
+ newYaffs2Support = "yes";
+ }
+ AFREE(hw->kernel_supportsYaffs2);
+ hw->kernel_supportsYaffs2 = ASTRDUP(newYaffs2Support);
+ }
+
if (boot_prop_ip[0]) {
args[n++] = "-boot-property";
args[n++] = boot_prop_ip;