Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] barebox: add an option to embed environment image
@ 2016-02-17  8:42 yegorslists at googlemail.com
  2016-02-27 20:40 ` Arnout Vandecappelle
  0 siblings, 1 reply; 10+ messages in thread
From: yegorslists at googlemail.com @ 2016-02-17  8:42 UTC (permalink / raw)
  To: buildroot

From: Yegor Yefremov <yegorslists@googlemail.com>

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.

Cc: Pieter Smith <pieter@boesman.nl>
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
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(+)

diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in
index 39cb5d2..ae52b2a 100644
--- a/boot/barebox/Config.in
+++ b/boot/barebox/Config.in
@@ -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
diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
index 7715daf..49adba0 100644
--- a/boot/barebox/barebox.mk
+++ b/boot/barebox/barebox.mk
@@ -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)))
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v2] barebox: add an option to embed environment image
  2016-02-17  8:42 [Buildroot] [PATCH v2] barebox: add an option to embed environment image yegorslists at googlemail.com
@ 2016-02-27 20:40 ` Arnout Vandecappelle
  2016-02-28  7:55   ` Pieter Smith
  2016-02-28 22:50   ` Yegor Yefremov
  0 siblings, 2 replies; 10+ messages in thread
From: Arnout Vandecappelle @ 2016-02-27 20:40 UTC (permalink / raw)
  To: buildroot

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

On 02/17/16 09:42, yegorslists at googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> 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.

> 
> Cc: Pieter Smith <pieter@boesman.nl>
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
> 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(+)
> 
> diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in
> index 39cb5d2..ae52b2a 100644
> --- a/boot/barebox/Config.in
> +++ b/boot/barebox/Config.in
> @@ -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?

> +
> +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

> +
>  endif
> diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
> index 7715daf..49adba0 100644
> --- a/boot/barebox/barebox.mk
> +++ b/boot/barebox/barebox.mk
> @@ -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)))
> 


-- 
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v2] barebox: add an option to embed environment image
  2016-02-27 20:40 ` Arnout Vandecappelle
@ 2016-02-28  7:55   ` Pieter Smith
  2016-02-28  9:27     ` Yegor Yefremov
  2016-02-28 22:50   ` Yegor Yefremov
  1 sibling, 1 reply; 10+ messages in thread
From: Pieter Smith @ 2016-02-28  7:55 UTC (permalink / raw)
  To: buildroot

On Sat, Feb 27, 2016 at 09:40:21PM +0100, Arnout Vandecappelle wrote:
>  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]
> -- 
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v2] barebox: add an option to embed environment image
  2016-02-28  7:55   ` Pieter Smith
@ 2016-02-28  9:27     ` Yegor Yefremov
  0 siblings, 0 replies; 10+ messages in thread
From: Yegor Yefremov @ 2016-02-28  9:27 UTC (permalink / raw)
  To: buildroot

On Sun, Feb 28, 2016 at 8:55 AM, Pieter Smith <pieter@boesman.nl> wrote:
> On Sat, Feb 27, 2016 at 09:40:21PM +0100, Arnout Vandecappelle wrote:
>>  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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v2] barebox: add an option to embed environment image
  2016-02-27 20:40 ` Arnout Vandecappelle
  2016-02-28  7:55   ` Pieter Smith
@ 2016-02-28 22:50   ` Yegor Yefremov
  2016-03-01 23:02     ` Arnout Vandecappelle
  1 sibling, 1 reply; 10+ messages in thread
From: Yegor Yefremov @ 2016-02-28 22:50 UTC (permalink / raw)
  To: buildroot

On Sat, Feb 27, 2016 at 9:40 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
>  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.

> On 02/17/16 09:42, yegorslists at googlemail.com wrote:
>> From: Yegor Yefremov <yegorslists@googlemail.com>
>>
>> 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?

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?

>  Also, commit log should be wrapped at 72 columns.

ACK

