From 513fb7d0fc12a30871eb6f288c70e2173fb75084 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 1 Dec 2008 01:26:06 +0000 Subject: [PATCH] qi-clean-fail-partition-on-mount-fail.patch Failure to mount the filesystem makes us give up on the whole partition the moment it happens Signed-off-by: Andy Green --- qiboot/src/phase2.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/qiboot/src/phase2.c b/qiboot/src/phase2.c index eeb81a1..1d7e3c7 100644 --- a/qiboot/src/phase2.c +++ b/qiboot/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; }