1.在srcdir/common/目录下建立一个新的命令文件 new_command.c
#include <common.h>
#include <watchdog.h>
#include <command.h>
#include <image.h>
#include <malloc.h>
#include <u-boot/zlib.h>
#include <bzlib.h>
#include <environment.h>
#include <lmb.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
int do_new_command (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
//要实现的功能
}
//相当于注册该函数
U_BOOT_CMD(
new_command, CONFIG_SYS_MAXARGS, 1, do_new_command,
"short-usage",
" long helop..."
);
2.在srcdir/common/Makefile中加入COBJS-y +=new_command.o
3.重新编译。