我正在尝试覆盖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并编辑该值。

10-08 00:00