summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhang sanshan <sanshan.zhang@nxp.com>2017-05-18 21:43:19 +0800
committerZhang Bo <bo.zhang@nxp.com>2017-06-21 12:21:03 +0800
commit61d4dcbd1862a4a77a527df3fd8853787cfe0c0c (patch)
treeacc327577b5d57f5650c6782ec0fd5bbcf5d2ba5
parent0a69b314b60b19aa308be1c978222de70b9e7eab (diff)
downloadu-boot-imx-61d4dcbd1862a4a77a527df3fd8853787cfe0c0c.zip
u-boot-imx-61d4dcbd1862a4a77a527df3fd8853787cfe0c0c.tar.gz
u-boot-imx-61d4dcbd1862a4a77a527df3fd8853787cfe0c0c.tar.bz2
MA-9382 [Android]uboot: fix compiler issue and command line issue.
Fix compile error when enable CONFIG_NAND_BOOT. Fix data abort issue in uboot. Change-Id: If41a7fafa40a2c851882c723a201ac5cdf31284f Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
-rw-r--r--common/image-android.c52
-rw-r--r--drivers/usb/gadget/command.c4
-rw-r--r--drivers/usb/gadget/f_fastboot.c6
3 files changed, 23 insertions, 39 deletions
diff --git a/common/image-android.c b/common/image-android.c
index 4f1408b..66f4316 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -77,64 +77,46 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
printf("Kernel load addr 0x%08x size %u KiB\n",
kernel_addr, DIV_ROUND_UP(hdr->kernel_size, 1024));
- int len = 0;
- if (*hdr->cmdline) {
- len += strlen(hdr->cmdline);
- }
-
+ char newbootargs[512] = {0};
+ char commandline[1024] = {0};
char *bootargs = getenv("bootargs");
- if (bootargs)
- len += strlen(bootargs);
-
- char *newbootargs = malloc(len + 2);
- if (!newbootargs) {
- puts("Error: malloc in android_image_get_kernel failed!\n");
- return -ENOMEM;
- }
- *newbootargs = '\0';
if (bootargs) {
- strcpy(newbootargs, bootargs);
+ strcpy(commandline, bootargs);
} else if (*hdr->cmdline) {
- strcat(newbootargs, hdr->cmdline);
+ strcat(commandline, hdr->cmdline);
}
- printf("Kernel command line: %s\n", newbootargs);
- char commandline[ANDR_BOOT_ARGS_SIZE];
- strcpy(commandline, newbootargs);
+ printf("Kernel command line: %s\n", commandline);
#ifdef CONFIG_SERIAL_TAG
struct tag_serialnr serialnr;
get_board_serial(&serialnr);
- sprintf(commandline,
- "%s androidboot.serialno=%08x%08x",
- newbootargs,
+ sprintf(newbootargs,
+ " androidboot.serialno=%08x%08x",
serialnr.high,
serialnr.low);
- strcpy(newbootargs, commandline);
+ strcat(commandline, newbootargs);
#endif
int bootdev = get_boot_device();
if (bootdev == SD1_BOOT || bootdev == SD2_BOOT ||
bootdev == SD3_BOOT || bootdev == SD4_BOOT) {
- sprintf(commandline,
- "%s androidboot.storage_type=sd gpt",
- newbootargs);
+ sprintf(newbootargs,
+ " androidboot.storage_type=sd gpt");
} else if (bootdev == MMC1_BOOT || bootdev == MMC2_BOOT ||
bootdev == MMC3_BOOT || bootdev == MMC4_BOOT) {
- sprintf(commandline,
- "%s androidboot.storage_type=emmc",
- newbootargs);
+ sprintf(newbootargs,
+ " androidboot.storage_type=emmc");
} else if (bootdev == NAND_BOOT) {
- sprintf(commandline,
- "%s androidboot.storage_type=nand",
- newbootargs);
+ sprintf(newbootargs,
+ " androidboot.storage_type=nand");
} else
printf("boot device type is incorrect.\n");
+ strcat(commandline, newbootargs);
#ifdef CONFIG_FSL_BOOTCTL
- char suffixStr[64];
- sprintf(suffixStr, " androidboot.slot_suffix=%s", get_slot_suffix());
- strcat(commandline, suffixStr);
+ sprintf(newbootargs, " androidboot.slot_suffix=%s", get_slot_suffix());
+ strcat(commandline, newbootargs);
#endif
setenv("bootargs", commandline);
diff --git a/drivers/usb/gadget/command.c b/drivers/usb/gadget/command.c
index e66e033..543b99e 100644
--- a/drivers/usb/gadget/command.c
+++ b/drivers/usb/gadget/command.c
@@ -73,7 +73,7 @@ int bcb_read_command(char *command)
char *addr_str;
char *nand_str;
ulong misc_info_size;
- nand_info_t *nand = &nand_info[0];
+ struct mtd_info *nand = &nand_info[0];
if (command == NULL)
return -1;
memset(read_cmd, 0, 128);
@@ -97,7 +97,7 @@ int bcb_write_command(char *command)
char *addr_str;
char *nand_str;
ulong misc_info_size;
- nand_info_t *nand = &nand_info[0];
+ struct mtd_info *nand = &nand_info[0];
if (command == NULL)
return -1;
memset(cmd, 0, 128);
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 6c1ce07..fdbf2f8 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -424,7 +424,7 @@ static int write_to_ptn(struct fastboot_ptentry *ptn)
transfer_buffer should already be aligned */
if (interface.nand_block_size) {
if (0 == nand_curr_device) {
- nand_info_t *nand;
+ struct mtd_info *nand;
unsigned long off;
unsigned int ok_start;
@@ -1137,7 +1137,7 @@ static void parameters_setup(void)
{
interface.nand_block_size = 0;
#if defined(CONFIG_FASTBOOT_STORAGE_NAND)
- nand_info_t *nand = &nand_info[0];
+ struct mtd_info *nand = &nand_info[0];
if (nand)
interface.nand_block_size = nand->writesize;
#endif
@@ -1163,9 +1163,11 @@ static int _fastboot_setup_dev(void)
} else if (!strcmp(fastboot_env, "nand")) {
fastboot_devinfo.type = DEV_NAND;
fastboot_devinfo.dev_id = 0;
+#if defined(CONFIG_FASTBOOT_STORAGE_MMC)
} else if (!strncmp(fastboot_env, "mmc", 3)) {
fastboot_devinfo.type = DEV_MMC;
fastboot_devinfo.dev_id = mmc_get_env_dev();
+#endif
}
} else {
return 1;