From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <ahmad@a3f.at>
Subject: [PATCH] common: add option for shipping KCONFIG_CONFIG as /env/data/config
Date: Sat, 10 Apr 2021 12:45:05 +0200 [thread overview]
Message-ID: <20210410104505.2076790-1-ahmad@a3f.at> (raw)
Add a new option that enables access to the barebox configuration
file through /env/data/config. This can be useful in environments
where a fatter barebox can be tolerated (like on an EFI system
partition). It could also be used to conditionally skip tests
on disabled functionality in the future.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
Makefile | 2 ++
common/Kconfig | 7 +++++++
defaultenv/Makefile | 7 +++++++
defaultenv/defaultenv.c | 2 ++
scripts/Makefile.lib | 3 +++
5 files changed, 21 insertions(+)
diff --git a/Makefile b/Makefile
index a36608819da5..c13f3274c18c 100644
--- a/Makefile
+++ b/Makefile
@@ -358,6 +358,8 @@ endif
KCONFIG_CONFIG ?= .config
+export KCONFIG_CONFIG
+
# Default file for 'make defconfig'. This may be overridden by arch-Makefile.
export KBUILD_DEFCONFIG := defconfig
diff --git a/common/Kconfig b/common/Kconfig
index 342817bbcbb4..2872c80dbf13 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -941,6 +941,13 @@ config DEFAULT_ENVIRONMENT_GENERIC_NEW_REBOOT_MODE
depends on DEFAULT_ENVIRONMENT_GENERIC_NEW
depends on REBOOT_MODE
+config DEFAULT_ENVIRONMENT_GENERIC_NEW_IKCONFIG
+ bool "Ship .config as /env/data/config"
+ help
+ This option embeds the used barebox Kconfig .config file into the
+ environment as /env/data/config. This will increases barebox image
+ size. If unsure, say n here.
+
config DEFAULT_ENVIRONMENT_PATH
string
depends on DEFAULT_ENVIRONMENT
diff --git a/defaultenv/Makefile b/defaultenv/Makefile
index 91293567c0d3..68790321187d 100644
--- a/defaultenv/Makefile
+++ b/defaultenv/Makefile
@@ -32,3 +32,10 @@ cmd_env_zero = ($(objtree)/scripts/bareboxenv -z $(CONFIG_DEFAULT_ENVIRONMENT_PA
$(obj)/barebox_zero_env: FORCE
$(call if_changed,env_zero)
+
+bbenv-$(CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW_IKCONFIG) += defaultenv-2-ikconfig
+
+defaultenv/defaultenv-2-ikconfig.bbenv$(DEFAULT_COMPRESSION_SUFFIX): $(KCONFIG_CONFIG)
+ @mkdir -p defaultenv/defaultenv-2-ikconfig/data
+ @cp $(KCONFIG_CONFIG) defaultenv/defaultenv-2-ikconfig/data/config
+ $(call cmd,envgen,defaultenv/defaultenv-2-ikconfig)
diff --git a/defaultenv/defaultenv.c b/defaultenv/defaultenv.c
index d69446c8937a..055475eb4756 100644
--- a/defaultenv/defaultenv.c
+++ b/defaultenv/defaultenv.c
@@ -47,6 +47,8 @@ static void defaultenv_add_base(void)
defaultenv_append_directory(defaultenv_2_dfu);
if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW_REBOOT_MODE))
defaultenv_append_directory(defaultenv_2_reboot_mode);
+ if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW_IKCONFIG))
+ defaultenv_append_directory(defaultenv_2_ikconfig);
if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_GENERIC))
defaultenv_append_directory(defaultenv_1);
}
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 319ac19975ed..80d76b177c0a 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -365,6 +365,9 @@ cmd_env_S = \
$(obj)/%.bbenv$(DEFAULT_COMPRESSION_SUFFIX).S: $(src)/%.bbenv$(DEFAULT_COMPRESSION_SUFFIX) FORCE
$(call if_changed,env_S)
+quiet_cmd_envgen = ENVGEN $@
+cmd_envgen=$(srctree)/scripts/genenv $(objtree) $(objtree) $@ $2
+
quiet_cmd_env = ENV $@
cmd_env=$(srctree)/scripts/genenv $(srctree) $(objtree) $@ $<
--
2.30.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2021-04-10 10:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-10 10:45 Ahmad Fatoum [this message]
2021-04-11 20:39 ` [PATCH] fixup! " Ahmad Fatoum
2021-04-12 7:45 ` Roland Hieber
2021-04-12 7:54 ` Ahmad Fatoum
2021-04-13 6:09 ` [PATCH] " Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210410104505.2076790-1-ahmad@a3f.at \
--to=ahmad@a3f.at \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox