[PATCH 10/13] qi-clean-fail-partition-on-mount-fail.patch

Andy Green andy at openmoko.com
Mon Dec 1 02:16:31 CET 2008


Failure to mount the filesystem makes us give up on the whole partition
the moment it happens

Signed-off-by: Andy Green <andy at openmoko.com>
---

 src/phase2.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/phase2.c b/src/phase2.c
index eeb81a1..1d7e3c7 100644
--- a/src/phase2.c
+++ b/src/phase2.c
@@ -59,7 +59,7 @@ int read_file(const char * filepath, u8 * destination, int size)
 		if (!ext2fs_mount()) {
 			puts("Unable to mount ext2 filesystem\n");
 			indicate(UI_IND_MOUNT_FAIL);
-			return -1;
+			return -2; /* death */
 		}
 		puts("    EXT2 open: ");
 		puts(filepath);
@@ -104,6 +104,7 @@ void bootloader_second_phase(void)
 					      (this_board->get_board_variant)();
 	unsigned int initramfs_len = 0;
 	static char commandline_rootfs_append[512] = "";
+	int ret;
 
 	/* we try the possible kernels for this board in order */
 
@@ -189,12 +190,16 @@ void bootloader_second_phase(void)
 
 		/* does he want us to skip this? */
 
-		if (read_file(this_board->noboot, kernel_dram, 512) >= 0) {
-			puts("    (Skipping on finding ");
-			puts(this_board->noboot);
-			puts(")\n");
+		ret = read_file(this_board->noboot, kernel_dram, 512);
+		if (ret != -1) {
+			/* -2 (mount fail) should make us give up too */
+			if (ret >= 0) {
+				puts("    (Skipping on finding ");
+				puts(this_board->noboot);
+				puts(")\n");
+				indicate(UI_IND_SKIPPING);
+			}
 			this_kernel = &this_board->kernel_source[kernel++];
-			indicate(UI_IND_SKIPPING);
 			continue;
 		}
 




More information about the openmoko-kernel mailing list