Jagdish
Jagdish

Reputation: 1924

how source and bootm commands are enabled in u-boot?

Below is the part of file common/Makefile in U-Boot code.

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

I have gone through the U-Boot code but could not find these two macros defined anywhere. However, this command is available in U-Boot at runtime.
Where is this macro defined.?

Same is with bootm command, It is also available at run time but I'm not able to find where the macro is defined. If someone is aware about it please let me know.

Upvotes: 1

Views: 973

Answers (1)

Ashwini Singh
Ashwini Singh

Reputation: 127

It depends on build-configuration system of your u-boot.

  1. If it's a Pre-kconfig Configuration System [1], these macros (or location/files where these macros are defined) can be found at one of these possible locations:
    • include/config.mk
    • include/config.h
    • arch/${ARCH}/include/asm/arc
    • boards.cfg

After make, it's value can be found in autoconf.mk.
For example, here's a result of grep in on my 'pre-kconfig' u-boot directory (board names removed):



    /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. If it's a KConfig based configuration system [1], the the definitions can be found in configs/<board>_defconfig files.

    For example, here's a result of grep from latest u-boot source:


    $ 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$ 


reference [1]: page-12 and 13 of http://www.denx.de/wiki/pub/U-Boot/MiniSummitELCE2014/uboot2014_kconfig.pdf

Upvotes: 1

Related Questions