app: aboot: Added MDTP indication to the kernel cmd_line
If MDTP is activated the string 'mdtp' will be added to the cmd_line.
Change-Id: I56b10735f0c56a4aaa15fcebf9a5299d2334a2d8
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 78164e5..cd7a91c 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -135,6 +135,7 @@
static const char *battchg_pause = " androidboot.mode=charger";
static const char *auth_kernel = " androidboot.authorized_kernel=true";
static const char *secondary_gpt_enable = " gpt";
+static const char *mdtp_activated_flag = " mdtp";
static const char *baseband_apq = " androidboot.baseband=apq";
static const char *baseband_msm = " androidboot.baseband=msm";
@@ -239,6 +240,10 @@
bool gpt_exists = partition_gpt_exists();
int have_target_boot_params = 0;
char *boot_dev_buf = NULL;
+ bool is_mdtp_activated = 0;
+#ifdef MDTP_SUPPORT
+ mdtp_activated(&is_mdtp_activated);
+#endif /* MDTP_SUPPORT */
if (cmdline && cmdline[0]) {
cmdline_len = strlen(cmdline);
@@ -260,6 +265,9 @@
if (boot_into_recovery && gpt_exists)
cmdline_len += strlen(secondary_gpt_enable);
+ if(is_mdtp_activated)
+ cmdline_len += strlen(mdtp_activated_flag);
+
if (boot_into_ffbm) {
cmdline_len += strlen(androidboot_mode);
cmdline_len += strlen(ffbm_mode_string);
@@ -388,6 +396,12 @@
while ((*dst++ = *src++));
}
+ if (is_mdtp_activated) {
+ src = mdtp_activated_flag;
+ if (have_cmdline) --dst;
+ while ((*dst++ = *src++));
+ }
+
if (boot_into_ffbm) {
src = androidboot_mode;
if (have_cmdline) --dst;
diff --git a/app/aboot/mdtp.c b/app/aboot/mdtp.c
index 60b97b0..35b2558 100644
--- a/app/aboot/mdtp.c
+++ b/app/aboot/mdtp.c
@@ -47,6 +47,7 @@
static int mdtp_tzbsp_dec_verify_DIP(DIP_t *enc_dip, DIP_t *dec_dip, uint32_t *verified);
static int mdtp_tzbsp_enc_hash_DIP(DIP_t *dec_dip, DIP_t *enc_dip);
+static int is_mdtp_activated = -1;
/********************************************************************************/
/* Read the DIP from EMMC */
@@ -364,6 +365,7 @@
show_invalid_msg();
return -1;
}
+ is_mdtp_activated = 1;
}
@@ -459,6 +461,9 @@
int ret;
bool enabled;
+ /* sets the default value of this global to be MDTP not activated */
+ is_mdtp_activated = 0;
+
ret = mdtp_fuse_get_enabled(&enabled);
if(ret)
{
@@ -474,6 +479,18 @@
return 0;
}
+/********************************************************************************/
+
+/** Indicates whether the MDTP is currently in ACTIVATED state **/
+int mdtp_activated(bool * activated){
+ if(is_mdtp_activated < 0){
+ /* mdtp_fwlock_verify_lock was not called before, the value is not valid */
+ return is_mdtp_activated;
+ }
+
+ *activated = is_mdtp_activated;
+ return 0;
+}
/********************************************************************************/
diff --git a/app/aboot/mdtp.h b/app/aboot/mdtp.h
index 9975899..129f75a 100644
--- a/app/aboot/mdtp.h
+++ b/app/aboot/mdtp.h
@@ -119,4 +119,16 @@
/* Display the "Verifying Firmware" screen */
void show_checking_msg();
+/**
+ * mdtp_activated
+ *
+ * Indicates whether the MDTP is currently in ACTIVATED state.
+ * You must call this function only after calling to mdtp_fwlock_verify_lock();
+ *
+ * @param[out] activated: MDTP is in ACTIVATED state (TRUE/FALSE).
+ *
+ * @return - negative value for an error, 0 for success.
+ */
+int mdtp_activated(bool * activated);
+
#endif