Browse Source

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>
imx_v2017.03_4.9.11_1.0.0_ga
zhang sanshan 4 years ago
committed by Zhang Bo
parent
commit
61d4dcbd18
3 changed files with 23 additions and 39 deletions
  1. +17
    -35
      common/image-android.c
  2. +2
    -2
      drivers/usb/gadget/command.c
  3. +4
    -2
      drivers/usb/gadget/f_fastboot.c

+ 17
- 35
common/image-android.c View File

@ -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);


+ 2
- 2
drivers/usb/gadget/command.c View File

@ -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);


+ 4
- 2
drivers/usb/gadget/f_fastboot.c View File

@ -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;


Loading…
Cancel
Save