Hello All
I am facing a problem while adding add a new command to u-boot.
Could you please any one can help.
What i followed.
1.i created a file under common folder under u-boot with name cmd_xyz.c
2.i modified makefile in common folder :
COBJS-y += cmd_xyz.o
It was successfully complied and generated objectfile
arm-linux-gcc -g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__
-DTEXT_BASE=0x80e80000
-I/home/alexander/projects/overo/u-boot/u-boot-2009.11/include -fno-builtin
-ffreestanding -nostdinc -isystem
/home/alexander/projects/overo/cross_compile/armv7a/bin/../lib/gcc/arm-angstrom-
linux-gnueabi/4.3.3/include
-pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork
-march=armv5 -Wall -Wstrict-prototypes -fno-stack-protector -o cmd_xyz.o
cmd_xyz.c -c
Static library is creaed in this common folder with name:libcomman.a
arm-linux-ar crv libcommon.a cmd_bdinfo.o cmd_boot.o cmd_bootm.o
cmd_console.o cmd_ext2.o cmd_fat.o cmd_i2c.o cmd_itest.o cmd_jffs2.o
cmd_load.o cmd_mem.o cmd_misc.o cmd_mmc.o cmd_nand.o cmd_net.o cmd_nvedit.o
cmd_pcmcia.o cmd_source.o cmd_spi.o cmd_ximg.o cmd_xyz.o command.o
console.o dlmalloc.o env_common.o env_nand.o exports.o flash.o hush.o
image.o main.o memsize.o s_record.o stdio.o xyzModem.o
cmd_xyz.c file looks like this:
#include <common.h>
#include <command.h>
#include <environment.h>
#include <linux/stddef.h>
#include <malloc.h>
int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong addr, rc=1;
int rcode = 0;
if (argc < 2) {
cmd_usage(cmdtp);
return 1;
}
printf ("## Application Successfuly run & terminated");
return rcode;
}
U_BOOT_CMD(
go, CONFIG_SYS_MAXARGS, 1, do_go,
"start application at address 'addr'",
"addr [arg ...]\n - start application at address 'addr'\n"
" passing 'arg' as arguments"
);
But still i could not find go command.
Reasons:
1.do_go still is no there in System.map file
From System.map file user commnad is not there between (__u_boot_cmd_start
and __u_boot_cmd_end)
In code
80e9f53c A __u_boot_cmd_start
80e9f53c D __u_boot_cmd_nandecc
80e9f558 D __u_boot_cmd_bootm
80e9f574 D __u_boot_cmd_boot
80e9f590 D __u_boot_cmd_bootd
80e9f5ac D __u_boot_cmd_saveenv
80e9f5c8 D __u_boot_cmd_editenv
80e9f5e4 D __u_boot_cmd_printenv
80e9f600 D __u_boot_cmd_setenv
80e9f61c D __u_boot_cmd_run
80e9f638 D __u_boot_cmd_version
80e9f654 D __u_boot_cmd_echo
80e9f670 D __u_boot_cmd_test
80e9f68c D __u_boot_cmd_exit
80e9f6a8 D __u_boot_cmd_help
80e9f6c4 D __u_boot_cmd_question_mark
80e9f6e0 D __u_boot_cmd_showvar
80e9f6fc A __u_boot_cmd_end
common/command.c
cmd_tbl_t *find_cmd (const char *cmd)
{
int len = &__u_boot_cmd_end - &__u_boot_cmd_start;
return find_cmd_tbl(cmd, &__u_boot_cmd_start, len);
}
cmd_tbl_t *find_cmd_tbl (const char *cmd, cmd_tbl_t *table, int table_len)
{
cmd_tbl_t *cmdtp;
cmd_tbl_t *cmdtp_temp = table; /*Init value */
const char *p;
int len;
int n_found = 0;
/*
* Some commands allow length modifiers (like "cp.b");
* compare command name only until first dot.
*/
len = ((p = strchr(cmd, '.')) == NULL) ? strlen (cmd) : (p - cmd);
for (cmdtp = table;
cmdtp != table + table_len;
cmdtp++) {
if (strncmp (cmd, cmdtp->name, len) == 0) {
if (len == strlen (cmdtp->name))
return cmdtp; /* full match */
cmdtp_temp = cmdtp; /* abbreviated command ? */
n_found++;
}
}
if (n_found == 1) { /* exactly one match */
return cmdtp_temp;
}
return NULL; /* not found or ambiguous command */
}
My doubts:
Where i have to search and which files?
what export.c(in common folder)will do?
Please Help any one.
ALexander
new command to u-boot
Hi, Is it possible to use the command infrastructure to add my own application, and instead of going no os, I do it on top of uboot? I get some flash access and ethernet access (which interests me). Am I correct, will this work or am I missing something big? Thanks, Kobus