>>
>> Cc: Pieter Smith <pieter@boesman.nl>
>> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
>> ---
>> 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(+)
>>
>> diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in
>> index 39cb5d2..ae52b2a 100644
>> --- a/boot/barebox/Config.in
>> +++ b/boot/barebox/Config.in
>> @@ -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?

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

>> +
>> +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?

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.

>  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

> 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
>
>> +
>>  endif
>> diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
>> index 7715daf..49adba0 100644
>> --- a/boot/barebox/barebox.mk
>> +++ b/boot/barebox/barebox.mk
>> @@ -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)))
>>
>
>
> --
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v2] barebox: add an option to embed environment image
  2016-02-28 22:50   ` Yegor Yefremov
@ 2016-03-01 23:02     ` Arnout Vandecappelle
  0 siblings, 0 replies; 10+ messages in thread
From: Arnout Vandecappelle @ 2016-03-01 23:02 UTC (permalink / raw)
  To: buildroot

On 02/28/16 23:50, Yegor Yefremov wrote:
> On Sat, Feb 27, 2016 at 9:40 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
>>  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.
> 
>> On 02/17/16 09:42, yegorslists at googlemail.com wrote:
>>> From: Yegor Yefremov <yegorslists@googlemail.com>
>>>
>>> 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?
> 
> 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...

> 
>>  Also, commit log should be wrapped at 72 columns.
> 
> ACK
> 
>>>
>>> Cc: Pieter Smith <pieter@boesman.nl>
>>> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
>>> ---
>>> 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(+)
>>>
>>> diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in
>>> index 39cb5d2..ae52b2a 100644
>>> --- a/boot/barebox/Config.in
>>> +++ b/boot/barebox/Config.in
>>> @@ -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?
> 
> I can add CONFIG_DEFAULT_ENVIRONMENT, but leave compression type
> selection to Barebox config.

 Sounds good.

> 
>>> +
>>> +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?
> 
> 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.

> 
>>  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]


