diff options
author | Winter Wang <wente.wang@nxp.com> | 2016-10-28 20:24:34 +0800 |
---|---|---|
committer | Winter Wang <wente.wang@nxp.com> | 2016-11-15 13:42:12 +0800 |
commit | 14390662f8758c9f76129ed0f4f9f15e83c875f9 (patch) | |
tree | 0b6338afa2e203628454a3bd384292d34241395e | |
parent | f49a79614bfda6bfa8266ba93a96428a730ef43c (diff) | |
download | u-boot-imx-14390662f8758c9f76129ed0f4f9f15e83c875f9.zip u-boot-imx-14390662f8758c9f76129ed0f4f9f15e83c875f9.tar.gz u-boot-imx-14390662f8758c9f76129ed0f4f9f15e83c875f9.tar.bz2 |
MA-8986-6 image: android: add secondary cmdline generated by avb
avb's verify process adds cmdline from the vbmeta generated
by avbtoo's option '-kernel_cmdlines'.
this additional kernel cmdline is consist of below items:
dm="1 vroot none ro 1,0 ..."
androidboot.slot_suffix=_a
androidboot.vbmeta.device_state=locked
androidboot.vbmeta.hash_alg=sha256
androidboot.vbmeta.size=2944
androidboot.vbmeta.digest=...
these items are used either by dm-verity or by system service
after boot.
Signed-off-by: Winter Wang <wente.wang@nxp.com>
-rw-r--r-- | common/image-android.c | 24 | ||||
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 2 |
2 files changed, 19 insertions, 7 deletions
diff --git a/common/image-android.c b/common/image-android.c index 1688359..abd088f 100644 --- a/common/image-android.c +++ b/common/image-android.c @@ -74,22 +74,32 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, } printf("Kernel command line: %s\n", newbootargs); + char commandline[1024]; + strcpy(commandline, newbootargs); + char suffixcmd[64]; #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, + sprintf(suffixcmd, + " androidboot.serialno=%08x%08x", serialnr.high, serialnr.low); + strcat(commandline, suffixcmd); #endif #ifdef CONFIG_FSL_BOOTCTL - char suffixStr[64]; - sprintf(suffixStr, " androidboot.slot_suffix=%s", get_slot_suffix()); - strcat(commandline, suffixStr); + sprintf(suffixcmd, " androidboot.slot_suffix=%s", get_slot_suffix()); + strcat(commandline, suffixcmd); +#endif + +#ifdef CONFIG_AVB_SUPPORT + /* secondary cmdline added by avb */ + char *bootargs_sec = getenv("bootargs_sec"); + if (bootargs_sec) { + strcat(commandline, " "); + strcat(commandline, bootargs_sec); + } #endif setenv("bootargs", commandline); if (os_data) { diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index ff12bf1..d9a13a6 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -1830,6 +1830,7 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { goto fail; } printf(" verify OK, boot '%s%s'\n", avb_loadpart->partition_name, avb_out_data->ab_suffix); + setenv("bootargs_sec", avb_out_data->cmdline); image_size = avb_loadpart->data_size; memcpy((void *)load_addr, (void *)hdr, image_size); } else if (lock_status == FASTBOOT_LOCK) { /* && verify fail */ @@ -1865,6 +1866,7 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { printf("boota: read boot image error\n"); goto fail; } + setenv("bootargs_sec", "androidboot.slot_suffix=_a"); #ifdef CONFIG_FASTBOOT_LOCK } #endif |