new file mode 100644
@@ -0,0 +1,28 @@
+From 24611410d020c77547575ff9daaec601fdc25620 Mon Sep 17 00:00:00 2001
+From: Kas User <kas@example.com>
+Date: Tue, 19 Feb 2019 16:21:25 +0000
+Subject: [PATCH] Add target for initial environment
+
+Signed-off-by: Kas User <kas@example.com>
+---
+ Makefile | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index 65cc49fa1f..6888deeab0 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1718,6 +1718,10 @@ endif
+ $(build)=$(build-dir) $(@:.ko=.o)
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
+
++u-boot-initial-env: u-boot.bin
++ $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o
++ sed --in-place -e 's/\x00/\x0A/g' $@
++
+ # Consistency checks
+ # ---------------------------------------------------------------------------
+
+--
+2.17.1
+
new file mode 100644
@@ -0,0 +1,50 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+SRC_URI_append = " file://0001-Add-target-for-initial-environment.patch"
+
+UBOOT_MAKE_TARGET_append = " u-boot-initial-env"
+PACKAGES += "${PN}-initial-env"
+FILES_${PN}-initial-env = "${sysconfdir}/u-boot-initial-env"
+
+do_install_append () {
+ if [ -n "${UBOOT_CONFIG}" ]
+ then
+ for config in ${UBOOT_MACHINE}; do
+ i=$(expr $i + 1);
+ for type in ${UBOOT_CONFIG}; do
+ j=$(expr $j + 1);
+ if [ $j -eq $i ]
+ then
+ install -d ${D}/${sysconfdir}
+ install -m 644 ${B}/${config}/u-boot-initial-env ${D}/${sysconfdir}/u-boot-initial-env
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ install -d ${D}/${sysconfdir}
+ install -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/u-boot-initial-env
+ fi
+}
+
+do_deploy_append () {
+ if [ -n "${UBOOT_CONFIG}" ]
+ then
+ for config in ${UBOOT_MACHINE}; do
+ i=$(expr $i + 1);
+ for type in ${UBOOT_CONFIG}; do
+ j=$(expr $j + 1);
+ if [ $j -eq $i ]
+ then
+ install -d ${DEPLOYDIR}
+ install -m 644 ${B}/${config}/u-boot-initial-env ${DEPLOYDIR}/u-boot-initial-env-${type}
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ install -d ${DEPLOYDIR}
+ install -m 644 ${B}/${config}/u-boot-initial-env ${DEPLOYDIR}/u-boot-initial-env
+ fi
+}