10d498393Swdenk 20d498393SwdenkCommands are added to U-Boot by creating a new command structure. 3*00309c67SPeter MeerwaldThis is done by first including command.h, then using the U_BOOT_CMD() macro 4*00309c67SPeter Meerwaldto fill in a cmd_tbl_t struct. 50d498393Swdenk 60d498393SwdenkU_BOOT_CMD(name,maxargs,repeatable,command,"usage","help") 70d498393Swdenk 80d498393Swdenkname: is the name of the commad. THIS IS NOT a string. 9*00309c67SPeter Meerwaldmaxargs: the maximum number of arguments this function takes 10*00309c67SPeter Meerwaldrepeatable: either 0 or 1 to indicate if autorepeat is allowed 110d498393Swdenkcommand: Function pointer (*cmd)(struct cmd_tbl_s *, int, int, char *[]); 120d498393Swdenkusage: Short description. This is a string 13*00309c67SPeter Meerwaldhelp: Long description. This is a string 140d498393Swdenk 150d498393Swdenk 16*00309c67SPeter Meerwald**** Behind the scene ****** 170d498393Swdenk 180d498393SwdenkThe structure created is named with a special prefix (__u_boot_cmd_) 190d498393Swdenkand placed by the linker in a special section. 200d498393Swdenk 210d498393SwdenkThis makes it possible for the final link to extract all commands 220d498393Swdenkcompiled into any object code and construct a static array so the 230d498393Swdenkcommand can be found in an array starting at __u_boot_cmd_start. 240d498393Swdenk 250d498393SwdenkIf a new board is defined do not forget to define the command section 260d498393Swdenkby writing in u-boot.lds ($(TOPDIR)/board/boardname/u-boot.lds) these 270d498393Swdenk3 lines: 280d498393Swdenk 290d498393Swdenk __u_boot_cmd_start = .; 300d498393Swdenk .u_boot_cmd : { *(.u_boot_cmd) } 310d498393Swdenk __u_boot_cmd_end = .; 32