【问题标题】:how source and bootm commands are enabled in u-boot?如何在 u-boot 中启用 source 和 bootm 命令?
【发布时间】:2016-03-15 10:02:06
【问题描述】:

以下是 U-Boot 代码中的文件 common/Makefile 部分。

obj-$(CONFIG_SOURCE) += cmd_source.o
obj-$(CONFIG_CMD_SOURCE) += cmd_source.o

我浏览了 U-Boot 代码,但找不到在任何地方定义的这两个宏。但是,此命令在 U-Boot 运行时可用。
这个宏是在哪里定义的?

bootm 命令也是如此,它在运行时也可用,但我无法找到宏的定义位置。如果有人知道,请告诉我。

【问题讨论】:

  • 我在common 文件夹中有cmd_source.c。我将Yocto 用于i.mx6
  • 是的,我也有。但是要编译该文件,应该在某处定义 CONFIG_CMD_SOURCE,我的问题是在哪里定义?
  • include/configs/your_board_support.h
  • 不存在这就是我在这里问的原因。
  • 我没有得到你。例如:对于at91 Atmlel SoC,您可以在/include/configs/at91sam9rlek.h 中看到它。顺便说一句,使用您的控制台,在 configs 文件夹中,输入:grep -rnw --color . -e "CONFIG_CMD_SOURCE"

标签: c linux u-boot


【解决方案1】:

这取决于你的 u-boot的构建配置系统。

  1. 如果它是 Pre-kconfig 配置系统 [1],则可以在以下可能位置之一找到这些宏(或定义这些宏的位置/文件):
    • 包括/config.mk
    • include/config.h
    • arch/${ARCH}/include/asm/arc
    • boards.cfg

make 后的值可以在 autoconf.mk 中找到。
例如,这里是我的 'pre-kconfig' u-boot 目录中 grep 的结果(板名已删除):



    /u-boot-dir$ egrep -rnsH "CONFIG_CMD_SOURCE|CONFIG_SOURCE" *
    //snip...

    ./include/autoconf.mk:3:CONFIG_CMD_SOURCE=y
    ./include/config_cmd_default.h:49:#define CONFIG_CMD_SOURCE /*
    ./include/configs/board1.h:109:#undef CONFIG_CMD_SOURCE
    ./include/configs/board2_common.h:135:#define CONFIG_CMD_SOURCE
    ./include/config_cmd_all.h:32:#define CONFIG_CMD_SOURCE /* "source" command support */

    //snap...
    /u-boot-dir$

  1. 如果是基于 KConfig 的配置系统 [1],则可以在 configs/<board>_defconfig 文件中找到定义。

    例如,下面是来自最新 u-boot 源的 grep 的结果:


    $ git clone git://git.denx.de/u-boot.git
    Cloning into 'u-boot'...
    Resolving deltas: 100% (305309/305309), done.
    $ cd u-boot/
    /u-boot$ egrep -rnsH "CMD_SOURCE"
    //snip...

    cmd/source.c:145:#if defined(CONFIG_CMD_SOURCE)
    cmd/Makefile:20:obj-$(CONFIG_CMD_SOURCE) += source.o
    cmd/Kconfig:384:config CMD_SOURCE
    configs/at91sam9g10ek_dataflash_cs3_defconfig:11:# CONFIG_CMD_SOURCE is not set
    configs/vct_premium_small_defconfig:13:# CONFIG_CMD_SOURCE is not set
    configs/ap_sh4a_4a_defconfig:17:# CONFIG_CMD_SOURCE is not set
    configs/at91sam9g20ek_dataflash_cs0_defconfig:11:# CONFIG_CMD_SOURCE is not set

    //snap...
    /u-boot$ 


参考 [1]:http://www.denx.de/wiki/pub/U-Boot/MiniSummitELCE2014/uboot2014_kconfig.pdf的第12页和第13页

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-09-10
    • 1970-01-01
    • 1970-01-01
    • 2016-07-02
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    相关资源
    最近更新 更多