* [ptxdist] [PATCH v3] u-boot: generate environment image
@ 2019-11-19 16:40 Bruno Thomsen
2019-11-20 8:10 ` Alexander Dahl
0 siblings, 1 reply; 5+ messages in thread
From: Bruno Thomsen @ 2019-11-19 16:40 UTC (permalink / raw)
To: ptxdist; +Cc: Alexander Dahl, Denis OSTERLAND, Bruno Thomsen, bth
Add possiblity to generate a default or a custom environment
image. Image can be used during manufacturing to avoid bootloader
console usage and speed up first boot. Other image use-cases
include device development edition, device demonstration
mode, etc.
Custom environment image is generated from an user provided
config file with one 'var=value' per line format. Input config
file name is configurable.
Cc: Denis OSTERLAND <denis.osterland@diehl.com>
Cc: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
---
v3:
- remove multiple env images support
- use static image names
- rebase patches on top of: u-boot: Build out-of-tree
v2:
- remove HOST_U_BOOT_TOOLS dependency
- configurable default env image name
- add custom env image generation option
- move all options to sub menu
platforms/u-boot.in | 57 +++++++++++++++++++++++++++++++++++++++++++++
rules/u-boot.make | 22 +++++++++++++++++
2 files changed, 79 insertions(+)
diff --git a/platforms/u-boot.in b/platforms/u-boot.in
index 9bac4a758..1dfb80098 100644
--- a/platforms/u-boot.in
+++ b/platforms/u-boot.in
@@ -71,6 +71,63 @@ config U_BOOT_CONFIG
endif
+choice
+ prompt "Generate environment image"
+ default U_BOOT_NONE_ENV_IMAGE
+
+config U_BOOT_NONE_ENV_IMAGE
+ prompt "none"
+ bool
+ help
+ Don't generate an U-Boot environment image.
+
+config U_BOOT_DEFAULT_ENV_IMAGE
+ prompt "default"
+ bool
+ help
+ Use U-Boot's mkenvimage to compile a default U-Boot environment
+ image for use in e.g. device manufacturing or development.
+
+config U_BOOT_CUSTOM_ENV_IMAGE
+ prompt "custom"
+ bool
+ help
+ Use U-Boot's mkenvimage to compile a custom U-Boot environment
+ image based on the text file in U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
+ for use in e.g. device manufacturing or development.
+
+endchoice
+
+config U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
+ prompt "Custom environment source"
+ string
+ default "custom_env.config"
+ depends on U_BOOT_CUSTOM_ENV_IMAGE
+ help
+ Text file in PTXDIST_WORKSPACE describing the custom environment.
+ The file should have lines in the form var=value, one per line.
+ Blank lines and lines starting with a # are ignored.
+
+if !U_BOOT_NONE_ENV_IMAGE
+
+config U_BOOT_ENV_IMAGE_SIZE
+ prompt "Environment image size"
+ string
+ default "0x2000"
+ help
+ Enter the U-Boot environment size for generation of image.
+ Size can be prefixed with 0x for hexadecimal values.
+ Must match size defined in target config and "/etc/fw_env.config".
+
+config U_BOOT_ENV_IMAGE_REDUNDANT
+ prompt "Environment image with redundant copy"
+ bool
+ help
+ Use to generate a redundant environment in the image.
+ Must match target config and "/etc/fw_env.config".
+
+endif
+
config U_BOOT_BOOT_SCRIPT
prompt "Compile U-Boot boot script"
bool
diff --git a/rules/u-boot.make b/rules/u-boot.make
index e3c2c2389..932b4e4af 100644
--- a/rules/u-boot.make
+++ b/rules/u-boot.make
@@ -100,6 +100,20 @@ ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
@$(U_BOOT_BUILD_DIR)/tools/mkimage -T script -C none \
-d $(U_BOOT_BOOT_SCRIPT_TXT) \
$(U_BOOT_BUILD_DIR)/boot.scr.uimg
+endif
+ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
+ $(U_BOOT_MAKE_ENV) $(U_BOOT_DIR)/scripts/get_default_envs.sh $(U_BOOT_BUILD_DIR) | \
+ $(U_BOOT_BUILD_DIR)/tools/mkenvimage -p 0x0 \
+ $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
+ -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
+ -o $(U_BOOT_BUILD_DIR)/u-boot-env.img -
+endif
+ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
+ $(U_BOOT_BUILD_DIR)/tools/mkenvimage -p 0x0 \
+ $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
+ -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
+ -o $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
+ $(PTXDIST_WORKSPACE)/$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE)
endif
@$(call touch)
@@ -147,6 +161,14 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL
@install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-with-spl-pbl.bin \
$(IMAGEDIR)/u-boot-with-spl-pbl.bin
endif
+ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
+ @install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-env.img \
+ $(IMAGEDIR)/u-boot-env.img
+endif
+ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
+ @install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
+ $(IMAGEDIR)/u-boot-custom-env.img
+endif
ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
@$(call install_init, u-boot)
--
2.23.0
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ptxdist] [PATCH v3] u-boot: generate environment image
2019-11-19 16:40 [ptxdist] [PATCH v3] u-boot: generate environment image Bruno Thomsen
@ 2019-11-20 8:10 ` Alexander Dahl
2019-11-22 13:31 ` Bruno Thomsen
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Dahl @ 2019-11-20 8:10 UTC (permalink / raw)
To: ptxdist; +Cc: Denis OSTERLAND, Bruno Thomsen, bth
Hello Bruno,
thanks for your effort. I guess some folks have custom rules for generating
env images, so do we. It's good to have a common approach for ordinary use
cases to prevent reinventing the wheel. I have some remarks however, see
below. ;-)
Am Dienstag, 19. November 2019, 17:40:02 CET schrieb Bruno Thomsen:
> Add possiblity to generate a default or a custom environment
> image. Image can be used during manufacturing to avoid bootloader
> console usage and speed up first boot. Other image use-cases
> include device development edition, device demonstration
> mode, etc.
>
> Custom environment image is generated from an user provided
> config file with one 'var=value' per line format. Input config
> file name is configurable.
>
> Cc: Denis OSTERLAND <denis.osterland@diehl.com>
> Cc: Alexander Dahl <ada@thorsis.com>
> Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
> ---
> v3:
> - remove multiple env images support
> - use static image names
> - rebase patches on top of: u-boot: Build out-of-tree
> v2:
> - remove HOST_U_BOOT_TOOLS dependency
> - configurable default env image name
> - add custom env image generation option
> - move all options to sub menu
>
> platforms/u-boot.in | 57 +++++++++++++++++++++++++++++++++++++++++++++
> rules/u-boot.make | 22 +++++++++++++++++
> 2 files changed, 79 insertions(+)
>
> diff --git a/platforms/u-boot.in b/platforms/u-boot.in
> index 9bac4a758..1dfb80098 100644
> --- a/platforms/u-boot.in
> +++ b/platforms/u-boot.in
> @@ -71,6 +71,63 @@ config U_BOOT_CONFIG
>
> endif
>
> +choice
> + prompt "Generate environment image"
> + default U_BOOT_NONE_ENV_IMAGE
> +
> +config U_BOOT_NONE_ENV_IMAGE
> + prompt "none"
> + bool
> + help
> + Don't generate an U-Boot environment image.
> +
> +config U_BOOT_DEFAULT_ENV_IMAGE
> + prompt "default"
> + bool
> + help
> + Use U-Boot's mkenvimage to compile a default U-Boot environment
> + image for use in e.g. device manufacturing or development.
> +
> +config U_BOOT_CUSTOM_ENV_IMAGE
> + prompt "custom"
> + bool
> + help
> + Use U-Boot's mkenvimage to compile a custom U-Boot environment
> + image based on the text file in U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
> + for use in e.g. device manufacturing or development.
> +
> +endchoice
> +
> +config U_BOOT_CUSTOM_ENV_IMAGE_SOURCE
> + prompt "Custom environment source"
> + string
> + default "custom_env.config"
> + depends on U_BOOT_CUSTOM_ENV_IMAGE
> + help
> + Text file in PTXDIST_WORKSPACE describing the custom environment.
> + The file should have lines in the form var=value, one per line.
> + Blank lines and lines starting with a # are ignored.
> +
> +if !U_BOOT_NONE_ENV_IMAGE
> +
> +config U_BOOT_ENV_IMAGE_SIZE
> + prompt "Environment image size"
> + string
> + default "0x2000"
> + help
> + Enter the U-Boot environment size for generation of image.
> + Size can be prefixed with 0x for hexadecimal values.
> + Must match size defined in target config and "/etc/fw_env.config".
Kconfig knows the type "hex" which you could use here. It would prevent
invalid user input.
> +
> +config U_BOOT_ENV_IMAGE_REDUNDANT
> + prompt "Environment image with redundant copy"
> + bool
> + help
> + Use to generate a redundant environment in the image.
> + Must match target config and "/etc/fw_env.config".
> +
> +endif
> +
> config U_BOOT_BOOT_SCRIPT
> prompt "Compile U-Boot boot script"
> bool
> diff --git a/rules/u-boot.make b/rules/u-boot.make
> index e3c2c2389..932b4e4af 100644
> --- a/rules/u-boot.make
> +++ b/rules/u-boot.make
> @@ -100,6 +100,20 @@ ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
> @$(U_BOOT_BUILD_DIR)/tools/mkimage -T script -C none \
> -d $(U_BOOT_BOOT_SCRIPT_TXT) \
> $(U_BOOT_BUILD_DIR)/boot.scr.uimg
> +endif
> +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> + $(U_BOOT_MAKE_ENV) $(U_BOOT_DIR)/scripts/get_default_envs.sh
> $(U_BOOT_BUILD_DIR) | \ + $(U_BOOT_BUILD_DIR)/tools/mkenvimage -p 0x0 \
> + $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> + -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> + -o $(U_BOOT_BUILD_DIR)/u-boot-env.img -
This way of calling scripts/get_default_envs.sh is possible since U-Boot
v2018.03-rc3, it will probably fail with older U-Boot. We allow arbitrary U-
Boot versions with this package and can not easily test on that. Nevertheless
I would keep it in, but add a hint in the menu on this requirement. Users with
older U-Boot can just deactivate it.
With U-Boot v2018.01 this gives:
File 'env_common.o' not found!
The resulting platform-v7a/images/u-boot-env.img is just the checksum and all
zeros then.
The script itself exists since U-Boot v2016.11-rc2, but without support for
separate build dir, and it might be broken somewhere in between. Before
v2016.11 we would get such an error:
/bin/bash: /home/adahl/Work/bsp/tt-generic/platform-v7a/build-target/u-
boot-2016.09.01/scripts/get_default_envs.sh: No such file or directory
The resulting platform-v7a/images/u-boot-env.img is also just the checksum and
all zeros then.
I'm not sure if we can bail out here or just add something to the help text?
Maybe add it to the prompt?
> +endif
> +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> + $(U_BOOT_BUILD_DIR)/tools/mkenvimage -p 0x0 \
Why -p 0x0? What's the benefit over stuffing with 0xFF by default?
> + $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> + -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> + -o $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> + $(PTXDIST_WORKSPACE)/$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE)
I'm not sure about that path. I would put my input file to e.g. [workspace]/
configs/platform-v7a/env_source.config and use of PTXDIST_PLATFORMCONFIGDIR is
not possible this way. I would have to set
PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE it like this:
configs/platform-${PTXCONF_PLATFORM}/my-env-source.config
besides: I had a similar problem with dts files and layers. You can not use
the macros from the make files in those config variables for automatically
locating that in lower layers. :-/
Anyways, if I set it to a working path, it works.
You might add a make dependency on the input file however, so the stage gets
rebuild automatically if the custom env input changes?
> endif
> @$(call touch)
>
> @@ -147,6 +161,14 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL
> @install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-with-spl-pbl.bin \
> $(IMAGEDIR)/u-boot-with-spl-pbl.bin
> endif
> +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> + @install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-env.img \
> + $(IMAGEDIR)/u-boot-env.img
> +endif
> +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> + @install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> + $(IMAGEDIR)/u-boot-custom-env.img
> +endif
>
> ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
> @$(call install_init, u-boot)
Removing those images in clean stage is missing.
Greets
Alex
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ptxdist] [PATCH v3] u-boot: generate environment image
2019-11-20 8:10 ` Alexander Dahl
@ 2019-11-22 13:31 ` Bruno Thomsen
2019-11-22 14:14 ` Michael Olbrich
0 siblings, 1 reply; 5+ messages in thread
From: Bruno Thomsen @ 2019-11-22 13:31 UTC (permalink / raw)
To: Alexander Dahl; +Cc: Denis OSTERLAND, ptxdist, bth
Hi Alexander,
> thanks for your effort. I guess some folks have custom rules for generating
> env images, so do we. It's good to have a common approach for ordinary use
> cases to prevent reinventing the wheel. I have some remarks however, see
> below. ;-)
Thanks for review.
We just realized that around 75% of our rules was custom but not
project specific
in any way. So we might as well upstream them if possible :)
> > +config U_BOOT_ENV_IMAGE_SIZE
> > + prompt "Environment image size"
> > + string
> > + default "0x2000"
> > + help
> > + Enter the U-Boot environment size for generation of image.
> > + Size can be prefixed with 0x for hexadecimal values.
> > + Must match size defined in target config and "/etc/fw_env.config".
>
> Kconfig knows the type "hex" which you could use here. It would prevent
> invalid user input.
Ok, will fix in next version.
> > +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> > + $(U_BOOT_MAKE_ENV) $(U_BOOT_DIR)/scripts/get_default_envs.sh
> > $(U_BOOT_BUILD_DIR) | \ + $(U_BOOT_BUILD_DIR)/tools/mkenvimage -p 0x0 \
> > + $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> > + -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> > + -o $(U_BOOT_BUILD_DIR)/u-boot-env.img -
>
> This way of calling scripts/get_default_envs.sh is possible since U-Boot
> v2018.03-rc3, it will probably fail with older U-Boot. We allow arbitrary U-
> Boot versions with this package and can not easily test on that. Nevertheless
> I would keep it in, but add a hint in the menu on this requirement. Users with
> older U-Boot can just deactivate it.
>
> With U-Boot v2018.01 this gives:
>
> File 'env_common.o' not found!
>
> The resulting platform-v7a/images/u-boot-env.img is just the checksum and all
> zeros then.
>
> The script itself exists since U-Boot v2016.11-rc2, but without support for
> separate build dir, and it might be broken somewhere in between. Before
> v2016.11 we would get such an error:
>
> /bin/bash: /home/adahl/Work/bsp/tt-generic/platform-v7a/build-target/u-
> boot-2016.09.01/scripts/get_default_envs.sh: No such file or directory
>
> The resulting platform-v7a/images/u-boot-env.img is also just the checksum and
> all zeros then.
>
> I'm not sure if we can bail out here or just add something to the help text?
> Maybe add it to the prompt?
I will update help to reflect this limitation using final version as shipping
with release candidates is just bad practice(tm) ;)
Running an old version of U-Boot has many limitation like poor support of new
gcc versions and boards not using Kconfig. So don't enable this option if you
use an ancient U-Boot version. Evolution has to continue.
>
> > +endif
> > +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> > + $(U_BOOT_BUILD_DIR)/tools/mkenvimage -p 0x0 \
>
> Why -p 0x0? What's the benefit over stuffing with 0xFF by default?
U-boot run-time will by default pad with 0x00 and mkenvimage pad with
0xFF by default. U-boot does not care what pad is used.
So it was just to mimic what normal U-boot run-time does, but we can use
default.
>
> > + $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> > + -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> > + -o $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> > + $(PTXDIST_WORKSPACE)/$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE)
>
> I'm not sure about that path. I would put my input file to e.g. [workspace]/
> configs/platform-v7a/env_source.config and use of PTXDIST_PLATFORMCONFIGDIR is
> not possible this way. I would have to set
> PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE it like this:
>
> configs/platform-${PTXCONF_PLATFORM}/my-env-source.config
>
> besides: I had a similar problem with dts files and layers. You can not use
> the macros from the make files in those config variables for automatically
> locating that in lower layers. :-/
>
> Anyways, if I set it to a working path, it works.
>
> You might add a make dependency on the input file however, so the stage gets
> rebuild automatically if the custom env input changes?
>
Okay, rebuild in case of source file changes and move it to platformconfigdir,
so it's stored next to the kernel configuration.
Have not tested the below section with ptxdist layers, but seems to work
in my setup without layers. According to docs[1] it should search from top
layer and down.
ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
U_BOOT_CUSTOM_ENV_SRC := $(call ptx/in-platformconfigdir, \
$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE))
$(STATEDIR)/u-boot.compile: $(call remove_quotes, $(U_BOOT_CUSTOM_ENV_SRC))
endif
> > +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> > + @install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-env.img \
> > + $(IMAGEDIR)/u-boot-env.img
> > +endif
> > +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> > + @install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> > + $(IMAGEDIR)/u-boot-custom-env.img
> > +endif
> >
> > ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
> > @$(call install_init, u-boot)
>
> Removing those images in clean stage is missing.
Yes, I will add them to cleanup including a missing cleanup of imx dtb image.
/Bruno
[1] https://www.ptxdist.org/doc/dev_manual.html#writing-layer-aware-rules
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ptxdist] [PATCH v3] u-boot: generate environment image
2019-11-22 13:31 ` Bruno Thomsen
@ 2019-11-22 14:14 ` Michael Olbrich
2019-11-22 15:49 ` Bruno Thomsen
0 siblings, 1 reply; 5+ messages in thread
From: Michael Olbrich @ 2019-11-22 14:14 UTC (permalink / raw)
To: ptxdist
Hi,
On Fri, Nov 22, 2019 at 02:31:30PM +0100, Bruno Thomsen wrote:
> > thanks for your effort. I guess some folks have custom rules for generating
> > env images, so do we. It's good to have a common approach for ordinary use
> > cases to prevent reinventing the wheel. I have some remarks however, see
> > below. ;-)
>
> Thanks for review.
>
> We just realized that around 75% of our rules was custom but not
> project specific
> in any way. So we might as well upstream them if possible :)
My Thanks to both of you for working on this. I don't use u-boot, so I can
only comment on the PTXdist stuff. So having someone else to review this is
great.
> > > +config U_BOOT_ENV_IMAGE_SIZE
> > > + prompt "Environment image size"
> > > + string
> > > + default "0x2000"
> > > + help
> > > + Enter the U-Boot environment size for generation of image.
> > > + Size can be prefixed with 0x for hexadecimal values.
> > > + Must match size defined in target config and "/etc/fw_env.config".
> >
> > Kconfig knows the type "hex" which you could use here. It would prevent
> > invalid user input.
>
> Ok, will fix in next version.
>
> > > +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> > > + $(U_BOOT_MAKE_ENV) $(U_BOOT_DIR)/scripts/get_default_envs.sh
> > > $(U_BOOT_BUILD_DIR) | \ + $(U_BOOT_BUILD_DIR)/tools/mkenvimage -p 0x0 \
> > > + $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> > > + -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> > > + -o $(U_BOOT_BUILD_DIR)/u-boot-env.img -
> >
> > This way of calling scripts/get_default_envs.sh is possible since U-Boot
> > v2018.03-rc3, it will probably fail with older U-Boot. We allow arbitrary U-
> > Boot versions with this package and can not easily test on that. Nevertheless
> > I would keep it in, but add a hint in the menu on this requirement. Users with
> > older U-Boot can just deactivate it.
> >
> > With U-Boot v2018.01 this gives:
> >
> > File 'env_common.o' not found!
> >
> > The resulting platform-v7a/images/u-boot-env.img is just the checksum and all
> > zeros then.
> >
> > The script itself exists since U-Boot v2016.11-rc2, but without support for
> > separate build dir, and it might be broken somewhere in between. Before
> > v2016.11 we would get such an error:
> >
> > /bin/bash: /home/adahl/Work/bsp/tt-generic/platform-v7a/build-target/u-
> > boot-2016.09.01/scripts/get_default_envs.sh: No such file or directory
> >
> > The resulting platform-v7a/images/u-boot-env.img is also just the checksum and
> > all zeros then.
> >
> > I'm not sure if we can bail out here or just add something to the help text?
> > Maybe add it to the prompt?
>
> I will update help to reflect this limitation using final version as shipping
> with release candidates is just bad practice(tm) ;)
>
> Running an old version of U-Boot has many limitation like poor support of new
> gcc versions and boards not using Kconfig. So don't enable this option if you
> use an ancient U-Boot version. Evolution has to continue.
>
> >
> > > +endif
> > > +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> > > + $(U_BOOT_BUILD_DIR)/tools/mkenvimage -p 0x0 \
> >
> > Why -p 0x0? What's the benefit over stuffing with 0xFF by default?
>
> U-boot run-time will by default pad with 0x00 and mkenvimage pad with
> 0xFF by default. U-boot does not care what pad is used.
> So it was just to mimic what normal U-boot run-time does, but we can use
> default.
>
> >
> > > + $(call ptx/ifdef,PTXCONF_U_BOOT_ENV_IMAGE_REDUNDANT,-r,) \
> > > + -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
> > > + -o $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> > > + $(PTXDIST_WORKSPACE)/$(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE)
> >
> > I'm not sure about that path. I would put my input file to e.g. [workspace]/
> > configs/platform-v7a/env_source.config and use of PTXDIST_PLATFORMCONFIGDIR is
> > not possible this way. I would have to set
> > PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE it like this:
> >
> > configs/platform-${PTXCONF_PLATFORM}/my-env-source.config
> >
> > besides: I had a similar problem with dts files and layers. You can not use
> > the macros from the make files in those config variables for automatically
> > locating that in lower layers. :-/
> >
> > Anyways, if I set it to a working path, it works.
> >
> > You might add a make dependency on the input file however, so the stage gets
> > rebuild automatically if the custom env input changes?
> >
>
> Okay, rebuild in case of source file changes and move it to platformconfigdir,
> so it's stored next to the kernel configuration.
>
> Have not tested the below section with ptxdist layers, but seems to work
> in my setup without layers. According to docs[1] it should search from top
> layer and down.
>
> ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> U_BOOT_CUSTOM_ENV_SRC := $(call ptx/in-platformconfigdir, \
> $(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE))
You need the remove_quotes here for PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE.
Other than that, this should work correctly with layers.
> $(STATEDIR)/u-boot.compile: $(call remove_quotes, $(U_BOOT_CUSTOM_ENV_SRC))
No need for remove_quotes here.
Michael
> endif
>
> > > +ifdef PTXCONF_U_BOOT_DEFAULT_ENV_IMAGE
> > > + @install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-env.img \
> > > + $(IMAGEDIR)/u-boot-env.img
> > > +endif
> > > +ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> > > + @install -v -D -m644 $(U_BOOT_BUILD_DIR)/u-boot-custom-env.img \
> > > + $(IMAGEDIR)/u-boot-custom-env.img
> > > +endif
> > >
> > > ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
> > > @$(call install_init, u-boot)
> >
> > Removing those images in clean stage is missing.
>
> Yes, I will add them to cleanup including a missing cleanup of imx dtb image.
>
> /Bruno
>
> [1] https://www.ptxdist.org/doc/dev_manual.html#writing-layer-aware-rules
>
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ptxdist] [PATCH v3] u-boot: generate environment image
2019-11-22 14:14 ` Michael Olbrich
@ 2019-11-22 15:49 ` Bruno Thomsen
0 siblings, 0 replies; 5+ messages in thread
From: Bruno Thomsen @ 2019-11-22 15:49 UTC (permalink / raw)
To: ptxdist
Ups, version 4 was send before I saw your email.
> > ifdef PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE
> > U_BOOT_CUSTOM_ENV_SRC := $(call ptx/in-platformconfigdir, \
> > $(PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE))
>
> You need the remove_quotes here for PTXCONF_U_BOOT_CUSTOM_ENV_IMAGE_SOURCE.
> Other than that, this should work correctly with layers.
>
> > $(STATEDIR)/u-boot.compile: $(call remove_quotes, $(U_BOOT_CUSTOM_ENV_SRC))
>
> No need for remove_quotes here.
Okay, thanks for input Michael.
I will update the patch Monday.
/Bruno
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-11-22 15:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 16:40 [ptxdist] [PATCH v3] u-boot: generate environment image Bruno Thomsen
2019-11-20 8:10 ` Alexander Dahl
2019-11-22 13:31 ` Bruno Thomsen
2019-11-22 14:14 ` Michael Olbrich
2019-11-22 15:49 ` Bruno Thomsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox