Skip to contentSkip to conversation

Need To Know about the Command Line Interface in U-boot.

U-Boot prashantpurohit025 at gmail.com 2 participants 2 messages Aug 11, 2010

lore
Share & tools
lore
#0 lore raw

?Hi all,

I need to know how the command line interface has been developed in U-boot?

I could understand few things about command line interface from command.h and command.c file.

I am unable to get how from command line the U_BOOT_CMD macro has been called?

Also, what is the need of the special section for U-boot i.e ".u_boot_cmd"?

If any one has more info about it, please let me know as I am developing a similar command line interface for my application.

Thanks in advance.

Cheers,
Prashant

#1 lore raw

About .u_boot_cmd section, you can see the u-boot.lds for each processor core directory(arch/...).

This section collects all cmd_tbl_t structures into this section. So each uboot command line command should use macro U_BOOT_CMD to allocate the structure.

After compilation you can see how linker arrange the cmd_tbl_t structures into .u_boot_cmd section.
EX.
...............
.u_boot_cmd 0x33f97fe4 0x468
*(.u_boot_cmd)
.u_boot_cmd 0x33f97fe4 0x18 common/libcommon.a(cmd_bdinfo.o)

                0x33f97fe4                __u_boot_cmd_bdinfo
 .u_boot_cmd    0x33f97ffc       0x30 common/libcommon.a(cmd_boot.o)
                0x33f97ffc                __u_boot_cmd_go
                0x33f98014                __u_boot_cmd_reset
 .u_boot_cmd    0x33f9802c       0x78 common/libcommon.a(cmd_bootm.o)
                0x33f9802c                __u_boot_cmd_bootm
                0x33f98044                __u_boot_cmd_boot
                0x33f9805c                __u_boot_cmd_bootd
                0x33f98074                __u_boot_cmd_iminfo
                0x33f9808c                __u_boot_cmd_imls
 .u_boot_cmd    0x33f980a4       0x30 common/libcommon.a(cmd_cache.o)
                0x33f980a4                __u_boot_cmd_icache
                0x33f980bc                __u_boot_cmd_dcache
 .u_boot_cmd    0x33f980d4       0x18 common/libcommon.a(cmd_console.o)
                0x33f980d4                __u_boot_cmd_coninfo
 .u_boot_cmd    0x33f980ec       0x18 common/libcommon.a(cmd_date.o)
                0x33f980ec                __u_boot_cmd_date

.............

See, just like a table in memory.

So you can use a for-loop to traverse the table and print each command's description jusk like the _do_help()(in common/command.c) do.

Paul

Quoted 23 lines · Wed, Aug 11, 2010 at 2:05 PM, <[email protected]> wrote:

Hi all,

?I need to know how the command line interface has been developed in U-boot?

?I could understand few things about command line interface from command.h and command.c file.

?I am unable to get how from command line the U_BOOT_CMD macro has been called?

?Also, what is the need of the special section for U-boot i.e ".u_boot_cmd"?

?If any one has more info about it, please let me know as I am developing a similar command line interface for my application.

?Thanks in advance.

Cheers,
Prashant

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot