diff options
author | ji.luo <ji.luo@nxp.com> | 2017-10-12 19:48:09 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-10-12 19:48:09 +0000 |
commit | a313a3d07b5d899626ff5e547832581378b105af (patch) | |
tree | 224974be0a1086fee89a2c2545582c582343e882 | |
parent | d4a6d3d843fdac523d939749c3cd55c6b508a445 (diff) | |
parent | f4a0dd5da376f3cf524d8a7715f913fbb79fdbf3 (diff) | |
download | uboot-imx-a313a3d07b5d899626ff5e547832581378b105af.tar.gz |
Pass bootloader metrics to kernel by kernel cmdline
am: f4a0dd5da3
Change-Id: Id0039f41e4c783226fb0c4c8c63667250466b0d9
-rw-r--r-- | common/image-android.c | 11 | ||||
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 16 | ||||
-rw-r--r-- | include/android_image.h | 13 |
3 files changed, 39 insertions, 1 deletions
diff --git a/common/image-android.c b/common/image-android.c index 0f6de83a03..59bfe582f5 100644 --- a/common/image-android.c +++ b/common/image-android.c @@ -62,6 +62,7 @@ static ulong android_image_get_kernel_addr(const struct andr_img_hdr *hdr) int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, ulong *os_data, ulong *os_len) { + extern boot_metric metrics; u32 kernel_addr = android_image_get_kernel_addr(hdr); /* @@ -78,7 +79,7 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, kernel_addr, DIV_ROUND_UP(hdr->kernel_size, 1024)); char newbootargs[512] = {0}; - char commandline[1024] = {0}; + char commandline[2048] = {0}; char *bootargs = getenv("bootargs"); if (bootargs) { @@ -113,6 +114,14 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, printf("boot device type is incorrect.\n"); strcat(commandline, newbootargs); + /* boot metric variables */ + metrics.ble_1 = get_timer(0); + sprintf(newbootargs, + " androidboot.boottime=1BLL:%d,1BLE:%d,KL:%d,KD:%d,AVB:%d,ODT:%d,SW:%d", + metrics.bll_1, metrics.ble_1, metrics.kl, metrics.kd, metrics.avb, + metrics.odt, metrics.sw); + strcat(commandline, newbootargs); + #ifdef CONFIG_FSL_BOOTCTL sprintf(newbootargs, " androidboot.slot_suffix=%s", get_slot_suffix()); strcat(commandline, newbootargs); diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index acb9c5917b..10ee1aed6e 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -108,6 +108,17 @@ char *fastboot_common_var[FASTBOOT_COMMON_VAR_NUM] = { "battery-soc-ok" }; +/* Boot metric variables */ +boot_metric metrics = { + .bll_1 = 0, + .ble_1 = 0, + .kl = 0, + .kd = 0, + .avb = 0, + .odt = 0, + .sw = 0 +}; + struct f_fastboot { struct usb_function usb_function; @@ -2067,6 +2078,7 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { struct andr_img_hdr *hdr = NULL; struct andr_img_hdr *hdrload; ulong image_size; + u32 avb_metric; AvbABFlowResult avb_result; AvbSlotVerifyData *avb_out_data; @@ -2081,8 +2093,12 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { lock_status = FASTBOOT_LOCK; } bool allow_fail = (lock_status == FASTBOOT_UNLOCK ? true : false); + avb_metric = get_timer(0); /* if in lock state, do avb verify */ avb_result = avb_ab_flow(&fsl_avb_ab_ops, requested_partitions, allow_fail, &avb_out_data); + /* get the duration of avb */ + metrics.avb = get_timer(avb_metric); + if (avb_result == AVB_AB_FLOW_RESULT_OK) { assert(avb_out_data != NULL); /* load the first partition */ diff --git a/include/android_image.h b/include/android_image.h index 1c70bf8e22..6fde9b7aae 100644 --- a/include/android_image.h +++ b/include/android_image.h @@ -17,6 +17,19 @@ #define ANDR_BOOT_NAME_SIZE 16 #define ANDR_BOOT_ARGS_SIZE 512 +/* Boot metric variables (in millisecond) */ +struct boot_metric +{ + u32 bll_1; /* 1th bootloader load duration */ + u32 ble_1; /* 1th bootloader exec duration */ + u32 kl; /* kernel image load duration */ + u32 kd; /* kernel image decompress duration */ + u32 avb; /* avb verify boot.img duration */ + u32 odt; /* overlay device tree duration */ + u32 sw; /* system wait for UI interaction duration*/ +}; +typedef struct boot_metric boot_metric; + struct andr_img_hdr { char magic[ANDR_BOOT_MAGIC_SIZE]; |