-- 
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v2] barebox: add an option to embed environment image
@ 2016-05-03 12:56 yegorslists at googlemail.com
  2016-05-03 17:38 ` Arnout Vandecappelle
  0 siblings, 1 reply; 10+ messages in thread
From: yegorslists at googlemail.com @ 2016-05-03 12:56 UTC (permalink / raw)
  To: buildroot

From: Yegor Yefremov <yegorslists@googlemail.com>

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 such BR's variables like
BR2_EXTERNAL, TOPDIR etc. to provide paths to custom environment folders.

Cc: Pieter Smith <pieter@boesman.nl>
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
Changes:
	v2: set CONFIG_DEFAULT_ENVIRONMENT too, to enable default env at all

 boot/barebox/barebox-aux/Config.in | 17 +++++++++++++++++
 boot/barebox/barebox.mk            |  7 +++++++
 boot/barebox/barebox/Config.in     | 17 +++++++++++++++++
 3 files changed, 41 insertions(+)

diff --git a/boot/barebox/barebox-aux/Config.in b/boot/barebox/barebox-aux/Config.in
index 35aadc0..00d550e 100644
--- a/boot/barebox/barebox-aux/Config.in
+++ b/boot/barebox/barebox-aux/Config.in
@@ -57,3 +57,20 @@ config BR2_TARGET_BAREBOX_AUX_CUSTOM_ENV_PATH
 	  the additions needed. The output will be an image in the
 	  barebox devfs format, stored in the images directory, with
 	  the same name as the directory name given here.
+
+config BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV
+	bool "Embed custom environment"
+	help
+	  Embed a custom environment image into barebox.bin. This option
+	  enables barebox internal CONFIG_DEFAULT_ENVIRONMENT option.
+
+config BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV_PATH
+	string "Embedded environment path"
+	depends on BR2_TARGET_BAREBOX_AUX_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.
diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
index 949fb9f..36a9cf5 100644
--- a/boot/barebox/barebox.mk
+++ b/boot/barebox/barebox.mk
@@ -96,6 +96,13 @@ define $(1)_INSTALL_CUSTOM_ENV
 endef
 endif
 
+ifeq ($(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV),y)
+define $(1)_KCONFIG_FIXUP_CMDS
+	$$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV_PATH),$$(@D)/.config)
+	$$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV_PATH),$$(@D)/.config)
+endef
+endif
+
 define $(1)_BUILD_CMDS
 	$$($(1)_BUILD_BAREBOXENV_CMDS)
 	$$(TARGET_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
diff --git a/boot/barebox/barebox/Config.in b/boot/barebox/barebox/Config.in
index bf13ea5..a3a7767 100644
--- a/boot/barebox/barebox/Config.in
+++ b/boot/barebox/barebox/Config.in
@@ -63,3 +63,20 @@ config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
 	  the additions needed. The output will be an image in the
 	  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. This option
+	  enables barebox internal CONFIG_DEFAULT_ENVIRONMENT option.
+
+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.
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v2] barebox: add an option to embed environment image
  2016-05-03 12:56 yegorslists at googlemail.com
@ 2016-05-03 17:38 ` Arnout Vandecappelle
  2016-05-04  9:25   ` Yegor Yefremov
  0 siblings, 1 reply; 10+ messages in thread
From: Arnout Vandecappelle @ 2016-05-03 17:38 UTC (permalink / raw)
  To: buildroot

On 05/03/16 14:56, yegorslists at googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
>
> 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 such BR's variables like
> BR2_EXTERNAL, TOPDIR etc. to provide paths to custom environment folders.
>
> Cc: Pieter Smith <pieter@boesman.nl>
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
> Changes:
> 	v2: set CONFIG_DEFAULT_ENVIRONMENT too, to enable default env at all
>
>  boot/barebox/barebox-aux/Config.in | 17 +++++++++++++++++
>  boot/barebox/barebox.mk            |  7 +++++++
>  boot/barebox/barebox/Config.in     | 17 +++++++++++++++++
>  3 files changed, 41 insertions(+)
>
> diff --git a/boot/barebox/barebox-aux/Config.in b/boot/barebox/barebox-aux/Config.in
> index 35aadc0..00d550e 100644
> --- a/boot/barebox/barebox-aux/Config.in
> +++ b/boot/barebox/barebox-aux/Config.in
> @@ -57,3 +57,20 @@ config BR2_TARGET_BAREBOX_AUX_CUSTOM_ENV_PATH
>  	  the additions needed. The output will be an image in the
>  	  barebox devfs format, stored in the images directory, with
>  	  the same name as the directory name given here.
> +
> +config BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV
> +	bool "Embed custom environment"
> +	help
> +	  Embed a custom environment image into barebox.bin. This option
> +	  enables barebox internal CONFIG_DEFAULT_ENVIRONMENT option.
> +
> +config BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV_PATH
> +	string "Embedded environment path"
> +	depends on BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV

  I'm not altogether sure of this, but we could remove the _CUSTOM_EMBEDDED_ENV 
option and instead check for non-empty _CUSTOM_EMBEDDED_ENV_PATH. Or was this 
discussed before already?

> +	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

  Not that I really know what all this is about, but isn't 'defaultenv' typical 
for plain barebox, and 'defaultenv-2' typical for barebox-aux? Then maybe the 
help text can suggest this as well.

> +	  the additions needed.
> diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
> index 949fb9f..36a9cf5 100644
> --- a/boot/barebox/barebox.mk
> +++ b/boot/barebox/barebox.mk
> @@ -96,6 +96,13 @@ define $(1)_INSTALL_CUSTOM_ENV
>  endef
>  endif
>
> +ifeq ($(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV),y)
> +define $(1)_KCONFIG_FIXUP_CMDS
> +	$$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV_PATH),$$(@D)/.config)

  Without actually knowing barebox, it seems to me that this should be a 
KCONFIG_ENABLE_OPT instead...

> +	$$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV_PATH),$$(@D)/.config)

  This should be qstripped and then "" added explicitly. That way, it will also 
work when the variable is overridden from the command line.


  Regards,
  Arnout

> +endef
> +endif
> +
>  define $(1)_BUILD_CMDS
>  	$$($(1)_BUILD_BAREBOXENV_CMDS)
>  	$$(TARGET_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
> diff --git a/boot/barebox/barebox/Config.in b/boot/barebox/barebox/Config.in
> index bf13ea5..a3a7767 100644
> --- a/boot/barebox/barebox/Config.in
> +++ b/boot/barebox/barebox/Config.in
> @@ -63,3 +63,20 @@ config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
>  	  the additions needed. The output will be an image in the
>  	  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. This option
> +	  enables barebox internal CONFIG_DEFAULT_ENVIRONMENT option.
> +
> +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.
>


-- 
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v2] barebox: add an option to embed environment image
  2016-05-03 17:38 ` Arnout Vandecappelle
