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>2016-03-25 15:59:38 +0800
commit23d63ff185929fff5e392efc853d69b606ba081a (patch)
tree9f7175ba6d1f67a0cc9f0e76da1401c9e1e96be6 /common/image-android.c
parent5096e572667ff41217deb4ba9b1bd15e93fa6b59 (diff)
downloadu-boot-imx-23d63ff185929fff5e392efc853d69b606ba081a.zip
u-boot-imx-23d63ff185929fff5e392efc853d69b606ba081a.tar.gz
u-boot-imx-23d63ff185929fff5e392efc853d69b606ba081a.tar.bz2
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>
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 b6a94b3..aae29f0 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;
@@ -145,3 +160,21 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
*rd_len = hdr->ramdisk_size;
return 0;
}
+
+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;
+}