Hi Hugo, On 24 March 2016 at 04:44, Hugo Heutinck <heutinc...@gmail.com> wrote: > Hello, I was attempting to create a custom u-boot command. But I am not > able to get the > "run_command" or "cli_simple_run_command" to work. > > I`m building u-boot: am335x_boneblack_defconfig > > Attempting to use the "run_command" function results in: > > | common/built-in.o: In function `run_command': > | > /home/xxxxx/Projects/Yocto/BeagleBoneBlack/build/tmp/work/beaglebone-poky-linux-gnueabi/u-boot/v2015.07+gitAUTOINC+33711bdd4a-r0/git/common/cli.c:43: > undefined reference to `parse_string_outer' > > Attempting to use the cli_simple_run_command, see below. > > /home/xxxxx/Projects/Yocto/BeagleBoneBlack/build/tmp/work/beaglebone-poky-linux-gnueabi/u-boot/v2015.07+gitAUTOINC+33711bdd4a-r0/git/common/command.c:537: > undefined reference to `do_bootd' > scripts/Makefile.spl:214: recipe for target 'spl/u-boot-spl' failed > make[2]: *** [spl/u-boot-spl] Error 1 > Makefile:1263: recipe for target 'spl/u-boot-spl' failed > make[1]: *** [spl/u-boot-spl] Error 2 > Makefile:457: recipe for target '__build_one_by_one' failed > make: *** [__build_one_by_one] Error 2 > > The small test code is added as cmd_mytestcmd.c in the common/ directory > and in the common/Makefile "obj-y += cmd_mytestcmd.o" is added at the end > of the file. > > > #include <common.h> > #include <command.h> > #include <cli.h> > > #define MAX_CMD_LEN (255) > > static int do_mytest(cmd_tbl_t *cmdtp, int flag, int argc, char * const > argv[]) > { > int ret = 0; > char cmd[MAX_CMD_LEN] = "load mmc 0:1 ${loadaddr} my.env"; > ret = cli_simple_run_command(cmd, 0); > if (ret == 0) { > printf("OK\n"); > } else { > printf("NOK\n"); > } > > > return ret; > } > > U_BOOT_CMD( > mytestcmd, 1, 0, do_mytest, > "my test command", > ""); > > > What am I missing here ?
You appear to be adding your command to SPL. This is not supported. Commands are only available (at present) in U-Boot proper. > - Is it possible to use the run_command like this ? >From U-Boot proper, yes; from SPL, no. > - Do I need to configure any special CONFIG to enable this functionality ? Just call the function from outside SPL code. > - ??? > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot Regards, Simon _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot