Snap for 4974909 from cc7104b6506434c336254135fad095161f700c7e to oc-mr1-1.2-iot-release

Change-Id: I10073f17d5247f893d1cd7ad90819c1c6bd9d5a7
diff --git a/board/freescale/imx8mq_phanbell/imx8m_phanbell.c b/board/freescale/imx8mq_phanbell/imx8m_phanbell.c
index e274c36..230fcf0 100644
--- a/board/freescale/imx8mq_phanbell/imx8m_phanbell.c
+++ b/board/freescale/imx8mq_phanbell/imx8m_phanbell.c
@@ -349,6 +349,16 @@
 #ifdef CONFIG_ENV_IS_IN_MMC
 	board_late_mmc_env_init();
 #endif
+	int baseboard_id;
+	baseboard_id = get_imx8m_baseboard_id();
+	if ((baseboard_id == ENTERPRISE_MICRON_1G) ||
+			(baseboard_id == ENTERPRISE_HYNIX_1G)) {
+		/* 1G DDR size */
+		setenv("bootargs_ram_capacity", "cma=296M galcore.contiguousSize=8388608");
+	} else {
+		/* 3G DDR size */
+		setenv("bootargs_ram_capacity", "cma=384M");
+	}
 
 	return 0;
 }
diff --git a/common/image-android.c b/common/image-android.c
index 5045cfe..9a2ad47 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -83,6 +83,14 @@
 		strcat(commandline, hdr->cmdline);
 	}
 
+	/* Add 'bootargs_ram_capacity' to hold the parameters based on different ram capacity */
+	char *bootargs_ram_capacity = getenv("bootargs_ram_capacity");
+	if (bootargs_ram_capacity) {
+		strncat(commandline, " ", sizeof(commandline) - strlen(commandline));
+		strncat(commandline, bootargs_ram_capacity,
+			sizeof(commandline) - strlen(commandline));
+	}
+
 #ifdef CONFIG_SERIAL_TAG
 	struct tag_serialnr serialnr;
 	get_board_serial(&serialnr);