summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfaqiang.zhu <faqiang.zhu@nxp.com>2020-10-21 16:14:38 +0800
committerfaqiang.zhu <faqiang.zhu@nxp.com>2020-10-23 11:05:45 +0800
commit972ccff86796e2b7f9a444d09550cd5e393cd93e (patch)
tree93f67e402a2b0fa5c856c0160aad53f010c707f4
parentf0f496abb5d7bef031603d1c3ab5387facead209 (diff)
MA-17519-4 boot up car2 with recovery ramdisk
To use dynamic partition feature in Android, recovery ramdisk is used to mount the logical partitions and boot up Android. Define a configuration item "CONFIG_ANDROID_DYNAMIC_PARTITION", use it to control the bootargs and whether ramdisk should be loaded instead of "CONFIG_ANDROID_AUTO" because now Android auto also use dynamic partition feature now. Move the definition of function "fastboot_setup_system_boot_args" under the macro "CONFIG_CMD_BOOTA" to avoid build warnings. Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com> Change-Id: I0b1cfe6120fc939e7f1a1eb600d8176c81edf129
-rw-r--r--configs/imx8qm_mek_androidauto2_trusty_defconfig1
-rw-r--r--configs/imx8qm_mek_androidauto2_trusty_md_defconfig1
-rw-r--r--configs/imx8qm_mek_androidauto_xen_defconfig1
-rw-r--r--configs/imx8qxp_mek_androidauto2_trusty_defconfig1
-rw-r--r--drivers/fastboot/fb_fsl/fb_fsl_boot.c26
-rw-r--r--lib/Kconfig4
-rw-r--r--lib/libavb/avb_cmdline.c6
7 files changed, 22 insertions, 18 deletions
diff --git a/configs/imx8qm_mek_androidauto2_trusty_defconfig b/configs/imx8qm_mek_androidauto2_trusty_defconfig
index 26d4faf2d5..c1d5892984 100644
--- a/configs/imx8qm_mek_androidauto2_trusty_defconfig
+++ b/configs/imx8qm_mek_androidauto2_trusty_defconfig
@@ -175,3 +175,4 @@ CONFIG_TRUSTY_UNLOCK_PERMISSION=y
CONFIG_SPL_MMC_WRITE=y
CONFIG_SPL_LIBDISK_SUPPORT=y
CONFIG_PSCI_BOARD_REBOOT=y
+CONFIG_VIRTUAL_AB_SUPPORT=y
diff --git a/configs/imx8qm_mek_androidauto2_trusty_md_defconfig b/configs/imx8qm_mek_androidauto2_trusty_md_defconfig
index fbccc4bdec..b84e9437d1 100644
--- a/configs/imx8qm_mek_androidauto2_trusty_md_defconfig
+++ b/configs/imx8qm_mek_androidauto2_trusty_md_defconfig
@@ -178,3 +178,4 @@ CONFIG_SPL_MMC_WRITE=y
CONFIG_SPL_LIBDISK_SUPPORT=y
CONFIG_IMX_LOAD_HDMI_FIMRWARE_TX=y
CONFIG_PSCI_BOARD_REBOOT=y
+CONFIG_VIRTUAL_AB_SUPPORT=y
diff --git a/configs/imx8qm_mek_androidauto_xen_defconfig b/configs/imx8qm_mek_androidauto_xen_defconfig
index 4eabba1b2e..547d118878 100644
--- a/configs/imx8qm_mek_androidauto_xen_defconfig
+++ b/configs/imx8qm_mek_androidauto_xen_defconfig
@@ -201,3 +201,4 @@ CONFIG_XEN=y
CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK=y
CONFIG_XEN_DEBUG_SERIAL=y
CONFIG_LOAD_KEY_FROM_RPMB=y
+CONFIG_VIRTUAL_AB_SUPPORT=y
diff --git a/configs/imx8qxp_mek_androidauto2_trusty_defconfig b/configs/imx8qxp_mek_androidauto2_trusty_defconfig
index 8e150783b6..8049de2d5d 100644
--- a/configs/imx8qxp_mek_androidauto2_trusty_defconfig
+++ b/configs/imx8qxp_mek_androidauto2_trusty_defconfig
@@ -185,3 +185,4 @@ CONFIG_TRUSTY_UNLOCK_PERMISSION=y
CONFIG_SPL_MMC_WRITE=y
CONFIG_SPL_LIBDISK_SUPPORT=y
CONFIG_PSCI_BOARD_REBOOT=y
+CONFIG_VIRTUAL_AB_SUPPORT=y
diff --git a/drivers/fastboot/fb_fsl/fb_fsl_boot.c b/drivers/fastboot/fb_fsl/fb_fsl_boot.c
index d0ace54038..c1a941ab61 100644
--- a/drivers/fastboot/fb_fsl/fb_fsl_boot.c
+++ b/drivers/fastboot/fb_fsl/fb_fsl_boot.c
@@ -218,7 +218,11 @@ U_BOOT_CMD(
);
#endif
-#if defined CONFIG_SYSTEM_RAMDISK_SUPPORT && defined CONFIG_ANDROID_AUTO_SUPPORT
+#ifdef CONFIG_CMD_BOOTA
+
+/* Section for Android bootimage format support */
+
+#ifndef CONFIG_ANDROID_DYNAMIC_PARTITION
/* Setup booargs for taking the system parition as ramdisk */
static void fastboot_setup_system_boot_args(const char *slot, bool append_root)
{
@@ -258,14 +262,6 @@ static void fastboot_setup_system_boot_args(const char *slot, bool append_root)
}
#endif
-#ifdef CONFIG_CMD_BOOTA
-
-/* Section for Android bootimage format support
-* Refer:
-* http://android.git.kernel.org/?p=platform/system/core.git;a=blob;
-* f=mkbootimg/bootimg.h
-*/
-
void
bootimg_print_image_hdr(struct andr_img_hdr *hdr)
{
@@ -699,15 +695,15 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
}
if (avb_out_data->cmdline != NULL)
strcat(bootargs_sec, avb_out_data->cmdline);
-#if defined(CONFIG_ANDROID_AB_SUPPORT) && !defined(CONFIG_ANDROID_AUTO_SUPPORT)
- /* for standard android, recovery ramdisk will be used anyway, to
- * boot up Android, "androidboot.force_normal_boot=1" is needed */
+#ifdef CONFIG_ANDROID_DYNAMIC_PARTITION
+ /* for the condition dynamic partition is used , recovery ramdisk is used to boot
+ * up Android, in this condition, "androidboot.force_normal_boot=1" is needed */
if(!is_recovery_mode) {
strcat(bootargs_sec, " androidboot.force_normal_boot=1");
}
#endif
env_set("bootargs_sec", bootargs_sec);
-#ifdef CONFIG_ANDROID_AUTO_SUPPORT
+#ifndef CONFIG_ANDROID_DYNAMIC_PARTITION
if(!is_recovery_mode) {
if(avb_out_data->cmdline != NULL && strstr(avb_out_data->cmdline, "root="))
fastboot_setup_system_boot_args(avb_out_data->ab_suffix, false);
@@ -783,7 +779,7 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
memcpy((void *)(ulong)vendor_boot_hdr->ramdisk_addr + vendor_boot_hdr->vendor_ramdisk_size,
(void *)(ulong)hdr_v3 + 4096 + ALIGN(hdr_v3->kernel_size, 4096), hdr_v3->ramdisk_size);
} else {
-#if !defined(CONFIG_SYSTEM_RAMDISK_SUPPORT) || !defined(CONFIG_ANDROID_AUTO_SUPPORT)
+#if !defined(CONFIG_SYSTEM_RAMDISK_SUPPORT) || defined(CONFIG_ANDROID_DYNAMIC_PARTITION)
memcpy((void *)(ulong)hdr->ramdisk_addr, (void *)(ulong)hdr + hdr->page_size
+ ALIGN(hdr->kernel_size, hdr->page_size), hdr->ramdisk_size);
#else
@@ -889,7 +885,7 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
sprintf(fdt_addr_start, "0x%x", fdt_addr);
/* Don't pass ramdisk addr for Android Auto if we are not booting from recovery */
-#ifdef CONFIG_ANDROID_AUTO_SUPPORT
+#ifndef CONFIG_ANDROID_DYNAMIC_PARTITION
if (!is_recovery_mode)
boot_args[2] = NULL;
#endif
diff --git a/lib/Kconfig b/lib/Kconfig
index 6e2ef8285a..c500c45881 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -381,8 +381,12 @@ config TRUSTY_UNLOCK_PERMISSION
bool "Support unlock permission protection in trusty"
depends on IMX_TRUSTY_OS
+config ANDROID_DYNAMIC_PARTITION
+ bool "Support to boot up Android with system image in logical partitions"
+
config VIRTUAL_AB_SUPPORT
bool "Support virtual AB update"
+ select ANDROID_DYNAMIC_PARTITION
config LOAD_KEY_FROM_RPMB
bool "Support load AVB public key from RPMB storage"
diff --git a/lib/libavb/avb_cmdline.c b/lib/libavb/avb_cmdline.c
index bddcc2f627..3c2de6c32b 100644
--- a/lib/libavb/avb_cmdline.c
+++ b/lib/libavb/avb_cmdline.c
@@ -9,7 +9,7 @@
#include "avb_version.h"
#include <malloc.h>
-#ifdef CONFIG_ANDROID_AUTO_SUPPORT
+#ifndef CONFIG_ANDROID_DYNAMIC_PARTITION
#define NUM_GUIDS 3
#else
#define NUM_GUIDS 2
@@ -24,7 +24,7 @@ char* avb_sub_cmdline(AvbOps* ops,
const char* ab_suffix,
bool using_boot_for_vbmeta,
const AvbCmdlineSubstList* additional_substitutions) {
-#ifdef CONFIG_ANDROID_AUTO_SUPPORT
+#ifndef CONFIG_ANDROID_DYNAMIC_PARTITION
const char* part_name_str[NUM_GUIDS] = {"system", "boot", "vbmeta"};
const char* replace_str[NUM_GUIDS] = {"$(ANDROID_SYSTEM_PARTUUID)",
"$(ANDROID_BOOT_PARTUUID)",
@@ -42,7 +42,7 @@ char* avb_sub_cmdline(AvbOps* ops,
* partition.
*/
if (using_boot_for_vbmeta) {
-#ifdef CONFIG_ANDROID_AUTO_SUPPORT
+#ifndef CONFIG_ANDROID_DYNAMIC_PARTITION
part_name_str[2] = "boot";
#else
part_name_str[1] = "boot";