Skip to contentSkip to conversation

barebox: add an option to embed environment image

PATCH Superseded yegorslists at googlemail.com 3 participants 6 messages Feb 17, 2016 – Mar 1, 2016

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 barebox: add an option to embed environment image

From: Yegor Yefremov <[email protected]>

Barebox provides an option to embed a custom environment image into barebox.bin. This image will be used, when the environment found in the environment sector is invalid.

This patch sets barebox Kconfig option CONFIG_DEFAULT_ENVIRONMENT_PATH to user specified path. This way one can use BR's variables like BR2_EXTERNAL, TOPDIR etc. to provide paths to custom environment folders.

---
Changes:
v2: - remove qstrip
- add detailed patch description
- improve help texts

 boot/barebox/Config.in  | 19 +++++++++++++++++++
 boot/barebox/barebox.mk |  6 ++++++
 2 files changed, 25 insertions(+)
boot/barebox/Config.in +19 -0
index 39cb5d2..ae52b2a 100644
@@ -121,4 +121,23 @@ config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
 	  barebox devfs format, stored in the images directory, with
 	  the same name as the directory name given here.
 
+config BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV
+	bool "Embed custom environment"
+	help
+	  Embed a custom environment image into barebox.bin. In order
+	  to use this option you need to enable CONFIG_DEFAULT_ENVIRONMENT
+	  and setup desired compression type for embedded images in barebox
+	  itself.
+
+config BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV_PATH
+	string "Embedded environment path"
+	depends on BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV
+	help
+	  Barebox CONFIG_DEFAULT_ENVIRONMENT_PATH
+	  will be set to the path containing custom barebox
+	  environment. Depending on your setup, it will probably be
+	  based on either the content of the defaultenv or
+	  defaultenv-2 directories in the barebox source code, plus
+	  the additions needed.
+
 endif
boot/barebox/barebox.mk +6 -0
index 7715daf..49adba0 100644
@@ -72,6 +72,12 @@ define BAREBOX_BUILD_BAREBOXENV_CMDS
 endef
 endif
 
+ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV),y)
+define BAREBOX_KCONFIG_FIXUP_CMDS
+	$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,$(BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV_PATH),$(@D)/.config)
+endef
+endif
+
 ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_ENV),y)
 BAREBOX_ENV_NAME = $(notdir $(call qstrip,\
 	$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)))
Signature · 1 line
2.1.4
#1 lore raw

PATCH v2 1/1 barebox: add an option to embed environment image

Note that this patch conflicts with Pieter's dual-config series, so it would be
good to combine both in a single series.

Quoted 9 lines · yegorslists at googlemail.com

From: Yegor Yefremov <[email protected]>

Barebox provides an option to embed a custom environment image into barebox.bin. This image will be used, when the environment found in the environment sector is invalid.

This patch sets barebox Kconfig option CONFIG_DEFAULT_ENVIRONMENT_PATH to user specified path. This way one can use BR's variables like BR2_EXTERNAL, TOPDIR etc. to provide paths to custom environment folders.

I don't understand this comment. I mean, it seems obvious that you'd have a
config option for it, and that you can use BR2_EXTERNAL in it, no?

Also, commit log should be wrapped at 72 columns.

Quoted 18 lines

---
Changes:
v2: - remove qstrip
- add detailed patch description
- improve help texts

 boot/barebox/Config.in  | 19 +++++++++++++++++++
 boot/barebox/barebox.mk |  6 ++++++
 2 files changed, 25 insertions(+)
boot/barebox/Config.in +0 -0
index 39cb5d2..ae52b2a 100644

boot/barebox/Config.in config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH · line 130

Quoted 10 lines
boot/barebox/Config.in +7 -0
@@ -121,4 +121,23 @@ config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
 	  barebox devfs format, stored in the images directory, with
 	  the same name as the directory name given here.
 
+config BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV
+	bool "Embed custom environment"
+	help
+	  Embed a custom environment image into barebox.bin. In order
+	  to use this option you need to enable CONFIG_DEFAULT_ENVIRONMENT
+	  and setup desired compression type for embedded images in barebox
+	  itself.

I don't know a lot about barebox, but wouldn't it be more appropriate to select
those options automatically?

boot/barebox/Config.in config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH · line 141

Quoted 11 lines
boot/barebox/Config.in +11 -0
+
+config BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV_PATH
+	string "Embedded environment path"
+	depends on BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV
+	help
+	  Barebox CONFIG_DEFAULT_ENVIRONMENT_PATH
+	  will be set to the path containing custom barebox
+	  environment. Depending on your setup, it will probably be
+	  based on either the content of the defaultenv or
+	  defaultenv-2 directories in the barebox source code, plus
+	  the additions needed.

How much sense does it make to have an embedded env that is different from the
custom environment specified above?

If I understand correctly, barebox always has a built-in default environment.
So I think it is sufficient to have a single new option to use the BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH as the built-in default environment.

