summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/image-android.c28
-rw-r--r--configs/mx6dlsabreautoandroid_defconfig1
-rw-r--r--configs/mx6dlsabreautoandroid_nand_defconfig1
-rw-r--r--configs/mx6dlsabresdandroid_defconfig1
-rw-r--r--configs/mx6qpsabreautoandroid_defconfig1
-rw-r--r--configs/mx6qpsabreautoandroid_nand_defconfig1
-rw-r--r--configs/mx6qpsabresdandroid_defconfig1
-rw-r--r--configs/mx6qsabreautoandroid_defconfig1
-rw-r--r--configs/mx6qsabreautoandroid_nand_defconfig1
-rw-r--r--configs/mx6qsabresdandroid_defconfig1
-rw-r--r--configs/mx6slevkandroid_defconfig1
-rw-r--r--configs/mx6solosabreautoandroid_defconfig1
-rw-r--r--configs/mx6solosabreautoandroid_nand_defconfig1
-rw-r--r--configs/mx6solosabresdandroid_defconfig1
-rw-r--r--configs/mx6sxsabreautoandroid_defconfig1
-rw-r--r--configs/mx6sxsabreautoandroid_nand_defconfig1
-rw-r--r--configs/mx6sxsabresdandroid_defconfig1
-rw-r--r--configs/mx6ul_14x14_evk_android_defconfig1
-rw-r--r--configs/mx7dsabresdandroid_defconfig1
-rw-r--r--configs/mx7ulp_evk_android_defconfig1
-rw-r--r--disk/part_efi.c6
-rw-r--r--drivers/usb/gadget/f_fastboot.c83
-rw-r--r--include/configs/mx6sabresd.h3
23 files changed, 120 insertions, 19 deletions
diff --git a/common/image-android.c b/common/image-android.c
index 12ae345..de5e97c 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -2,6 +2,7 @@
* Copyright (c) 2011 Sebastian Andrzej Siewior <bigeasy@linutronix.de>
*
* Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -12,6 +13,7 @@
#include <malloc.h>
#include <errno.h>
#include <asm/bootm.h>
+#include <asm/imx-common/boot_mode.h>
#define ANDROID_IMAGE_DEFAULT_KERNEL_ADDR 0x10008000
@@ -92,9 +94,10 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
}
printf("Kernel command line: %s\n", newbootargs);
+ char commandline[ANDR_BOOT_ARGS_SIZE];
+ strcpy(commandline, newbootargs);
#ifdef CONFIG_SERIAL_TAG
struct tag_serialnr serialnr;
- char commandline[ANDR_BOOT_ARGS_SIZE];
get_board_serial(&serialnr);
sprintf(commandline,
@@ -102,10 +105,27 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
newbootargs,
serialnr.high,
serialnr.low);
- setenv("bootargs", commandline);
-#else
- setenv("bootargs", newbootargs);
+ strcpy(newbootargs, commandline);
#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);
+ } else if (bootdev == MMC1_BOOT || bootdev == MMC2_BOOT ||
+ bootdev == MMC3_BOOT || bootdev == MMC4_BOOT) {
+ sprintf(commandline,
+ "%s androidboot.storage_type=emmc",
+ newbootargs);
+ } else if (bootdev == NAND_BOOT) {
+ sprintf(commandline,
+ "%s androidboot.storage_type=nand",
+ newbootargs);
+ } else
+ printf("boot device type is incorrect.\n");
+
+ setenv("bootargs", commandline);
if (os_data) {
*os_data = (ulong)hdr;
diff --git a/configs/mx6dlsabreautoandroid_defconfig b/configs/mx6dlsabreautoandroid_defconfig
index ad89f2e..152d9c7 100644
--- a/configs/mx6dlsabreautoandroid_defconfig
+++ b/configs/mx6dlsabreautoandroid_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6QSABREAUTO=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6qsabreauto/mx6dl.cfg,MX6DL"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
diff --git a/configs/mx6dlsabreautoandroid_nand_defconfig b/configs/mx6dlsabreautoandroid_nand_defconfig
index 907b3d8..52eec9c 100644
--- a/configs/mx6dlsabreautoandroid_nand_defconfig
+++ b/configs/mx6dlsabreautoandroid_nand_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6QSABREAUTO=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6qsabreauto/mx6dl.cfg,MX6DL"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_NAND_BOOT=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
diff --git a/configs/mx6dlsabresdandroid_defconfig b/configs/mx6dlsabresdandroid_defconfig
index a8838c0..fadd345 100644
--- a/configs/mx6dlsabresdandroid_defconfig
+++ b/configs/mx6dlsabresdandroid_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6SABRESD=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6sabresd/mx6dlsabresd.cfg,MX6DL"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
diff --git a/configs/mx6qpsabreautoandroid_defconfig b/configs/mx6qpsabreautoandroid_defconfig
index 61eb1f1..a9a6bdd 100644
--- a/configs/mx6qpsabreautoandroid_defconfig
+++ b/configs/mx6qpsabreautoandroid_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6QSABREAUTO=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6qsabreauto/mx6qp.cfg,MX6QP"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
diff --git a/configs/mx6qpsabreautoandroid_nand_defconfig b/configs/mx6qpsabreautoandroid_nand_defconfig
index 415db1e..1537f75 100644
--- a/configs/mx6qpsabreautoandroid_nand_defconfig
+++ b/configs/mx6qpsabreautoandroid_nand_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6QSABREAUTO=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6qsabreauto/mx6qp.cfg,MX6QP"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_NAND_BOOT=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
diff --git a/configs/mx6qpsabresdandroid_defconfig b/configs/mx6qpsabresdandroid_defconfig
index 8d6a76e..e4ac748 100644
--- a/configs/mx6qpsabresdandroid_defconfig
+++ b/configs/mx6qpsabresdandroid_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6SABRESD=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6sabresd/mx6qp.cfg,MX6QP"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
diff --git a/configs/mx6qsabreautoandroid_defconfig b/configs/mx6qsabreautoandroid_defconfig
index 4c02985..2d9b401 100644
--- a/configs/mx6qsabreautoandroid_defconfig
+++ b/configs/mx6qsabreautoandroid_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6QSABREAUTO=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6qsabreauto/imximage.cfg,MX6Q"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
diff --git a/configs/mx6qsabreautoandroid_nand_defconfig b/configs/mx6qsabreautoandroid_nand_defconfig
index b802d10..74fd951 100644
--- a/configs/mx6qsabreautoandroid_nand_defconfig
+++ b/configs/mx6qsabreautoandroid_nand_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6QSABREAUTO=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6qsabreauto/imximage.cfg,MX6Q"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_NAND_BOOT=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
diff --git a/configs/mx6qsabresdandroid_defconfig b/configs/mx6qsabresdandroid_defconfig
index 5acc725..527c2cb 100644
--- a/configs/mx6qsabresdandroid_defconfig
+++ b/configs/mx6qsabresdandroid_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6SABRESD=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg,MX6Q"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
diff --git a/configs/mx6slevkandroid_defconfig b/configs/mx6slevkandroid_defconfig
index 4dac282..85aa004 100644
--- a/configs/mx6slevkandroid_defconfig
+++ b/configs/mx6slevkandroid_defconfig
@@ -3,6 +3,7 @@ CONFIG_ARCH_MX6=y
CONFIG_TARGET_MX6SLEVK=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6slevk/imximage.cfg,MX6SL"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
CONFIG_HUSH_PARSER=y
CONFIG_CMD_BOOTZ=y
diff --git a/configs/mx6solosabreautoandroid_defconfig b/configs/mx6solosabreautoandroid_defconfig
index 12bf71e..4fe7880 100644
--- a/configs/mx6solosabreautoandroid_defconfig
+++ b/configs/mx6solosabreautoandroid_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6QSABREAUTO=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6qsabreauto/mx6solo.cfg,MX6S"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
diff --git a/configs/mx6solosabreautoandroid_nand_defconfig b/configs/mx6solosabreautoandroid_nand_defconfig
index 0f2f75d..ead5dcd 100644
--- a/configs/mx6solosabreautoandroid_nand_defconfig
+++ b/configs/mx6solosabreautoandroid_nand_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6QSABREAUTO=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6qsabreauto/mx6solo.cfg,MX6S"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_NAND_BOOT=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
diff --git a/configs/mx6solosabresdandroid_defconfig b/configs/mx6solosabresdandroid_defconfig
index f665602..4f83f74 100644
--- a/configs/mx6solosabresdandroid_defconfig
+++ b/configs/mx6solosabresdandroid_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6SABRESD=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6sabresd/mx6solo_4x_mt41j128.cfg,MX6S"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
diff --git a/configs/mx6sxsabreautoandroid_defconfig b/configs/mx6sxsabreautoandroid_defconfig
index 68fea61..57c5f09 100644
--- a/configs/mx6sxsabreautoandroid_defconfig
+++ b/configs/mx6sxsabreautoandroid_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6SXSABREAUTO=y
CONFIG_DEFAULT_DEVICE_TREE="imx6sx-sabreauto"
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6sxsabreauto/imximage.cfg"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
CONFIG_HUSH_PARSER=y
CONFIG_CMD_BOOTZ=y
diff --git a/configs/mx6sxsabreautoandroid_nand_defconfig b/configs/mx6sxsabreautoandroid_nand_defconfig
index e3510b0..db628fc 100644
--- a/configs/mx6sxsabreautoandroid_nand_defconfig
+++ b/configs/mx6sxsabreautoandroid_nand_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6SXSABREAUTO=y
CONFIG_DEFAULT_DEVICE_TREE="imx6sx-sabreauto"
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6sxsabreauto/imximage.cfg"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_NAND_BOOT=y
CONFIG_BOOTDELAY=3
CONFIG_HUSH_PARSER=y
diff --git a/configs/mx6sxsabresdandroid_defconfig b/configs/mx6sxsabresdandroid_defconfig
index 0c30dc6..9847885 100644
--- a/configs/mx6sxsabresdandroid_defconfig
+++ b/configs/mx6sxsabresdandroid_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX6SXSABRESD=y
CONFIG_VIDEO=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6sxsabresd/imximage.cfg"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
diff --git a/configs/mx6ul_14x14_evk_android_defconfig b/configs/mx6ul_14x14_evk_android_defconfig
index e66c214..f5e234b 100644
--- a/configs/mx6ul_14x14_evk_android_defconfig
+++ b/configs/mx6ul_14x14_evk_android_defconfig
@@ -5,6 +5,7 @@ CONFIG_VIDEO=y
CONFIG_DEFAULT_DEVICE_TREE="imx6ul-14x14-evk"
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6ul_14x14_evk/imximage.cfg"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
CONFIG_BOARD_EARLY_INIT_F=y
CONFIG_HUSH_PARSER=y
diff --git a/configs/mx7dsabresdandroid_defconfig b/configs/mx7dsabresdandroid_defconfig
index f3b2614..28f034a 100644
--- a/configs/mx7dsabresdandroid_defconfig
+++ b/configs/mx7dsabresdandroid_defconfig
@@ -8,6 +8,7 @@ CONFIG_VIDEO=y
CONFIG_DEFAULT_DEVICE_TREE="imx7d-sdb"
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx7dsabresd/imximage.cfg"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOOTDELAY=3
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
diff --git a/configs/mx7ulp_evk_android_defconfig b/configs/mx7ulp_evk_android_defconfig
index 34f6f21..e2a946e 100644
--- a/configs/mx7ulp_evk_android_defconfig
+++ b/configs/mx7ulp_evk_android_defconfig
@@ -4,6 +4,7 @@ CONFIG_TARGET_MX7ULP_EVK=y
CONFIG_DEFAULT_DEVICE_TREE="imx7ulp-evk-qspi"
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx7ulp_evk/imximage.cfg"
CONFIG_FASTBOOT=y
+CONFIG_EFI_PARTITION=y
CONFIG_BOARD_LATE_INIT=y
CONFIG_BOARD_EARLY_INIT_F=y
CONFIG_HUSH_PARSER=y
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 893cbbd..492b5ed 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -143,7 +143,7 @@ static int validate_gpt_entries(gpt_header *gpt_h, gpt_entry *gpt_e)
le32_to_cpu(gpt_h->sizeof_partition_entry));
if (calc_crc32 != le32_to_cpu(gpt_h->partition_entry_array_crc32)) {
- printf("%s: 0x%x != 0x%x\n",
+ debug("%s: 0x%x != 0x%x\n",
"GUID Partition Table Entry Array CRC is wrong",
le32_to_cpu(gpt_h->partition_entry_array_crc32),
calc_crc32);
@@ -248,14 +248,14 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part,
/* This function validates AND fills in the GPT header and PTE */
if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
gpt_head, &gpt_pte) != 1) {
- printf("%s: *** ERROR: Invalid GPT ***\n", __func__);
+ debug("%s: *** ERROR: Invalid GPT ***\n", __func__);
if (is_gpt_valid(dev_desc, (dev_desc->lba - 1),
gpt_head, &gpt_pte) != 1) {
printf("%s: *** ERROR: Invalid Backup GPT ***\n",
__func__);
return -1;
} else {
- printf("%s: *** Using Backup GPT ***\n",
+ debug("%s: *** Using Backup GPT ***\n",
__func__);
}
}
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 153d177..964448e 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -9,6 +9,7 @@
* Rob Herring <robh@kernel.org>
*
* Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -46,6 +47,10 @@
#define FASTBOOT_VERSION "0.4"
+#ifdef CONFIG_EFI_PARTITION
+#define ANDROID_GPT_OFFSET 0
+#define ANDROID_GPT_SIZE 0x100000
+#endif
#define FASTBOOT_INTERFACE_CLASS 0xff
#define FASTBOOT_INTERFACE_SUB_CLASS 0x42
#define FASTBOOT_INTERFACE_PROTOCOL 0x03
@@ -165,11 +170,20 @@ static struct usb_gadget_strings *fastboot_strings[] = {
#ifdef CONFIG_FSL_FASTBOOT
+#ifdef CONFIG_EFI_PARTITION
+#define ANDROID_BOOT_PARTITION_MMC 1
+#define ANDROID_RECOVERY_PARTITION_MMC 2
+#define ANDROID_SYSTEM_PARTITION_MMC 3
+#define ANDROID_CACHE_PARTITION_MMC 4
+#define ANDROID_MISC_PARTITION_MMC 6
+#define ANDROID_DATA_PARTITION_MMC 10
+#else
#define ANDROID_BOOT_PARTITION_MMC 1
#define ANDROID_SYSTEM_PARTITION_MMC 5
#define ANDROID_RECOVERY_PARTITION_MMC 2
#define ANDROID_CACHE_PARTITION_MMC 6
#define ANDROID_DATA_PARTITION_MMC 4
+#endif
#define ANDROID_MBR_OFFSET 0
#define ANDROID_MBR_SIZE 0x200
@@ -189,6 +203,24 @@ static struct usb_gadget_strings *fastboot_strings[] = {
/*pentry index internally*/
+#ifdef CONFIG_EFI_PARTITION
+enum {
+ PTN_GPT_INDEX = 0,
+ PTN_BOOTLOADER_INDEX,
+ PTN_BOOT_INDEX,
+ PTN_RECOVERY_INDEX,
+ PTN_SYSTEM_INDEX,
+ PTN_CACHE_INDEX,
+ PTN_DEVICE_INDEX,
+ PTN_MISC_INDEX,
+ PTN_DATAFOOTER_INDEX,
+ PTN_VBMETA_INDEX,
+ PTN_PRESISTDATA_INDEX,
+ PTN_DATA_INDEX,
+ PTN_FBMISC_INDEX,
+ PTN_NUM
+};
+#else
enum {
PTN_MBR_INDEX = 0,
PTN_BOOTLOADER_INDEX,
@@ -196,9 +228,10 @@ enum {
PTN_URAMDISK_INDEX,
PTN_SYSTEM_INDEX,
PTN_RECOVERY_INDEX,
- PTN_DATA_INDEX
+ PTN_DATA_INDEX,
+ PTN_NUM
};
-
+#endif /*CONFIG_EFI_PARTITION*/
static unsigned int download_bytes_unpadded;
static struct cmd_fastboot_interface interface = {
@@ -1145,19 +1178,23 @@ static int _fastboot_parts_add_ptable_entry(int ptable_index,
struct fastboot_ptentry *ptable)
{
disk_partition_t info;
- strcpy(ptable[ptable_index].name, name);
if (part_get_info(dev_desc,
mmc_dos_partition_index, &info)) {
printf("Bad partition index:%d for partition:%s\n",
mmc_dos_partition_index, name);
return -1;
- } else {
- ptable[ptable_index].start = info.start;
- ptable[ptable_index].length = info.size;
- ptable[ptable_index].partition_id = mmc_partition_index;
- ptable[ptable_index].partition_index = mmc_dos_partition_index;
}
+ ptable[ptable_index].start = info.start;
+ ptable[ptable_index].length = info.size;
+ ptable[ptable_index].partition_id = mmc_partition_index;
+ ptable[ptable_index].partition_index = mmc_dos_partition_index;
+#ifdef CONFIG_EFI_PARTITION
+ strcpy(ptable[ptable_index].name, (const char *)info.name);
+#else
+ strcpy(ptable[ptable_index].name, name);
+#endif
+
return 0;
}
@@ -1175,7 +1212,7 @@ static int _fastboot_parts_load_from_ptable(void)
struct mmc *mmc;
struct blk_desc *dev_desc;
- struct fastboot_ptentry ptable[PTN_DATA_INDEX + 1];
+ struct fastboot_ptentry ptable[PTN_NUM + 1];
/* sata case in env */
if (fastboot_devinfo.type == DEV_SATA) {
@@ -1222,12 +1259,20 @@ static int _fastboot_parts_load_from_ptable(void)
}
memset((char *)ptable, 0,
- sizeof(struct fastboot_ptentry) * (PTN_DATA_INDEX + 1));
+ sizeof(struct fastboot_ptentry) * (PTN_NUM + 1));
+#ifdef CONFIG_EFI_PARTITION
+ /* GPT */
+ strcpy(ptable[PTN_GPT_INDEX].name, "gpt");
+ ptable[PTN_GPT_INDEX].start = ANDROID_GPT_OFFSET / dev_desc->blksz;
+ ptable[PTN_GPT_INDEX].length = ANDROID_GPT_SIZE / dev_desc->blksz;
+ ptable[PTN_GPT_INDEX].partition_id = user_partition;
+#else
/* MBR */
strcpy(ptable[PTN_MBR_INDEX].name, "mbr");
ptable[PTN_MBR_INDEX].start = ANDROID_MBR_OFFSET / dev_desc->blksz;
ptable[PTN_MBR_INDEX].length = ANDROID_MBR_SIZE / dev_desc->blksz;
ptable[PTN_MBR_INDEX].partition_id = user_partition;
+#endif
/* Bootloader */
strcpy(ptable[PTN_BOOTLOADER_INDEX].name, FASTBOOT_PARTITION_BOOTLOADER);
ptable[PTN_BOOTLOADER_INDEX].start =
@@ -1236,6 +1281,7 @@ static int _fastboot_parts_load_from_ptable(void)
ANDROID_BOOTLOADER_SIZE / dev_desc->blksz;
ptable[PTN_BOOTLOADER_INDEX].partition_id = boot_partition;
+#ifndef CONFIG_EFI_PARTITION
_fastboot_parts_add_ptable_entry(PTN_KERNEL_INDEX,
ANDROID_BOOT_PARTITION_MMC,
user_partition,
@@ -1252,8 +1298,21 @@ static int _fastboot_parts_load_from_ptable(void)
ANDROID_DATA_PARTITION_MMC,
user_partition,
FASTBOOT_PARTITION_DATA, dev_desc, ptable);
-
- for (i = 0; i <= PTN_DATA_INDEX; i++)
+#else
+ int tbl_idx;
+ int part_idx = 1;
+ int ret;
+ for (tbl_idx = 2; tbl_idx < PTN_NUM; tbl_idx++) {
+ ret = _fastboot_parts_add_ptable_entry(tbl_idx,
+ part_idx++,
+ user_partition,
+ NULL,
+ dev_desc, ptable);
+ if (ret)
+ break;
+ }
+#endif /*CONFIG_EFI_PARTITION*/
+ for (i = 0; i <= PTN_NUM; i++)
fastboot_flash_add_ptn(&ptable[i]);
return 0;
diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h
index b154b63..f78bfee 100644
--- a/include/configs/mx6sabresd.h
+++ b/include/configs/mx6sabresd.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
*
* Configuration settings for the Freescale i.MX6Q SabreSD board.
*
@@ -44,7 +45,9 @@
#define CONFIG_SYS_FSL_USDHC_NUM 3
#define CONFIG_SYS_MMC_ENV_DEV 1 /* SDHC3 */
+#ifndef CONFIG_SYS_MMC_ENV_PART
#define CONFIG_SYS_MMC_ENV_PART 0 /* user partition */
+#endif
#ifdef CONFIG_CMD_SF
#define CONFIG_SF_DEFAULT_CS 0