recovery: Autodetection of device flash type
Detect flash type at runtime rather than requiring this to be set in the
device configuration. The detection is based on the existence of /proc/mtd,
/proc/emmc, or /dev/block/bml1.
Change-Id: I464962a567022c5862c249f06d36c2d1cddeacba
diff --git a/updater/Android.mk b/updater/Android.mk
index ae90211..d312493 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -19,7 +19,7 @@
LOCAL_SRC_FILES := $(updater_src_files)
-LOCAL_STATIC_LIBRARIES += $(BOARD_FLASH_LIBRARY)
+LOCAL_STATIC_LIBRARIES += libflashutils libmtdutils libmmcutils libbmlutils
LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)
LOCAL_STATIC_LIBRARIES += libapplypatch libedify libminzip libz
diff --git a/updater/install.c b/updater/install.c
index c71781a..7b9aa80 100644
--- a/updater/install.c
+++ b/updater/install.c
@@ -33,17 +33,12 @@
#include "mincrypt/sha.h"
#include "minzip/DirUtil.h"
#include "mounts.h"
+#include "flashutils/flashutils.h"
#include "mtdutils/mtdutils.h"
#include "mmcutils/mmcutils.h"
#include "updater.h"
#include "applypatch/applypatch.h"
-#ifndef BOARD_USES_MMCUTILS
-#define DEFAULT_FILESYSTEM "yaffs2"
-#else
-#define DEFAULT_FILESYSTEM "ext3"
-#endif
-
// mount(type, location, mount_point)
//
// what: type="MTD" location="<partition>" to mount a yaffs2 filesystem
@@ -76,7 +71,7 @@
mkdir(mount_point, 0755);
if (strcmp(type, "MTD") == 0 || strcmp(type, "MMC") == 0) {
- if (0 == mount_partition(location, mount_point, DEFAULT_FILESYSTEM, 0))
+ if (0 == mount_partition(location, mount_point, get_default_filesystem(), 0))
result = mount_point;
else
result = strdup("");