@ 2016-05-04  9:25   ` Yegor Yefremov
  2016-05-04 10:59     ` Arnout Vandecappelle
  0 siblings, 1 reply; 10+ messages in thread
From: Yegor Yefremov @ 2016-05-04  9:25 UTC (permalink / raw)
  To: buildroot

On Tue, May 3, 2016 at 7:38 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 05/03/16 14:56, yegorslists at googlemail.com wrote:
>>
>> From: Yegor Yefremov <yegorslists@googlemail.com>
>>
>> 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 such BR's variables like
>> BR2_EXTERNAL, TOPDIR etc. to provide paths to custom environment folders.
>>
>> Cc: Pieter Smith <pieter@boesman.nl>
>> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
>> ---
>> Changes:
>>         v2: set CONFIG_DEFAULT_ENVIRONMENT too, to enable default env at
>> all
>>
>>  boot/barebox/barebox-aux/Config.in | 17 +++++++++++++++++
>>  boot/barebox/barebox.mk            |  7 +++++++
>>  boot/barebox/barebox/Config.in     | 17 +++++++++++++++++
>>  3 files changed, 41 insertions(+)
>>
>> diff --git a/boot/barebox/barebox-aux/Config.in
>> b/boot/barebox/barebox-aux/Config.in
>> index 35aadc0..00d550e 100644
>> --- a/boot/barebox/barebox-aux/Config.in
>> +++ b/boot/barebox/barebox-aux/Config.in
>> @@ -57,3 +57,20 @@ config BR2_TARGET_BAREBOX_AUX_CUSTOM_ENV_PATH
>>           the additions needed. The output will be an image in the
>>           barebox devfs format, stored in the images directory, with
>>           the same name as the directory name given here.
>> +
>> +config BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV
>> +       bool "Embed custom environment"
>> +       help
>> +         Embed a custom environment image into barebox.bin. This option
>> +         enables barebox internal CONFIG_DEFAULT_ENVIRONMENT option.
>> +
>> +config BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV_PATH
>> +       string "Embedded environment path"
>> +       depends on BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV
>
>
>  I'm not altogether sure of this, but we could remove the
> _CUSTOM_EMBEDDED_ENV option and instead check for non-empty
> _CUSTOM_EMBEDDED_ENV_PATH. Or was this discussed before already?

No, this wasn't discussed before. I like the idea.

>> +       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
>
>
>  Not that I really know what all this is about, but isn't 'defaultenv'
> typical for plain barebox, and 'defaultenv-2' typical for barebox-aux? Then
> maybe the help text can suggest this as well.

defaultenv-2 is just a second generation of defaultenv and AFAIK has
nothing to do with botloader stage. See description here:
http://www.barebox.org/doc/latest/user/defaultenv-2.html

>> +         the additions needed.
>> diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
>> index 949fb9f..36a9cf5 100644
>> --- a/boot/barebox/barebox.mk
>> +++ b/boot/barebox/barebox.mk
>> @@ -96,6 +96,13 @@ define $(1)_INSTALL_CUSTOM_ENV
>>  endef
>>  endif
>>
>> +ifeq ($(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV),y)
>> +define $(1)_KCONFIG_FIXUP_CMDS
>> +       $$(call
>> KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV_PATH),$$(@D)/.config)
>
>
>  Without actually knowing barebox, it seems to me that this should be a
> KCONFIG_ENABLE_OPT instead...

