app: aboot: add support for booting systemd in ffbm mode on LE

When systemd is used as init manager on LE platform,
following command line parameter needs to added
when the target needs is booted in ffbm mode.
      "systemd.target=ffbm.target".

Change-Id: I45c1e9d7f7000010981d49ae13fca64615287b92
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index fea7b1f..784b0de 100755
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -107,6 +107,8 @@
 static int aboot_frp_unlock(char *pname, void *data, unsigned sz);
 bool pwr_key_is_pressed = false;
 
+static bool is_systemd_present=false;
+
 /* fastboot command function pointer */
 typedef void (*fastboot_cmd_fn) (const char *, void *, unsigned);
 
@@ -159,6 +161,8 @@
 #endif
 static const char *usb_sn_cmdline = " androidboot.serialno=";
 static const char *androidboot_mode = " androidboot.mode=";
+
+static const char *systemd_ffbm_mode = " systemd.unit=ffbm.target";
 static const char *alarmboot_cmdline = " androidboot.alarmboot=true";
 static const char *loglevel         = " quiet";
 static const char *battchg_pause = " androidboot.mode=charger";
@@ -338,6 +342,11 @@
 	int have_target_boot_params = 0;
 	char *boot_dev_buf = NULL;
     bool is_mdtp_activated = 0;
+
+#if USE_LE_SYSTEMD
+	is_systemd_present=true;
+#endif
+
 #if VERIFIED_BOOT
 #if !VBOOT_MOTA
     uint32_t boot_state = boot_verify_get_state();
@@ -386,6 +395,10 @@
 
 	if (boot_into_ffbm) {
 		cmdline_len += strlen(androidboot_mode);
+
+		if(is_systemd_present)
+			cmdline_len += strlen(systemd_ffbm_mode);
+
 		cmdline_len += strlen(ffbm_mode_string);
 		/* reduce kernel console messages to speed-up boot */
 		cmdline_len += strlen(loglevel);
@@ -564,6 +577,13 @@
 			src = ffbm_mode_string;
 			if (have_cmdline) --dst;
 			while ((*dst++ = *src++));
+
+			if(is_systemd_present) {
+				src = systemd_ffbm_mode;
+				if (have_cmdline) --dst;
+				while ((*dst++ = *src++));
+			}
+
 			src = loglevel;
 			if (have_cmdline) --dst;
 			while ((*dst++ = *src++));