diff mbox series

[1/1] boot/uboot: add support for u-boot-initial-env install

Message ID 20230911061940.2392419-1-james.hilliard1@gmail.com
State Accepted
Headers show
Series [1/1] boot/uboot: add support for u-boot-initial-env install | expand

Commit Message

James Hilliard Sept. 11, 2023, 6:19 a.m. UTC
This file is needed by libubootenv for fw_printenv/fw_setenv and
library API's to function when the environment is empty.

See details:
https://github.com/sbabic/libubootenv/tree/v0.3.4#replacement-old-tools

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 boot/uboot/Config.in | 7 +++++++
 boot/uboot/uboot.mk  | 8 ++++++++
 2 files changed, 15 insertions(+)

Comments

Andreas Naumann March 15, 2024, 10:38 a.m. UTC | #1
Hi James, all,


Am 11.09.23 um 08:19 schrieb James Hilliard:
> This file is needed by libubootenv for fw_printenv/fw_setenv and
> library API's to function when the environment is empty.
> 
> See details:
> https://github.com/sbabic/libubootenv/tree/v0.3.4#replacement-old-tools
> 
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>   boot/uboot/Config.in | 7 +++++++
>   boot/uboot/uboot.mk  | 8 ++++++++
>   2 files changed, 15 insertions(+)

Another solution could be to automatically install it if libubootenv is
selected. But that might be a bit unforeseable magic. Not sure if this
is wanted.
To me it's good as is.

Reviewed-by: Andreas Naumann <anaumann@ultratronik.de>
Tested-by: Andreas Naumann <anaumann@ultratronik.de>
[compile-time tested with wandboard_defconfig]


> 
> diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
> index 21f19db890..d7f2912ebc 100644
> --- a/boot/uboot/Config.in
> +++ b/boot/uboot/Config.in
> @@ -506,6 +506,13 @@ config BR2_TARGET_UBOOT_SPL_NAME
>   	  and TPL name is tpl/u-boot-tpl.bin but not always. SPL name is
>   	  MLO on OMAP and SPL on i.MX6 for example.
>   
> +config BR2_TARGET_UBOOT_INITIAL_ENV
> +	bool "Install u-boot-initial-env"
> +	help
> +	  Install the U-Boot u-boot-initial-env on the target.
> +
> +	  This file is typically required by libubootenv.
> +
>   config BR2_TARGET_UBOOT_ZYNQMP
>   	bool "Boot on the Xilinx ZynqMP SoCs"
>   	depends on BR2_aarch64
> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
> index dda606a880..491f654cec 100644
> --- a/boot/uboot/uboot.mk
> +++ b/boot/uboot/uboot.mk
> @@ -138,6 +138,14 @@ UBOOT_MAKE_TARGET += u-boot.stm32
>   endif
>   endif
>   
> +ifeq ($(BR2_TARGET_UBOOT_INITIAL_ENV),y)
> +UBOOT_MAKE_TARGET += u-boot-initial-env
> +define UBOOT_INSTALL_UBOOT_INITIAL_ENV
> +	$(INSTALL) -D -m 0644 $(@D)/u-boot-initial-env $(TARGET_DIR)/etc/u-boot-initial-env
> +endef
> +UBOOT_POST_INSTALL_TARGET_HOOKS += UBOOT_INSTALL_UBOOT_INITIAL_ENV
> +endif
> +
>   ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
>   UBOOT_BINS += $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
>   endif
James Hilliard March 15, 2024, 7:37 p.m. UTC | #2
On Fri, Mar 15, 2024 at 4:38 AM Andreas Naumann <dev@andin.de> wrote:
>
> Hi James, all,
>
>
> Am 11.09.23 um 08:19 schrieb James Hilliard:
> > This file is needed by libubootenv for fw_printenv/fw_setenv and
> > library API's to function when the environment is empty.
> >
> > See details:
> > https://github.com/sbabic/libubootenv/tree/v0.3.4#replacement-old-tools
> >
> > Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> > ---
> >   boot/uboot/Config.in | 7 +++++++
> >   boot/uboot/uboot.mk  | 8 ++++++++
> >   2 files changed, 15 insertions(+)
>
> Another solution could be to automatically install it if libubootenv is
> selected. But that might be a bit unforeseable magic. Not sure if this
> is wanted.
> To me it's good as is.

Yeah, I figured it was a better idea to just keep it separate for now in case
someone is generating u-boot-initial-env out of tree or some other way.

>
> Reviewed-by: Andreas Naumann <anaumann@ultratronik.de>
> Tested-by: Andreas Naumann <anaumann@ultratronik.de>
> [compile-time tested with wandboard_defconfig]
>
>
> >
> > diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
> > index 21f19db890..d7f2912ebc 100644
> > --- a/boot/uboot/Config.in
> > +++ b/boot/uboot/Config.in
> > @@ -506,6 +506,13 @@ config BR2_TARGET_UBOOT_SPL_NAME
> >         and TPL name is tpl/u-boot-tpl.bin but not always. SPL name is
> >         MLO on OMAP and SPL on i.MX6 for example.
> >
> > +config BR2_TARGET_UBOOT_INITIAL_ENV
> > +     bool "Install u-boot-initial-env"
> > +     help
> > +       Install the U-Boot u-boot-initial-env on the target.
> > +
> > +       This file is typically required by libubootenv.
> > +
> >   config BR2_TARGET_UBOOT_ZYNQMP
> >       bool "Boot on the Xilinx ZynqMP SoCs"
> >       depends on BR2_aarch64
> > diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
> > index dda606a880..491f654cec 100644
> > --- a/boot/uboot/uboot.mk
> > +++ b/boot/uboot/uboot.mk
> > @@ -138,6 +138,14 @@ UBOOT_MAKE_TARGET += u-boot.stm32
> >   endif
> >   endif
> >
> > +ifeq ($(BR2_TARGET_UBOOT_INITIAL_ENV),y)
> > +UBOOT_MAKE_TARGET += u-boot-initial-env
> > +define UBOOT_INSTALL_UBOOT_INITIAL_ENV
> > +     $(INSTALL) -D -m 0644 $(@D)/u-boot-initial-env $(TARGET_DIR)/etc/u-boot-initial-env
> > +endef
> > +UBOOT_POST_INSTALL_TARGET_HOOKS += UBOOT_INSTALL_UBOOT_INITIAL_ENV
> > +endif
> > +
> >   ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
> >   UBOOT_BINS += $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
> >   endif
Thomas Petazzoni April 3, 2024, 7:57 p.m. UTC | #3
On Mon, 11 Sep 2023 00:19:40 -0600
James Hilliard <james.hilliard1@gmail.com> wrote:

> This file is needed by libubootenv for fw_printenv/fw_setenv and
> library API's to function when the environment is empty.
> 
> See details:
> https://github.com/sbabic/libubootenv/tree/v0.3.4#replacement-old-tools
> 
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>  boot/uboot/Config.in | 7 +++++++
>  boot/uboot/uboot.mk  | 8 ++++++++
>  2 files changed, 15 insertions(+)

Applied to master, thanks.

Thomas
diff mbox series

Patch

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index 21f19db890..d7f2912ebc 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -506,6 +506,13 @@  config BR2_TARGET_UBOOT_SPL_NAME
 	  and TPL name is tpl/u-boot-tpl.bin but not always. SPL name is
 	  MLO on OMAP and SPL on i.MX6 for example.
 
+config BR2_TARGET_UBOOT_INITIAL_ENV
+	bool "Install u-boot-initial-env"
+	help
+	  Install the U-Boot u-boot-initial-env on the target.
+
+	  This file is typically required by libubootenv.
+
 config BR2_TARGET_UBOOT_ZYNQMP
 	bool "Boot on the Xilinx ZynqMP SoCs"
 	depends on BR2_aarch64
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index dda606a880..491f654cec 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -138,6 +138,14 @@  UBOOT_MAKE_TARGET += u-boot.stm32
 endif
 endif
 
+ifeq ($(BR2_TARGET_UBOOT_INITIAL_ENV),y)
+UBOOT_MAKE_TARGET += u-boot-initial-env
+define UBOOT_INSTALL_UBOOT_INITIAL_ENV
+	$(INSTALL) -D -m 0644 $(@D)/u-boot-initial-env $(TARGET_DIR)/etc/u-boot-initial-env
+endef
+UBOOT_POST_INSTALL_TARGET_HOOKS += UBOOT_INSTALL_UBOOT_INITIAL_ENV
+endif
+
 ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
 UBOOT_BINS += $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
 endif