Of course, you may want to have only the custom built-in default environment (I
think that that's probably the most common case). But the only thing that will happen is that there is one extra file in the images directory, which doesn't hurt IMHO.

Regards,
Arnout

Quoted 20 lines
boot/barebox/Config.in +1 -0
+
 endif
boot/barebox/barebox.mk +6 -0
index 7715daf..49adba0 100644
@@ -72,6 +72,12 @@ define BAREBOX_BUILD_BAREBOXENV_CMDS
 endef
 endif
 
+ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV),y)
+define BAREBOX_KCONFIG_FIXUP_CMDS
+	$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,$(BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV_PATH),$(@D)/.config)
+endef
+endif
+
 ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_ENV),y)
 BAREBOX_ENV_NAME = $(notdir $(call qstrip,\
 	$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#2 lore raw

PATCH v2 1/1 barebox: add an option to embed environment image

Quoted 2 lines · Arnout Vandecappelle

Note that this patch conflicts with Pieter's dual-config series, so it would be
good to combine both in a single series.

@Yegor: Please don't rebase/rework this patch on top of the dual-config series v3 just yet. Arnout gave me some valuable review feedback that affects the structure. I am looking into the feasibility of one of the comments. Please give me another day, and I will get bach to you on this.

[snip]

Quoted 7 lines
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#3 lore raw

PATCH v2 1/1 barebox: add an option to embed environment image

Quoted 5 lines · Pieter Smith
Quoted 2 lines · Arnout Vandecappelle

Note that this patch conflicts with Pieter's dual-config series, so it would be
good to combine both in a single series.

@Yegor: Please don't rebase/rework this patch on top of the dual-config series v3 just yet. Arnout gave me some valuable review feedback that affects the structure. I am looking into the feasibility of one of the comments. Please give me another day, and I will get bach to you on this.

Will do. I was going to suggest the same :-)

Yegor

#4 lore raw

PATCH v2 1/1 barebox: add an option to embed environment image

In reply to Arnout Vandecappelle
Quoted 2 lines · Arnout Vandecappelle

Note that this patch conflicts with Pieter's dual-config series, so it would be
good to combine both in a single series.

I'll rebase my patches on top of dual-config series. This patch was more proof of concept.

Quoted 7 lines · yegorslists at googlemail.com
Quoted 6 lines

From: Yegor Yefremov <[email protected]>

Barebox provides an option to embed a custom environment image into barebox.bin. This image will be used, when the environment found in the environment sector is invalid.

Quoted 6 lines
Quoted 3 lines

This patch sets barebox Kconfig option CONFIG_DEFAULT_ENVIRONMENT_PATH to user specified path. This way one can use BR's variables like BR2_EXTERNAL, TOPDIR etc. to provide paths to custom environment folders.

I don't understand this comment. I mean, it seems obvious that you'd have a
config option for it, and that you can use BR2_EXTERNAL in it, no?

What I mean is, that with this BR option one would change Barebox's own option. Because if you specify the path in Barebox Kconfig directly using BR2_EXTERNAL, it won't be expanded, so that Barebox build process would fail. How would you formulate this?

Quoted 1 line

Also, commit log should be wrapped at 72 columns.

ACK

Quoted 21 lines
Quoted 21 lines

---
Changes:
v2: - remove qstrip
- add detailed patch description
- improve help texts

 boot/barebox/Config.in  | 19 +++++++++++++++++++
 boot/barebox/barebox.mk |  6 ++++++
 2 files changed, 25 insertions(+)
boot/barebox/Config.in +0 -0
index 39cb5d2..ae52b2a 100644
@@ -121,4 +121,23 @@ config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
        barebox devfs format, stored in the images directory, with
        the same name as the directory name given here.
 
Quoted 10 lines

boot/barebox/Config.in config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH · line 130

Quoted 7 lines
boot/barebox/Config.in +7 -0
+config BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV
+     bool "Embed custom environment"
+     help
+       Embed a custom environment image into barebox.bin. In order
+       to use this option you need to enable CONFIG_DEFAULT_ENVIRONMENT
+       and setup desired compression type for embedded images in barebox
+       itself.

I don't know a lot about barebox, but wouldn't it be more appropriate to select
those options automatically?

I can add CONFIG_DEFAULT_ENVIRONMENT, but leave compression type selection to Barebox config.

Quoted 6 lines
Quoted 6 lines
boot/barebox/Config.in +6 -0
+
+config BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV_PATH
+     string "Embedded environment path"
+     depends on BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV
+     help
+       Barebox CONFIG_DEFAULT_ENVIRONMENT_PATH
Quoted 8 lines

boot/barebox/Config.in config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH · line 141

Quoted 5 lines
boot/barebox/Config.in +5 -0
+       will be set to the path containing custom barebox
+       environment. Depending on your setup, it will probably be
+       based on either the content of the defaultenv or
+       defaultenv-2 directories in the barebox source code, plus
+       the additions needed.

How much sense does it make to have an embedded env that is different from the
custom environment specified above?

For example you can have an embedded env for production stage, that fetches kernel from tftp, where systems flash is empty and the real env comes during the production stage and will be used the next time the system boots. So I would keep them both separately.

Quoted 1 line

If I understand correctly, barebox always has a built-in default environment.

AFAIK CONFIG_DEFAULT_ENVIRONMENTdecides whether you have a built-in default environment or not.

Yegor

Quoted 41 lines

So I think it is sufficient to have a single new option to use the BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH as the built-in default environment.

Of course, you may want to have only the custom built-in default environment (I
think that that's probably the most common case). But the only thing that will happen is that there is one extra file in the images directory, which doesn't hurt IMHO.

Regards,
Arnout

Quoted 10 lines
boot/barebox/Config.in +1 -0
+
 endif
boot/barebox/barebox.mk +0 -0
index 7715daf..49adba0 100644
@@ -72,6 +72,12 @@ define BAREBOX_BUILD_BAREBOXENV_CMDS
 endef
 endif

boot/barebox/barebox.mk define BAREBOX_BUILD_BAREBOXENV_CMDS · line 83

Quoted 10 lines
boot/barebox/barebox.mk +6 -0
 
+ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV),y)
+define BAREBOX_KCONFIG_FIXUP_CMDS
+     $(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,$(BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV_PATH),$(@D)/.config)
+endef
+endif
+
 ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_ENV),y)
 BAREBOX_ENV_NAME = $(notdir $(call qstrip,\
      $(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)))

