summaryrefslogtreecommitdiff
path: root/common/cmd_fastboot.c
diff options
context:
space:
mode:
authorZhang Jiejing <jiejing.zhang@freescale.com>2012-02-15 16:40:33 +0800
committerLily Zhang <r58066@freescale.com>2012-02-27 12:59:45 +0800
commitc530d9188dbf0d97cab4b38f0a53a28c56a6bd6c (patch)
tree8a6d3d2e45d4a6a7964e6ae110654aa341a8b576 /common/cmd_fastboot.c
parent72e8b5a4858d802d5135ba0d4b41ea9554a8c987 (diff)
downloadu-boot-imx-c530d9188dbf0d97cab4b38f0a53a28c56a6bd6c.zip
u-boot-imx-c530d9188dbf0d97cab4b38f0a53a28c56a6bd6c.tar.gz
u-boot-imx-c530d9188dbf0d97cab4b38f0a53a28c56a6bd6c.tar.bz2
ENGR00174536-1 booti: add booti command support.
Support booti command which can boot from a boot.img boot.img is a zImage + ramdisk.img + bootargs + boot addr which include these info can be used to avoid mis match between kernel and ramdisk, also can avoid commit to chagne default bootargs. For example: > booti mmc1 command will read the boot.img from 1M offset, and then parser the bootargs and ramdisk then do the boot from that zImage. > booti mmc1 recovery will going to read the recovery's partition no and offset and boot from recovery image. this recovery image also a zImage + ramdisk bootargs: if uboot have define a env var 'bootargs', booti command will use this bootargs as kernel cmdline if you want use boot.img 's bootargs, just type: > setenv bootargs in uboot to clear the bootargs in uboot env. our default uboot env will be NULL in config file. also, android use boot.img to support OTA. Signed-off-by: Zhang Jiejing <jiejing.zhang@freescale.com>
Diffstat (limited to 'common/cmd_fastboot.c')
-rw-r--r--common/cmd_fastboot.c45
1 files changed, 19 insertions, 26 deletions
diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index 4f076f4..eb91763 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -2,7 +2,7 @@
* Copyright 2008 - 2009 (C) Wind River Systems, Inc.
* Tom Rix <Tom.Rix@windriver.com>
*
- * Copyright (C) 2010-2011 Freescale Semiconductor, Inc.
+ * Copyright (C) 2010-2012 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -1014,8 +1014,8 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
(CFG_FASTBOOT_MKBOOTIMAGE_PAGE_SIZE <
download_bytes)) {
char start[32];
- char *bootm[3] = { "bootm", NULL, NULL, };
char *go[3] = { "go", NULL, NULL, };
+ char *booti_args[4] = {"booti", NULL, "boot", NULL};
/*
* Use this later to determine if a command line was passed
@@ -1025,40 +1025,30 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
(struct fastboot_boot_img_hdr *) interface.transfer_buffer;
/* Skip the mkbootimage header */
- image_header_t *hdr =
- (image_header_t *)
- &interface.transfer_buffer[CFG_FASTBOOT_MKBOOTIMAGE_PAGE_SIZE];
+ /* image_header_t *hdr = */
+ /* (image_header_t *) */
+ /* &interface.transfer_buffer[CFG_FASTBOOT_MKBOOTIMAGE_PAGE_SIZE]; */
- bootm[1] = go[1] = start;
- sprintf(start, "0x%x", (unsigned int)hdr);
+ booti_args[1] = start;
+ sprintf(start, "0x%x", (unsigned int)interface.transfer_buffer);
/* Execution should jump to kernel so send the response
now and wait a bit. */
sprintf(response, "OKAY");
fastboot_tx_status(response, strlen(response));
- udelay(1000000); /* 1 sec */
- if (ntohl(hdr->ih_magic) == IH_MAGIC) {
- /* Looks like a kernel.. */
- printf("Booting kernel..\n");
+ printf("Booting kernel...\n");
- /*
- * Check if the user sent a bootargs down.
- * If not, do not override what is already there
- */
- if (strlen((char *)&fb_hdr->cmdline[0]))
- set_env("bootargs",
- (char *)&fb_hdr->cmdline[0]);
- do_bootm(NULL, 0, 2, bootm);
- } else {
- /* Raw image, maybe another uboot */
- printf("Booting raw image..\n");
+ /* Reserve for further use, this can
+ * be more convient for developer. */
+ /* if (strlen ((char *) &fb_hdr->cmdline[0])) */
+ /* set_env("bootargs", (char *) &fb_hdr->cmdline[0]); */
+
+ /* boot the boot.img */
+ do_booti(NULL, 0, 3, booti_args);
+
- do_go(NULL, 0, 2, go);
- }
- printf("ERROR : bootting failed\n");
- printf("You should reset the board\n");
}
sprintf(response, "FAILinvalid boot image");
ret = 0;
@@ -1749,6 +1739,9 @@ fastboot_ptentry *fastboot_flash_find_ptn(const char *name)
return ptable + n;
}
}
+
+ printf("can't find partition: %s, dump the partition table\n", name);
+ fastboot_flash_dump_ptn();
return 0;
}