在include/configs/unsp2440.h中增加一项
#define CONFIG_CMD_HELLOWORD 1
第二步:添加实现
在common/文件夹下建立helloword.c
#include <common.h>
#include <command.h>
#ifdef CONFIG_CMD_HELLOWORLD
void helloword (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
printf("hello world by wenhao! \n");
}
U_BOOT_CMD(hello,3,2,helloword,
"hello command","wenhao add hello command!\n");
#endif
第三步:修改Makefile
在common/Makefile中增加一项.
COBJS-y += helloworld.o
第四步:编译
make unsp2440_config
make