--

Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#5 lore raw

PATCH v2 1/1 barebox: add an option to embed environment image

Quoted 18 lines · Yegor Yefremov
Quoted 2 lines · Arnout Vandecappelle

Note that this patch conflicts with Pieter's dual-config series, so it would be
good to combine both in a single series.

I'll rebase my patches on top of dual-config series. This patch was more proof of concept.

Quoted 11 lines · yegorslists at googlemail.com
Quoted 9 lines

From: Yegor Yefremov <[email protected]>

Barebox provides an option to embed a custom environment image into barebox.bin. This image will be used, when the environment found in the environment sector is invalid.

This patch sets barebox Kconfig option CONFIG_DEFAULT_ENVIRONMENT_PATH to user specified path. This way one can use BR's variables like BR2_EXTERNAL, TOPDIR etc. to provide paths to custom environment folders.

Quoted 7 lines
Quoted 2 lines

I don't understand this comment. I mean, it seems obvious that you'd have a
config option for it, and that you can use BR2_EXTERNAL in it, no?

What I mean is, that with this BR option one would change Barebox's own option. Because if you specify the path in Barebox Kconfig directly using BR2_EXTERNAL, it won't be expanded, so that Barebox build process would fail. How would you formulate this?

Hm, now I read your commit log a second time, it was perfectly clear...

Quoted 37 lines
Quoted 2 lines

Also, commit log should be wrapped at 72 columns.

ACK

Quoted 21 lines
Quoted 21 lines

---
Changes:
v2: - remove qstrip
- add detailed patch description
- improve help texts

 boot/barebox/Config.in  | 19 +++++++++++++++++++
 boot/barebox/barebox.mk |  6 ++++++
 2 files changed, 25 insertions(+)
boot/barebox/Config.in +0 -0
index 39cb5d2..ae52b2a 100644
@@ -121,4 +121,23 @@ config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
        barebox devfs format, stored in the images directory, with
        the same name as the directory name given here.
 
Quoted 10 lines

boot/barebox/Config.in config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH · line 130

Quoted 7 lines
boot/barebox/Config.in +7 -0
+config BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV
+     bool "Embed custom environment"
+     help
+       Embed a custom environment image into barebox.bin. In order
+       to use this option you need to enable CONFIG_DEFAULT_ENVIRONMENT
+       and setup desired compression type for embedded images in barebox
+       itself.

I don't know a lot about barebox, but wouldn't it be more appropriate to select
those options automatically?

Quoted 2 lines

I can add CONFIG_DEFAULT_ENVIRONMENT, but leave compression type selection to Barebox config.

Sounds good.

Quoted 16 lines
Quoted 15 lines

boot/barebox/Config.in config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH · line 141

Quoted 12 lines
boot/barebox/Config.in +11 -0
+
+config BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV_PATH
+     string "Embedded environment path"
+     depends on BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV
+     help
+       Barebox CONFIG_DEFAULT_ENVIRONMENT_PATH
+       will be set to the path containing custom barebox
+       environment. Depending on your setup, it will probably be
+       based on either the content of the defaultenv or
+       defaultenv-2 directories in the barebox source code, plus
+       the additions needed.

How much sense does it make to have an embedded env that is different from the
custom environment specified above?

Quoted 4 lines

For example you can have an embedded env for production stage, that fetches kernel from tftp, where systems flash is empty and the real env comes during the production stage and will be used the next time the system boots. So I would keep them both separately.

Doesn't sound like a very strong case to me, but OK, why not.

Quoted 5 lines
Quoted 2 lines

If I understand correctly, barebox always has a built-in default environment.

AFAIK CONFIG_DEFAULT_ENVIRONMENTdecides whether you have a built-in default environment or not.

Ah of course.

Regards,
Arnout

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF