]> git.ipfire.org Git - people/ms/u-boot.git/blame - doc/README.commands
rockchip: video: rk_vop: migrate to livetree
[people/ms/u-boot.git] / doc / README.commands
CommitLineData
0d498393
WD
1
2Commands are added to U-Boot by creating a new command structure.
00309c67
PM
3This is done by first including command.h, then using the U_BOOT_CMD() macro
4to fill in a cmd_tbl_t struct.
0d498393
WD
5
6U_BOOT_CMD(name,maxargs,repeatable,command,"usage","help")
7
8name: is the name of the commad. THIS IS NOT a string.
00309c67
PM
9maxargs: the maximum number of arguments this function takes
10repeatable: either 0 or 1 to indicate if autorepeat is allowed
0d498393
WD
11command: Function pointer (*cmd)(struct cmd_tbl_s *, int, int, char *[]);
12usage: Short description. This is a string
00309c67 13help: Long description. This is a string
0d498393
WD
14
15
00309c67 16**** Behind the scene ******
0d498393 17
ef123c52
AA
18The structure created is named with a special prefix and placed by
19the linker in a special section using the linker lists mechanism
20(see include/linker_lists.h)
0d498393
WD
21
22This makes it possible for the final link to extract all commands
23compiled into any object code and construct a static array so the
ef123c52 24command array can be iterated over using the linker lists macros.
0d498393 25
ef123c52
AA
26The linker lists feature ensures that the linker does not discard
27these symbols when linking full U-Boot even though they are not
28referenced in the source code as such.
2d1d6583 29
0d498393 30If a new board is defined do not forget to define the command section
4379ac61 31by writing in u-boot.lds ($(srctree)/board/boardname/u-boot.lds) these
0d498393
WD
323 lines:
33
6c7c946c 34 .u_boot_list : {
ef123c52 35 KEEP(*(SORT(.u_boot_list*)));
6c7c946c 36 }