initramfs: Add init script for eMMC

This init script mounts the rootfs based on the root u-boot env
variable, mounts the read-write filesystem and sets up the overlay.

Change-Id: Id122f426822bddf12c04819e0b93ed2daa4ab7f6
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/recipes-phosphor/initrdscripts/phosphor-mmc-init.bb b/recipes-phosphor/initrdscripts/phosphor-mmc-init.bb
new file mode 100644
index 0000000..45ae452
--- /dev/null
+++ b/recipes-phosphor/initrdscripts/phosphor-mmc-init.bb
@@ -0,0 +1,26 @@
+SUMMARY = "Phosphor OpenBMC pre-init scripts for mmc"
+DESCRIPTION = "Phosphor OpenBMC filesystem mount implementation for mmc."
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+PR = "r1"
+
+inherit allarch
+
+RDEPENDS_${PN} += " \
+    ${VIRTUAL-RUNTIME_base-utils} \
+    gptfdisk \
+    parted \
+    udev \
+"
+
+S = "${WORKDIR}"
+SRC_URI += "file://mmc-init.sh"
+
+do_install() {
+    install -m 0755 ${WORKDIR}/mmc-init.sh ${D}/init
+    install -d ${D}/dev
+    mknod -m 622 ${D}/dev/console c 5 1
+}
+
+FILES_${PN} += " /init /dev "