summaryrefslogtreecommitdiff
path: root/common/image-android.c
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2016-03-10 10:48:24 +0800
committerYe Li <ye.li@nxp.com>2017-04-05 19:47:58 +0800
commitd0d678fd9bbe9b115e06107f392229104de9b233 (patch)
tree00fa17609ced1332e0ae12093dadd845f042275b /common/image-android.c
parente84160eaf5c057da45a227039c6f8a7911f43a82 (diff)
MLK-12527-2 android: Add FSL android fastboot support
Integrate the FSL android fastboot features into community's fastboot. 1. Use USB gadget g_dnl driver 2. Integrate the FSL SD/SATA/NAND flash operations, since the GPT and EFI partitions are not support by i.MX. 3. Add FDT support to community's android image. 4. Add a new boot command "boota" for android image boot. The boota implements to load ramdisk and fdt to their loading addresses specified in boot.img header, while bootm won't do it for android image. 5. Support the authentication of boot.img at the "load_addr" for both SD and NAND. 6. We use new configuration CONFIG_FSL_FASTBOOT for Freescale's fastboot with relevant header file "fsl_fastboot.h". While disabling the configuration, the community fastboot is used. 7. Overwrite the cmdline in boot.img by using bootargs saved in local environment. 8. Add recovery and reboot-bootloader support. Signed-off-by: Ye Li <ye.li@nxp.com> (cherry picked from commit 23d63ff185929fff5e392efc853d69b606ba081a)
Diffstat (limited to 'common/image-android.c')
-rw-r--r--common/image-android.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/common/image-android.c b/common/image-android.c
index ee03b96aaa..12ae345906 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -1,6 +1,8 @@
/*
* Copyright (c) 2011 Sebastian Andrzej Siewior <bigeasy@linutronix.de>
*
+ * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
+ *
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -9,6 +11,7 @@
#include <android_image.h>
#include <malloc.h>
#include <errno.h>
+#include <asm/bootm.h>
#define ANDROID_IMAGE_DEFAULT_KERNEL_ADDR 0x10008000
@@ -68,7 +71,6 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
int len = 0;
if (*hdr->cmdline) {
- printf("Kernel command line: %s\n", hdr->cmdline);
len += strlen(hdr->cmdline);
}
@@ -85,12 +87,25 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
if (bootargs) {
strcpy(newbootargs, bootargs);
- strcat(newbootargs, " ");
- }
- if (*hdr->cmdline)
+ } else if (*hdr->cmdline) {
strcat(newbootargs, hdr->cmdline);
+ }
+ printf("Kernel command line: %s\n", newbootargs);
+#ifdef CONFIG_SERIAL_TAG
+ struct tag_serialnr serialnr;
+ char commandline[ANDR_BOOT_ARGS_SIZE];
+ get_board_serial(&serialnr);
+
+ sprintf(commandline,
+ "%s androidboot.serialno=%08x%08x",
+ newbootargs,
+ serialnr.high,
+ serialnr.low);
+ setenv("bootargs", commandline);
+#else
setenv("bootargs", newbootargs);
+#endif
if (os_data) {
*os_data = (ulong)hdr;
@@ -174,3 +189,21 @@ void android_print_contents(const struct andr_img_hdr *hdr)
printf("%scmdline: %s\n", p, hdr->cmdline);
}
#endif
+
+int android_image_get_fdt(const struct andr_img_hdr *hdr,
+ ulong *fdt_data, ulong *fdt_len)
+{
+ if (!hdr->second_size)
+ return -1;
+
+ printf("FDT load addr 0x%08x size %u KiB\n",
+ hdr->second_addr, DIV_ROUND_UP(hdr->second_size, 1024));
+
+ *fdt_data = (unsigned long)hdr;
+ *fdt_data += hdr->page_size;
+ *fdt_data += ALIGN(hdr->kernel_size, hdr->page_size);
+ *fdt_data += ALIGN(hdr->ramdisk_size, hdr->page_size);
+
+ *fdt_len = hdr->second_size;
+ return 0;
+}