From 21360cadcb36f63e866c11e8d30fd977d4997d2e Mon Sep 17 00:00:00 2001
From: Armin Luntzer <armin.luntzer@univie.ac.at>
Date: Mon, 1 Oct 2018 13:39:08 +0200
Subject: [PATCH] Add config option for inclusion of and application executable
 to the embedded image

---
 init/Kconfig           | 11 +++++++++++
 scripts/link-leanos.sh |  4 +++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/init/Kconfig b/init/Kconfig
index ddc0eeb..61e6113 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -87,6 +87,16 @@ config EMBED_MODULES_IMAGE
 	  generated modules into the final kernel binary.
 	  This is a convenience option, if unsure, say Y.
 
+config EMBED_APPLICATION
+	string "Embed an application image"
+	depends on EMBED_MODULES_IMAGE
+	default ""
+	help
+	  Specify a path to an executable to embed or leave it empty.
+	  Note: in the current implementation, the executable is treated as a
+	  kernel module, so it requires to be relocatible and have a init/exit
+	  call.
+
 endif # MODULES
 
 
@@ -160,4 +170,5 @@ config DEBUG_INFO_REDUCED
 	  DEBUG_INFO build and compile times are reduced too.
 	  Only works with newer gcc versions.
 
+
 endmenu
diff --git a/scripts/link-leanos.sh b/scripts/link-leanos.sh
index db0f57a..b497a25 100755
--- a/scripts/link-leanos.sh
+++ b/scripts/link-leanos.sh
@@ -309,7 +309,9 @@ if [ "$1" = "embed" ]; then
 	rm -f modules.image
 	${AR} rcs ${srctree}/modules.image \
 		$(tr '\n' ' ' < ${srctree}/modules.order) \
-		$(find dsp/xentium -name *.xen)
+		$(find dsp/xentium -name *.xen) \
+		"${CONFIG_EMBED_APPLICATION}"
+		
 
 	leanos_link "${kallsymso}" leanos "${embedflags}"
 	exit
-- 
GitLab