Yes. Good catch.

>> +       $$(call
>> KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV_PATH),$$(@D)/.config)
>
>
>  This should be qstripped and then "" added explicitly. That way, it will
> also work when the variable is overridden from the command line.

Something like that?

$$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,"$$(call
qstrip,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV_PATH))",$$(@D)/.config)

>> +endef
>> +endif
>> +
>>  define $(1)_BUILD_CMDS
>>         $$($(1)_BUILD_BAREBOXENV_CMDS)
>>         $$(TARGET_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
>> diff --git a/boot/barebox/barebox/Config.in
>> b/boot/barebox/barebox/Config.in
>> index bf13ea5..a3a7767 100644
>> --- a/boot/barebox/barebox/Config.in
>> +++ b/boot/barebox/barebox/Config.in
>> @@ -63,3 +63,20 @@ config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
>>           the additions needed. The output will be an image in the
>>           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. This option
>> +         enables barebox internal CONFIG_DEFAULT_ENVIRONMENT option.
>> +
>> +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.
>>
>
>
> --
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v2] barebox: add an option to embed environment image
  2016-05-04  9:25   ` Yegor Yefremov
@ 2016-05-04 10:59     ` Arnout Vandecappelle
  0 siblings, 0 replies; 10+ messages in thread
From: Arnout Vandecappelle @ 2016-05-04 10:59 UTC (permalink / raw)
  To: buildroot



On 05/04/16 11:25, Yegor Yefremov wrote:
> On Tue, May 3, 2016 at 7:38 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
>> On 05/03/16 14:56, yegorslists at googlemail.com wrote:
[snip]
>>> +config BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV
>>> +       bool "Embed custom environment"
>>> +       help
>>> +         Embed a custom environment image into barebox.bin. This option
>>> +         enables barebox internal CONFIG_DEFAULT_ENVIRONMENT option.
>>> +
>>> +config BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV_PATH
>>> +       string "Embedded environment path"
>>> +       depends on BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV
>>
>>
>>  I'm not altogether sure of this, but we could remove the
>> _CUSTOM_EMBEDDED_ENV option and instead check for non-empty
>> _CUSTOM_EMBEDDED_ENV_PATH. Or was this discussed before already?
>
> No, this wasn't discussed before. I like the idea.
[snip]
>>> +       $$(call
>>> KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV_PATH),$$(@D)/.config)
>>
>>
>>  This should be qstripped and then "" added explicitly. That way, it will
>> also work when the variable is overridden from the command line.
>
> Something like that?
>
> $$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,"$$(call
> qstrip,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV_PATH))",$$(@D)/.config)

  Yes, but if you follow my suggestion of removing the boolean option and just 
keeping the string, you'll also need to use the qstripped string to evaluate the 
make condition, so you'd better put it in a variable $(1)_CUSTOM_EMBEDDED_ENV_PATH.

  Regards,
  Arnout

[snip]--
Arnout Vandecappelle      arnout dot vandecappelle at essensium dot com
Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile)
Essensium, Mind division . . . . . . . . . . . . . . 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-05-04 10:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-17  8:42 [Buildroot] [PATCH v2] barebox: add an option to embed environment image yegorslists at googlemail.com
2016-02-27 20:40 ` Arnout Vandecappelle
2016-02-28  7:55   ` Pieter Smith
2016-02-28  9:27     ` Yegor Yefremov
2016-02-28 22:50   ` Yegor Yefremov
2016-03-01 23:02     ` Arnout Vandecappelle
  -- strict thread matches above, loose matches on Subject: below --
2016-05-03 12:56 yegorslists at googlemail.com
2016-05-03 17:38 ` Arnout Vandecappelle
2016-05-04  9:25   ` Yegor Yefremov
2016-05-04 10:59     ` Arnout Vandecappelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox