diff --git a/mmcutils/mmcutils.c b/mmcutils/mmcutils.c index 76b8ff8..492dadc 100644 --- a/mmcutils/mmcutils.c +++ b/mmcutils/mmcutils.c @@ -348,17 +348,23 @@ format_ext3_device (const char *device) { char *const tune2fs[] = {TUNE2FS_BIN, "-j", "-C", "1", device, NULL}; #endif // Run mke2fs - if(run_exec_process(mke2fs)) + if(run_exec_process(mke2fs)) { + printf("failure while running mke2fs\n"); return -1; + } // Run tune2fs - if(run_exec_process(tune2fs)) + if(run_exec_process(tune2fs)) { + printf("failure while running mke2fs\n"); return -1; + } // Run e2fsck char *const e2fsck[] = {E2FSCK_BIN, "-fy", device, NULL}; - if(run_exec_process(e2fsck)) + if(run_exec_process(e2fsck)) { + printf("failure while running e2fsck\n"); return -1; + } return 0; } diff --git a/roots.c b/roots.c index 527fc59..ba1786b 100644 --- a/roots.c +++ b/roots.c @@ -176,6 +176,10 @@ void setup_data_media() { } int ensure_path_mounted(const char* path) { + return ensure_path_mounted_at_mount_point(path, NULL); +} + +int ensure_path_mounted_at_mount_point(const char* path, const char* mount_point) { Volume* v = volume_for_path(path); if (v == NULL) { // no /sdcard? let's assume /data/media @@ -202,14 +206,17 @@ int ensure_path_mounted(const char* path) { return -1; } + if (NULL == mount_point) + mount_point = v->mount_point; + const MountedVolume* mv = - find_mounted_volume_by_mount_point(v->mount_point); + find_mounted_volume_by_mount_point(mount_point); if (mv) { // volume is already mounted return 0; } - mkdir(v->mount_point, 0755); // in case it doesn't already exist + mkdir(mount_point, 0755); // in case it doesn't already exist if (strcmp(v->fs_type, "yaffs2") == 0) { // mount an MTD partition as a YAFFS2 filesystem. @@ -218,21 +225,21 @@ int ensure_path_mounted(const char* path) { partition = mtd_find_partition_by_name(v->device); if (partition == NULL) { LOGE("failed to find \"%s\" partition to mount at \"%s\"\n", - v->device, v->mount_point); + v->device, mount_point); return -1; } - return mtd_mount_partition(partition, v->mount_point, v->fs_type, 0); + return mtd_mount_partition(partition, mount_point, v->fs_type, 0); } else if (strcmp(v->fs_type, "ext4") == 0 || strcmp(v->fs_type, "ext3") == 0 || strcmp(v->fs_type, "rfs") == 0 || strcmp(v->fs_type, "vfat") == 0) { - if ((result = try_mount(v->device, v->mount_point, v->fs_type, v->fs_options)) == 0) + if ((result = try_mount(v->device, mount_point, v->fs_type, v->fs_options)) == 0) return 0; - if ((result = try_mount(v->device2, v->mount_point, v->fs_type, v->fs_options)) == 0) + if ((result = try_mount(v->device2, mount_point, v->fs_type, v->fs_options)) == 0) return 0; - if ((result = try_mount(v->device, v->mount_point, v->fs_type2, v->fs_options2)) == 0) + if ((result = try_mount(v->device, mount_point, v->fs_type2, v->fs_options2)) == 0) return 0; - if ((result = try_mount(v->device2, v->mount_point, v->fs_type2, v->fs_options2)) == 0) + if ((result = try_mount(v->device2, mount_point, v->fs_type2, v->fs_options2)) == 0) return 0; return result; } else { @@ -242,7 +249,7 @@ int ensure_path_mounted(const char* path) { return __system(mount_cmd); } - LOGE("unknown fs_type \"%s\" for %s\n", v->fs_type, v->mount_point); + LOGE("unknown fs_type \"%s\" for %s\n", v->fs_type, mount_point); return -1; } diff --git a/roots.h b/roots.h index 7914307..af82280 100644 --- a/roots.h +++ b/roots.h @@ -28,6 +28,7 @@ Volume* volume_for_path(const char* path); // Make sure that the volume 'path' is on is mounted. Returns 0 on // success (volume is mounted). int ensure_path_mounted(const char* path); +int ensure_path_mounted_at_mount_point(const char* path, const char* mount_point); // Make sure that the volume 'path' is on is mounted. Returns 0 on // success (volume is unmounted); diff --git a/utilities/Android.mk b/utilities/Android.mk index badd25e..fb2e098 100755 --- a/utilities/Android.mk +++ b/utilities/Android.mk @@ -48,7 +48,11 @@ LOCAL_MODULE := mke2fs LOCAL_MODULE_TAGS := eng LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin +ifeq ($(BOARD_MKE2FS),) LOCAL_SRC_FILES := $(LOCAL_MODULE) +else +LOCAL_SRC_FILES := ../../../$(BOARD_MKE2FS) +endif include $(BUILD_PREBUILT) endif @@ -90,7 +94,11 @@ LOCAL_MODULE := htcbatt LOCAL_MODULE_TAGS := eng LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin +ifeq ($(BOARD_HTCBATT),) LOCAL_SRC_FILES := $(LOCAL_MODULE) +else +LOCAL_SRC_FILES := ../../../$(BOARD_HTCBATT) +endif include $(BUILD_PREBUILT) endif