使用 buildroot 自定义 u-boot 环境变量

Custom u-boot environment variables using buildroot

如何使用 buildroot 作为 os 构建系统向 u-boot 添加一组新的自定义环境变量?

我尝试使用外部树补丁来修补 include/configs/rpi.h 以添加新变量,但 kconfig 变得脾气暴躁(抱怨后显示补丁):

The following new ad-hoc CONFIG options were detected:
CONFIG_XXXXXX_ENV_SETTINGS

Please add these via Kconfig instead. Find a suitable Kconfig
file and add a 'config' or 'menuconfig' option.
Makefile:871: recipe for target 'all' failed



--- a/include/configs/rpi.h 2018-03-13 12:02:19.000000000 +0000
+++ b/include/configs/rpi.h 2018-11-19 12:32:15.728000000 +0000
@@ -140,0 +141,7 @@
+#define CONFIG_XXXXXX_ENV_SETTINGS \
+   "newboard=true" \
+   "hasFailedBoot=false" \
+   "hasFailedBootCount=0" \
+   "maximumFailedBootCount=3"  
+
+
@@ -145 +152,2 @@
-   BOOTENV
+   BOOTENV \
+   CONFIG_XXXXXX_ENV_SETTINGS

我可以使用 uboot-menuconfig 来设置 u-boot 特定的东西,但我不确定如何创建环境变量

您可以在 uboot-menuconfig 中设置 CONFIG_USE_DEFAULT_ENV_FILE 并将其指向包含完整默认环境的文件。

由于您使用 Buildroot,请不要忘记通过更改其位置(Buildroot 选项 BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE)和 运行 make uboot-update-defconfig.[=13 来保存修改后的 U-Boot 配置=]