[PATCH 05/13] qi-kernel-source-skip-if-ui-key-down.patch
Andy Green
andy at openmoko.com
Mon Dec 1 02:16:06 CET 2008
Signed-off-by: Andy Green <andy at openmoko.com>
---
src/cpu/s3c2442/nand_read.c | 6 ++++++
src/fs/dev.c | 6 ++++++
src/phase2.c | 31 +++++++++++++++++--------------
3 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/src/cpu/s3c2442/nand_read.c b/src/cpu/s3c2442/nand_read.c
index cb2a2de..bec2e8b 100644
--- a/src/cpu/s3c2442/nand_read.c
+++ b/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/src/fs/dev.c b/src/fs/dev.c
index 694c8b1..8ffcf2d 100644
--- a/src/fs/dev.c
+++ b/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/src/phase2.c b/src/phase2.c
index 30c9b15..2ce7829 100644
--- a/src/phase2.c
+++ b/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;
More information about the openmoko-kernel
mailing list