Commit 45d3f14c63b593858145a14f55288efb319fe6c9
1 parent
896d7aac49
Exists in
smarc_8mm-imx_v2019.04_4.19.35_1.1.0
and in
1 other branch
MA-15339-1 load ramdisk in boot image to do first stage mount
With Android10 code, to build GSI image for devices launching with Android10, the target should be "aosp_$arch-user". Google releases GSI images is so built in user mode. To do CTS-on-GSI test, a debug ramdisk containing .prop file to enable adb root permission and GSI keys to verify the GSI image is needed, this ramdisk is in boot image. so ramdisk in boot image need to be loaded by uboot even in non-recovery mode. To save boot time, only standard Android use ramdisk to boot up Android, Android Auto keeps the original way: kernel be responsible for verify and mount system partition. Let the customers to decide whether to use recovery ramdisk to boot the system. and under this condition, user-debug Android Auto GSI image need to be used for VTS-on-GSI test. when use ramdisk to bootup Android, info provided by "dm=" bootarg is not used by kernel to setup dm-verity, so it is removed from the bootargs. The 4.19 kernel used together with this uboot does not handle "skip_initramfs", so it's also removed. Change-Id: Ia8b8fa8b85a44acda2670b46504038a009ce01a8 Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
Showing 1 changed file with 27 additions and 15 deletions Side-by-side Diff
drivers/fastboot/fb_fsl/fb_fsl_boot.c
... | ... | @@ -241,16 +241,21 @@ |
241 | 241 | |
242 | 242 | struct fastboot_ptentry *ptentry = fastboot_flash_find_ptn(system_part_name); |
243 | 243 | if(ptentry != NULL) { |
244 | - char bootargs_3rd[ANDR_BOOT_ARGS_SIZE]; | |
244 | + char bootargs_3rd[ANDR_BOOT_ARGS_SIZE] = {'\0'}; | |
245 | 245 | if (append_root) { |
246 | 246 | u32 dev_no = mmc_map_to_kernel_blk(mmc_get_env_dev()); |
247 | - sprintf(bootargs_3rd, "skip_initramfs root=/dev/mmcblk%dp%d", | |
247 | + sprintf(bootargs_3rd, "root=/dev/mmcblk%dp%d ", | |
248 | 248 | dev_no, |
249 | 249 | ptentry->partition_index); |
250 | - } else { | |
251 | - sprintf(bootargs_3rd, "skip_initramfs"); | |
252 | 250 | } |
253 | - strcat(bootargs_3rd, " rootwait"); | |
251 | + strcat(bootargs_3rd, "rootwait"); | |
252 | + | |
253 | + /* for standard android, recovery ramdisk will be used anyway, to | |
254 | + * boot up Android, "androidboot.force_normal_boot=1" is needed */ | |
255 | +#ifndef CONFIG_ANDROID_AUTO_SUPPORT | |
256 | + strcat(bootargs_3rd, " androidboot.force_normal_boot=1"); | |
257 | +#endif | |
258 | + | |
254 | 259 | env_set("bootargs_3rd", bootargs_3rd); |
255 | 260 | } else { |
256 | 261 | printf("Can't find partition: %s\n", system_part_name); |
257 | 262 | |
258 | 263 | |
... | ... | @@ -662,13 +667,18 @@ |
662 | 667 | char bootargs_sec[ANDR_BOOT_EXTRA_ARGS_SIZE]; |
663 | 668 | if (lock_status == FASTBOOT_LOCK) { |
664 | 669 | snprintf(bootargs_sec, sizeof(bootargs_sec), |
665 | - "androidboot.verifiedbootstate=green androidboot.flash.locked=1 androidboot.slot_suffix=%s %s", | |
666 | - avb_out_data->ab_suffix, avb_out_data->cmdline); | |
670 | + "androidboot.verifiedbootstate=green androidboot.flash.locked=1 androidboot.slot_suffix=%s ", | |
671 | + avb_out_data->ab_suffix); | |
667 | 672 | } else { |
668 | 673 | snprintf(bootargs_sec, sizeof(bootargs_sec), |
669 | - "androidboot.verifiedbootstate=orange androidboot.flash.locked=0 androidboot.slot_suffix=%s %s", | |
670 | - avb_out_data->ab_suffix, avb_out_data->cmdline); | |
674 | + "androidboot.verifiedbootstate=orange androidboot.flash.locked=0 androidboot.slot_suffix=%s ", | |
675 | + avb_out_data->ab_suffix); | |
671 | 676 | } |
677 | +#ifdef CONFIG_ANDROID_AUTO_SUPPORT | |
678 | + strcat(bootargs_sec, avb_out_data->cmdline); | |
679 | +#else | |
680 | + strcat(bootargs_sec, strstr(avb_out_data->cmdline, "androidboot")); | |
681 | +#endif | |
672 | 682 | env_set("bootargs_sec", bootargs_sec); |
673 | 683 | #ifdef CONFIG_SYSTEM_RAMDISK_SUPPORT |
674 | 684 | if(!is_recovery_mode) { |
675 | 685 | |
676 | 686 | |
... | ... | @@ -716,14 +726,15 @@ |
716 | 726 | |
717 | 727 | flush_cache((ulong)load_addr, image_size); |
718 | 728 | check_image_arm64 = image_arm64((void *)(ulong)hdr->kernel_addr); |
719 | -#ifdef CONFIG_SYSTEM_RAMDISK_SUPPORT | |
729 | +#if !defined(CONFIG_SYSTEM_RAMDISK_SUPPORT) || !defined(CONFIG_ANDROID_AUTO_SUPPORT) | |
730 | + memcpy((void *)(ulong)hdr->ramdisk_addr, (void *)(ulong)hdr + hdr->page_size | |
731 | + + ALIGN(hdr->kernel_size, hdr->page_size), hdr->ramdisk_size); | |
732 | +#else | |
720 | 733 | if (is_recovery_mode) |
721 | 734 | memcpy((void *)(ulong)hdr->ramdisk_addr, (void *)(ulong)hdr + hdr->page_size |
722 | 735 | + ALIGN(hdr->kernel_size, hdr->page_size), hdr->ramdisk_size); |
723 | -#else | |
724 | - memcpy((void *)(ulong)hdr->ramdisk_addr, (void *)(ulong)hdr + hdr->page_size | |
725 | - + ALIGN(hdr->kernel_size, hdr->page_size), hdr->ramdisk_size); | |
726 | 736 | #endif |
737 | + | |
727 | 738 | #ifdef CONFIG_OF_LIBFDT |
728 | 739 | /* load the dtb file */ |
729 | 740 | u32 fdt_size = 0; |
... | ... | @@ -819,8 +830,9 @@ |
819 | 830 | sprintf(ramdisk_addr, "0x%x:0x%x", hdr->ramdisk_addr, hdr->ramdisk_size); |
820 | 831 | sprintf(fdt_addr, "0x%x", hdr->second_addr); |
821 | 832 | |
822 | -/* no need to pass ramdisk addr for normal boot mode when enable CONFIG_SYSTEM_RAMDISK_SUPPORT*/ | |
823 | -#ifdef CONFIG_SYSTEM_RAMDISK_SUPPORT | |
833 | +/* when CONFIG_SYSTEM_RAMDISK_SUPPORT is enabled and it's for Android Auto, if it's not recovery mode | |
834 | + * do not pass ramdisk addr*/ | |
835 | +#if defined(CONFIG_SYSTEM_RAMDISK_SUPPORT) && defined(CONFIG_ANDROID_AUTO_SUPPORT) | |
824 | 836 | if (!is_recovery_mode) |
825 | 837 | boot_args[2] = NULL; |
826 | 838 | #endif |