From 842a4ad19b6bf5b2376a578478e109453f5bdd89 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 1 Dec 2008 01:26:05 +0000 Subject: [PATCH] qi-kernel-source-skip-if-ui-key-down.patch Signed-off-by: Andy Green --- qiboot/src/cpu/s3c2442/nand_read.c | 6 ++++++ qiboot/src/fs/dev.c | 6 ++++++ qiboot/src/phase2.c | 31 ++++++++++++++++-------------- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/qiboot/src/cpu/s3c2442/nand_read.c b/qiboot/src/cpu/s3c2442/nand_read.c index cb2a2de..bec2e8b 100644 --- a/qiboot/src/cpu/s3c2442/nand_read.c +++ b/qiboot/src/cpu/s3c2442/nand_read.c @@ -143,6 +143,12 @@ int nand_read_ll(unsigned char *buf, unsigned long start_block512, start_block512 += j; buf += j << 9; blocks512 -= j; + + if (this_board->get_ui_keys) + if ((this_board->get_ui_keys)() & UI_ACTION_SKIPKERNEL) { + puts(" ** skipping \n"); + return -3; + } } /* chip Disable */ diff --git a/qiboot/src/fs/dev.c b/qiboot/src/fs/dev.c index 694c8b1..8ffcf2d 100644 --- a/qiboot/src/fs/dev.c +++ b/qiboot/src/fs/dev.c @@ -52,6 +52,12 @@ int ext2fs_devread(int sector, int filesystem_block_log2, int byte_offset, int b return 0; } + if (this_board->get_ui_keys) + if ((this_board->get_ui_keys)() & UI_ACTION_SKIPKERNEL) { + puts(" ** skipping \n"); + return 0; + } + /* * Get the read to the beginning of a partition. */ diff --git a/qiboot/src/phase2.c b/qiboot/src/phase2.c index 30c9b15..2ce7829 100644 --- a/qiboot/src/phase2.c +++ b/qiboot/src/phase2.c @@ -45,6 +45,7 @@ int raise(int n) int read_file(const char * filepath, u8 * destination, int size) { int len = size; + int ret; switch (this_kernel->filesystem) { case FS_EXT2: @@ -60,7 +61,11 @@ int read_file(const char * filepath, u8 * destination, int size) return -1; } puts(" OK\n"); - ext2fs_read((char *)destination, size); + ret = ext2fs_read((char *)destination, size); + if (ret < 0) { + puts(" Read failed\n"); + return -1; + } break; case FS_FAT: @@ -282,26 +287,24 @@ void bootloader_second_phase(void) /* kernel commandline */ - if (*p) { - cmdline = params->u.cmdline.cmdline; - cmdline += strlen(strcpy(cmdline, p)); - if (this_kernel->commandline_append) - cmdline += strlen(strcpy(cmdline, + cmdline = params->u.cmdline.cmdline; + cmdline += strlen(strcpy(cmdline, p)); + if (this_kernel->commandline_append) + cmdline += strlen(strcpy(cmdline, this_kernel->commandline_append)); if (commandline_rootfs_append[0]) cmdline += strlen(strcpy(cmdline, commandline_rootfs_append)); - params->hdr.tag = ATAG_CMDLINE; - params->hdr.size = (sizeof (struct tag_header) + - strlen(params->u.cmdline.cmdline) + 1 + 4) >> 2; + params->hdr.tag = ATAG_CMDLINE; + params->hdr.size = (sizeof (struct tag_header) + + strlen(params->u.cmdline.cmdline) + 1 + 4) >> 2; - puts(" Cmdline: "); - puts(params->u.cmdline.cmdline); - puts("\n"); + puts(" Cmdline: "); + puts(params->u.cmdline.cmdline); + puts("\n"); - params = tag_next (params); - } + params = tag_next (params); /* needs to always be the last tag */ params->hdr.tag = ATAG_NONE;