gpt4 book ai didi

c - 如何在 u-boot 中启用 source 和 bootm 命令?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:47:00 26 4
gpt4 key购买 nike

U-Boot代码中common/Makefile文件部分如下。

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

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

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

最佳答案

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

  1. 如果它是 Pre-kconfig 配置系统 [1],这些宏(或定义这些宏的位置/文件)可以在这些可能的位置之一找到:
    • include/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]:第 12 页和第 13 页 http://www.denx.de/wiki/pub/U-Boot/MiniSummitELCE2014/uboot2014_kconfig.pdf

关于c - 如何在 u-boot 中启用 source 和 bootm 命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36008035/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com