diff options
author | zhang sanshan <sanshan.zhang@nxp.com> | 2017-05-18 21:43:19 +0800 |
---|---|---|
committer | Zhang Bo <bo.zhang@nxp.com> | 2017-06-21 12:21:03 +0800 |
commit | 61d4dcbd1862a4a77a527df3fd8853787cfe0c0c (patch) | |
tree | acc327577b5d57f5650c6782ec0fd5bbcf5d2ba5 /common/image-android.c | |
parent | 0a69b314b60b19aa308be1c978222de70b9e7eab (diff) | |
download | u-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>
Diffstat (limited to 'common/image-android.c')
-rw-r--r-- | common/image-android.c | 52 |
1 files changed, 17 insertions, 35 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); |