From: Ji Luo Date: Wed, 21 Oct 2020 02:52:21 +0000 (+0800) Subject: MA-18087-2 Support snapshot-update-status variable X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~73^2~34 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=835ceea1b5c730ffd7b51d1280234d9b0269198e;p=u-boot.git MA-18087-2 Support snapshot-update-status variable Add support for 'fastboot getvar snapshot-update-status', it returns the snapshot update states. Test: run 'fastboot getvar snapshot-update-status' Signed-off-by: Ji Luo Change-Id: Ifd46410994b11c327373a35eb86d121f321e39ae (cherry picked from commit 28c6cbec7fe9e613620e5d80b7b43d1ca6bdd9c6) (cherry picked from commit dece52d012e8c6e06f96f1ad34b47f5da6514d2e) --- diff --git a/drivers/fastboot/fb_fsl/fb_fsl_getvar.c b/drivers/fastboot/fb_fsl/fb_fsl_getvar.c index f4808f5fe7..457b5ae123 100644 --- a/drivers/fastboot/fb_fsl/fb_fsl_getvar.c +++ b/drivers/fastboot/fb_fsl/fb_fsl_getvar.c @@ -47,6 +47,10 @@ #define ATAP_UUID_STR_SIZE ((ATAP_UUID_SIZE*2) + 1) #endif +#ifdef CONFIG_VIRTUAL_AB_SUPPORT +#include "fb_fsl_virtual_ab.h" +#endif + #if defined(CONFIG_ANDROID_THINGS_SUPPORT) && defined(CONFIG_ARCH_IMX8M) #define FASTBOOT_COMMON_VAR_NUM 15 #else @@ -433,6 +437,16 @@ static int get_single_var(char *cmd, char *response) } } +#endif +#ifdef CONFIG_VIRTUAL_AB_SUPPORT + else if (!strcmp_l1("snapshot-update-status", cmd)) { + if (virtual_ab_update_is_merging()) + strncat(response, "merging", chars_left); + else if (virtual_ab_update_is_snapshoted()) + strncat(response, "snapshotted", chars_left); + else + strncat(response, "none", chars_left); + } #endif else { char envstr[32]; @@ -540,6 +554,12 @@ void fastboot_getvar(char *cmd, char *response) } } +#ifdef CONFIG_VIRTUAL_AB_SUPPORT + strncpy(response, "INFOsnapshot-update-status:", FASTBOOT_RESPONSE_LEN); + get_single_var("snapshot-update-status", response); + fastboot_tx_write_more(response); +#endif + strncpy(response, "OKAYDone!", 10); fastboot_tx_write_more(response); fastboot_none_resp(response); diff --git a/drivers/fastboot/fb_fsl/fb_fsl_virtual_ab.h b/drivers/fastboot/fb_fsl/fb_fsl_virtual_ab.h index 3b33cd7ef2..13769fdfb0 100644 --- a/drivers/fastboot/fb_fsl/fb_fsl_virtual_ab.h +++ b/drivers/fastboot/fb_fsl/fb_fsl_virtual_ab.h @@ -3,6 +3,9 @@ * Copyright 2020 NXP */ +#ifndef __FB_FSL_VIRTUAL_AB_H__ +#define __FB_FSL_VIRTUAL_AB_H__ + typedef enum { VIRTUAL_AB_NONE = 0, VIRTUAL_AB_UNKNOWN, @@ -16,3 +19,5 @@ bool virtual_ab_update_is_merging(void); bool virtual_ab_update_is_snapshoted(void); bool virtual_ab_slot_match(void); int virtual_ab_cancel_update(void); + +#endif