From 2204203a949234ceb652b1236c89837405d8fe5f Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Tue, 18 Dec 2012 21:23:08 +0000 Subject: Fix handling of MTD partitions during mount --- partition.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'partition.cpp') diff --git a/partition.cpp b/partition.cpp index 32376c1bc..0590d981c 100644 --- a/partition.cpp +++ b/partition.cpp @@ -656,7 +656,25 @@ bool TWPartition::Mount(bool Display_Error) { // Check the current file system before mounting Check_FS_Type(); - if (mount(Actual_Block_Device.c_str(), Mount_Point.c_str(), Current_File_System.c_str(), 0, NULL) != 0) { + if (Fstab_File_System == "yaffs2") { + // mount an MTD partition as a YAFFS2 filesystem. + mtd_scan_partitions(); + const MtdPartition* partition; + partition = mtd_find_partition_by_name(MTD_Name.c_str()); + if (partition == NULL) { + LOGE("Failed to find '%s' partition to mount at '%s'\n", + MTD_Name.c_str(), Mount_Point.c_str()); + return false; + } + if (mtd_mount_partition(partition, Mount_Point.c_str(), Fstab_File_System.c_str(), 0)) { + if (Display_Error) + LOGE("Failed to mount '%s' (MTD)\n", Mount_Point.c_str()); + else + LOGI("Failed to mount '%s' (MTD)\n", Mount_Point.c_str()); + return false; + } else + return true; + } else if (mount(Actual_Block_Device.c_str(), Mount_Point.c_str(), Current_File_System.c_str(), 0, NULL) != 0) { if (Display_Error) LOGE("Unable to mount '%s'\n", Mount_Point.c_str()); else -- cgit v1.2.3