The u-boot configuration for the ultra96-zynqmp is shared with a bunch of
boards. As such, several of the settings wrt the environment do not make sense
(such as trying to save the environment to devices which do not exist on the
ultra96).

Add the ability to read/set environment variables from Linux user-space.

Signed-off-by: Trevor Woerner <[email protected]>
---
 .../u-boot/u-boot-v2023.01/env-cleanup.cfg    |  4 +++
 .../recipes-bsp/u-boot/u-boot-xlnx-2023.2.inc | 26 +++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 
meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2023.01/env-cleanup.cfg

diff --git 
a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2023.01/env-cleanup.cfg 
b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2023.01/env-cleanup.cfg
new file mode 100644
index 000000000000..1bcb1208b083
--- /dev/null
+++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2023.01/env-cleanup.cfg
@@ -0,0 +1,4 @@
+CONFIG_ENV_IS_NOWHERE=n
+CONFIG_ENV_IS_IN_NAND=n
+CONFIG_ENV_IS_IN_SPI_FLASH=n
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=n
diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2023.2.inc 
b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2023.2.inc
index 86ba82bbeaf8..a220fe52a0ae 100644
--- a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2023.2.inc
+++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2023.2.inc
@@ -13,11 +13,37 @@ HAS_PLATFORM_INIT ?= " \
                "
 
 DEPENDS += "bc-native dtc-native python3-setuptools-native gnutls-native"
+DEPENDS:ultra96-zynqmp += " u-boot-mkenvimage-native bison-native 
kern-tools-native"
 
 SRC_URI:append:microblaze = " file://microblaze-generic-top.h"
+SRC_URI:append:ultra96-zynqmp = " file://env-cleanup.cfg"
 
 FILESEXTRAPATHS:prepend := "${THISDIR}/u-boot-v2023.01:"
 
 do_configure:prepend:microblaze () {
     install ${WORKDIR}/microblaze-generic-top.h ${S}/include/configs/
 }
+
+generate_env_config() {
+       :
+}
+
+generate_env_config:ultra96-zynqmp() {
+       UBOOT_ENV_SIZE="$(cat ${B}/.config | grep "^CONFIG_ENV_SIZE=" | cut 
-d'=' -f2)"
+       if [ -n "$UBOOT_ENV_SIZE" ]; then
+               echo "/boot/uboot.env 0 ${UBOOT_ENV_SIZE}" > 
${UNPACKDIR}/fw_env.config
+       fi
+       if [ -f ${B}/u-boot-initial-env ]; then
+               mkenvimage -s ${UBOOT_ENV_SIZE} ${B}/u-boot-initial-env -o 
${B}/uboot.env
+       else
+               return 1
+       fi
+}
+
+do_compile[postfuncs] += "generate_env_config"
+
+do_install:append:ultra96-zynqmp() {
+       install -D -m 0644 ${B}/uboot.env ${D}/boot/uboot.env
+}
+
+FILES:${PN}-env += "/boot/uboot.env"
-- 
2.44.0.478.g7774cfed6261

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#5358): 
https://lists.yoctoproject.org/g/meta-xilinx/message/5358
Mute This Topic: https://lists.yoctoproject.org/mt/106374665/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-xilinx/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to