Skip to contentSkip to conversation

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

PATCH Applied James Hilliard 3 participants 4 messages Sep 11, 2023 – Apr 3, 2024

lore
Share & tools
lore
#0 lore raw

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

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

---
 boot/uboot/Config.in | 7 +++++++
 boot/uboot/uboot.mk  | 8 ++++++++
 2 files changed, 15 insertions(+)
boot/uboot/Config.in +7 -0
index 21f19db890..d7f2912ebc 100644
@@ -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
boot/uboot/uboot.mk +8 -0
index dda606a880..491f654cec 100644
@@ -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
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by Tested-by on v1 1/1
#1 lore raw

Hi James, all,

Am 11.09.23 um 08:19 schrieb James Hilliard:

Quoted 11 lines

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

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

[compile-time tested with wandboard_defconfig]
Quoted 28 lines
boot/uboot/Config.in +7 -0
index 21f19db890..d7f2912ebc 100644
@@ -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
boot/uboot/uboot.mk +1 -0
index dda606a880..491f654cec 100644
@@ -138,6 +138,14 @@ UBOOT_MAKE_TARGET += u-boot.stm32
  endif
  endif
 
+ifeq ($(BR2_TARGET_UBOOT_INITIAL_ENV),y)

boot/uboot/uboot.mk UBOOT_MAKE_TARGET += u-boot.stm32 · line 151

Quoted 10 lines
boot/uboot/uboot.mk +7 -0
+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

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
Quoted 17 lines · Andreas Naumann

Hi James, all,

Am 11.09.23 um 08:19 schrieb James Hilliard:

Quoted 11 lines

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

---
  boot/uboot/Config.in | 7 +++++++
  boot/uboot/uboot.mk  | 8 ++++++++
  2 files changed, 15 insertions(+)
Quoted 4 lines

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.

Quoted 33 lines
[compile-time tested with wandboard_defconfig]
Quoted 27 lines
boot/uboot/Config.in +7 -0
index 21f19db890..d7f2912ebc 100644
@@ -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
boot/uboot/uboot.mk +0 -0
index dda606a880..491f654cec 100644
@@ -138,6 +138,14 @@ UBOOT_MAKE_TARGET += u-boot.stm32
  endif
  endif
 
Quoted 11 lines

boot/uboot/uboot.mk UBOOT_MAKE_TARGET += u-boot.stm32 · line 151

Quoted 11 lines
boot/uboot/uboot.mk +8 -0
+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

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to James Hilliard
Quoted 11 lines · On Mon, 11 Sep 2023 00:19:40 -0600 James Hilliard <[email protected]>…

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

---
 boot/uboot/Config.in | 7 +++++++
 boot/uboot/uboot.mk  | 8 ++++++++
 2 files changed, 15 insertions(+)

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot