linux - uboot : Overwrite mmcboot environment variable not working

标签 linux linux-kernel u-boot

我试图覆盖 uboot bootcmd 环境变量,但它继续使用默认设置。我知道我可以在 uboot 提示符中设置它,它将永久保存,但我希望能够通过代码自动设置它。

在我的主板配置文件中

#include <config_distro_bootcmd.h>

#ifdef CONFIG_BOOTCOMMAND
#undef CONFIG_BOOTCOMMAND
#endif
#define CONFIG_BOOTCOMMAND \
        "echo hello world; " \

但是当我启动 uboot 并 printenv mmcboot 时,默认值集已配置:

    => printenv mmcboot
    mmcboot=mmc dev ${mmcdev}; setenv devnum ${mmcdev}; setenv devtype mmc; 
    if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadimage; 
    then if test ${boot_fit} -eq 1; then run loadfit; else run mmcloados;fi;fi;fi;
    =>

如果在 defconfig 文件中设置 CONFIG_DISTRO_DEFAULTS=n 我会收到编译错误。

include/config_distro_bootcmd.h:314:2: error: expected '}' before 'BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE'
  BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
  ^
include/config_distro_bootcmd.h:314:2: note: in definition of macro 'BOOTENV_DEV_NAME_PXE'
  BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/configs/am335x_p230.h:101:2: note: in expansion of macro 'BOOTENV_DEV_NAME'
  func(PXE, pxe, na) \
  ^~~~
include/config_distro_bootcmd.h:320:18: note: in expansion of macro 'BOOT_TARGET_DEVICES'
  "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
                  ^~~~~~~~~~~~~~~~~~~
include/config_distro_bootcmd.h:337:2: note: in expansion of macro 'BOOTENV_BOOT_TARGETS'
  BOOTENV_BOOT_TARGETS \
  ^~~~~~~~~~~~~~~~~~~~
include/configs/am335x_p230.h:208:2: note: in expansion of macro 'BOOTENV'
  BOOTENV
  ^~~~~~~
include/env_default.h:108:2: note: in expansion of macro 'CONFIG_EXTRA_ENV_SETTINGS'
  CONFIG_EXTRA_ENV_SETTINGS

最佳答案

无需费力编码。使用

make menuconfig

搜索CONFIG_BOOTCOMMAND并编辑值。

关于linux - uboot : Overwrite mmcboot environment variable not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51302105/

相关文章:

c - 在用户空间应用程序中使用自旋锁

linux - 获取用于Linux PXE引导的其他配置文件

c - 为什么 rand() 在 Linux 上比 Mac 更频繁地重复数字?

linux - 使用 Vagrant shell provisioner 安装 NodeJS 不工作

c - Xorg 中的全屏窗口不会导致键盘事件

c - 在c程序中,当主线程终止时,整个进程是否终止?

linux - 为什么在Linux内核中close函数在 `struct file_operations`调用release?

linux - mmc写命令数据源从哪里来?

linux - 如何更改 DTS U-boot 中的 UART 引脚?

linux - 我如何计算 shell 脚本 linux bash 中有多少个挂起的进程