I want to add custom command command to u-boot
be it a simple hello world command.
After searching I found this link Yocto u-boot Custom Commands where it s
U-boot comes with a lot of stock commands which one can run on the u-boot console similar to the Linux console commands like 'ls'. The source for every command can be found under 'common/' directory with file names starting with 'cmd_'. However, not all commands are enabled by default.
From the code, you can open 'common/Makefile' and under the '# command' section you can find the list of all the commands masked with config flags 'CONFIG_*'. To enable a command, you have to simply #define the corresponding flag under the 'include/configs/.h' file and build the source. Now, you can see the command in the list of commands by running 'help'.
To enable a command 'source', in the 'common/Makefile', you can find
obj-$(CONFIG_CMD_SOURCE) += cmd_source.o
Simply include the corresponding flag in 'include/configs/.h' file as follows
obj-y += cmd_source.o
refer :http://studyzone.dgpride.com/2016/11/u-boot-how-to-add-new-command-to-u-boot.html