aboot: Enable kernel parsing of Secondary GPT in recovery

If booting in recovery pass 'gpt' in kernel command line which
enables kernel to parse secondary GPT table in case of corrupted
primary one.
This is needed if updating boot loaders in recovery fails and we are
forced to boot from backup copies of boot partitions pointed to by
secondary GPT.

Change-Id: I0d0b1e015c205c0f91292c98f148488db13b8df3
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index a006ab1..d732a4e 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -102,6 +102,7 @@
 static const char *loglevel         = " quiet";
 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 *baseband_apq     = " androidboot.baseband=apq";
 static const char *baseband_msm     = " androidboot.baseband=msm";
@@ -200,6 +201,7 @@
 	int have_cmdline = 0;
 	unsigned char *cmdline_final = NULL;
 	int pause_at_bootup = 0;
+	bool gpt_exists = partition_gpt_exists();
 
 	if (cmdline && cmdline[0]) {
 		cmdline_len = strlen(cmdline);
@@ -212,6 +214,9 @@
 	cmdline_len += strlen(usb_sn_cmdline);
 	cmdline_len += strlen(sn_buf);
 
+	if (boot_into_recovery && gpt_exists)
+		cmdline_len += strlen(secondary_gpt_enable);
+
 	if (boot_into_ffbm) {
 		cmdline_len += strlen(androidboot_mode);
 		cmdline_len += strlen(ffbm_mode_string);
@@ -293,6 +298,12 @@
 		have_cmdline = 1;
 		while ((*dst++ = *src++));
 
+		if (boot_into_recovery && gpt_exists) {
+			src = secondary_gpt_enable;
+			if (have_cmdline) --dst;
+			while ((*dst++ = *src++));
+		}
+
 		if (boot_into_ffbm) {
 			src = androidboot_mode;
 			if (have_cmdline) --dst;