uboot:覆盖mmcboot环境变量不起作用

时间:2018-07-12 09:33:59

标签: 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

1 个答案:

答案 0 :(得分:0)

无需弄乱编码。使用

make menuconfig

搜索 CONFIG_BOOTCOMMAND 并编辑值。