All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] Adding new U-Boot Command.
@ 2009-09-22  7:44 Tuma
  2009-09-22  9:52 ` Detlev Zundel
  0 siblings, 1 reply; 6+ messages in thread
From: Tuma @ 2009-09-22  7:44 UTC (permalink / raw)
  To: u-boot

Hi, All!

Help me please in writting new U-Boot commands.
What should I do? I should write new file in "/common", something like 
cmd_****, am I right?

So where can I read about cmd_-file structure and how should new commands be 
added? And how can I add my new file to U-Boot binary?


-- 
Software Developer
General Satellite Corp.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] Adding new U-Boot Command.
  2009-09-22  7:44 [U-Boot] Adding new U-Boot Command Tuma
@ 2009-09-22  9:52 ` Detlev Zundel
  2009-09-23  7:44   ` Tuma
  0 siblings, 1 reply; 6+ messages in thread
From: Detlev Zundel @ 2009-09-22  9:52 UTC (permalink / raw)
  To: u-boot

Hi Tuma,

> Help me please in writting new U-Boot commands.
> What should I do? I should write new file in "/common", something like 
> cmd_****, am I right?

This really depends if you want to implement a command which is useful
for all boards, then it should be below common/ or if it is special to
one board.  Then it should go into the board directory.

> So where can I read about cmd_-file structure and how should new
> commands be added?

You have all the source to study.  Look into how other people do it.
Search the history for commits adding new commands and study them.  For
example this commit[1] adds new commands to an already existing file,
but it is a start.

> And how can I add my new file to U-Boot binary?

Make sure it is mentioned in the relevant Makefile.

Cheers
  Detlev

PS: Is the LCD display working now?

[1] http://git.denx.de/?p=u-boot.git;a=commitdiff;h=02c9aa1d41f73fdcf8383a36cc0cbbfaf952855d

-- 
While  the list of  different methods is not  endless, it is certainly
pretty long, with new ones being dreamed up all the time. Fortunately,
space limitations prevent us from looking at all of them.
                                            -- Andrew S. Tanenbaum
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] Adding new U-Boot Command.
  2009-09-22  9:52 ` Detlev Zundel
@ 2009-09-23  7:44   ` Tuma
  2009-09-23 12:06     ` Tuma
  2009-09-23 12:44     ` Wolfgang Denk
  0 siblings, 2 replies; 6+ messages in thread
From: Tuma @ 2009-09-23  7:44 UTC (permalink / raw)
  To: u-boot

Hi, Detlev!

Okay, I want to add some not board specific command - just some new 
functional. So I should put it in "/common".

Yes, I've studied the structure of cmv_-file, and here is my code:

------------------------------------------------

/*
 *  (C) Copyright 2009
 */

#include <command.h>

int PrintSerialNo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
    // Do something here
    return 0;
}

U_BOOT_CMD(printsn, 1, 0, PrintSerialNo, "Print Serial Number", "Long Help");

------------------------------------------------

The file is named cmd_sn.c and have been put in /common.

Now I'm not very skilled in make system. So can you help me please in adding 
new .c file in final u-boot image?
For example I need to include my new file unconditionally.
I should edit Makefile in /common?
What should be changed in this file?


On Tuesday 22 September 2009 13:52:52 you wrote:
> Hi Tuma,
>
> > Help me please in writting new U-Boot commands.
> > What should I do? I should write new file in "/common", something like
> > cmd_****, am I right?
>
> This really depends if you want to implement a command which is useful
> for all boards, then it should be below common/ or if it is special to
> one board.  Then it should go into the board directory.
>
> > So where can I read about cmd_-file structure and how should new
> > commands be added?
>
> You have all the source to study.  Look into how other people do it.
> Search the history for commits adding new commands and study them.  For
> example this commit[1] adds new commands to an already existing file,
> but it is a start.
>
> > And how can I add my new file to U-Boot binary?
>
> Make sure it is mentioned in the relevant Makefile.
>
> Cheers
>   Detlev
>
> PS: Is the LCD display working now?

No, it still does not. Work in progress.

> [1]
> http://git.denx.de/?p=u-boot.git;a=commitdiff;h=02c9aa1d41f73fdcf8383a36cc0
>cbbfaf952855d



-- 
Software Developer
General Satellite Corp.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] Adding new U-Boot Command.
  2009-09-23  7:44   ` Tuma
@ 2009-09-23 12:06     ` Tuma
  2009-09-23 12:44     ` Wolfgang Denk
  1 sibling, 0 replies; 6+ messages in thread
From: Tuma @ 2009-09-23 12:06 UTC (permalink / raw)
  To: u-boot

Thank you, Detlev!
I've successfully added new command to U-Boot.
All fine.

On Wednesday 23 September 2009 11:44:25 you wrote:
> Hi, Detlev!
>
> Okay, I want to add some not board specific command - just some new
> functional. So I should put it in "/common".
>
> Yes, I've studied the structure of cmv_-file, and here is my code:
>
> ------------------------------------------------
>
> /*
>  *  (C) Copyright 2009
>  */
>
> #include <command.h>
>
> int PrintSerialNo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> {
>     // Do something here
>     return 0;
> }
>
> U_BOOT_CMD(printsn, 1, 0, PrintSerialNo, "Print Serial Number", "Long
> Help");
>
> ------------------------------------------------
>
> The file is named cmd_sn.c and have been put in /common.
>
> Now I'm not very skilled in make system. So can you help me please in
> adding new .c file in final u-boot image?
> For example I need to include my new file unconditionally.
> I should edit Makefile in /common?
> What should be changed in this file?
>
> On Tuesday 22 September 2009 13:52:52 you wrote:
> > Hi Tuma,
> >
> > > Help me please in writting new U-Boot commands.
> > > What should I do? I should write new file in "/common", something like
> > > cmd_****, am I right?
> >
> > This really depends if you want to implement a command which is useful
> > for all boards, then it should be below common/ or if it is special to
> > one board.  Then it should go into the board directory.
> >
> > > So where can I read about cmd_-file structure and how should new
> > > commands be added?
> >
> > You have all the source to study.  Look into how other people do it.
> > Search the history for commits adding new commands and study them.  For
> > example this commit[1] adds new commands to an already existing file,
> > but it is a start.
> >
> > > And how can I add my new file to U-Boot binary?
> >
> > Make sure it is mentioned in the relevant Makefile.
> >
> > Cheers
> >   Detlev
> >
> > PS: Is the LCD display working now?
>
> No, it still does not. Work in progress.
>
> > [1]
> > http://git.denx.de/?p=u-boot.git;a=commitdiff;h=02c9aa1d41f73fdcf8383a36c
> >c0 cbbfaf952855d



-- 
Software Developer
General Satellite Corp.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] Adding new U-Boot Command.
  2009-09-23  7:44   ` Tuma
  2009-09-23 12:06     ` Tuma
@ 2009-09-23 12:44     ` Wolfgang Denk
  2009-09-28  8:02       ` Tuma
  1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2009-09-23 12:44 UTC (permalink / raw)
  To: u-boot

Dear Tuma,

In message <200909231144.25176.chernigovskiy@spb.gs.ru> you wrote:
> 
> Yes, I've studied the structure of cmv_-file, and here is my code:
> 
> ------------------------------------------------
> 
> /*
>  *  (C) Copyright 2009
>  */
> 
> #include <command.h>
> 
> int PrintSerialNo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> {

Why do you think such new command is needed?

Is anything wrong with just running "printenv serial#" ?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
... Jesus cried with a loud voice: Lazarus, come forth; the bug  hath
been  found  and  thy  program  runneth.  And  he  that was dead came
forth...                              -- John 11:43-44 [version 2.0?]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] Adding new U-Boot Command.
  2009-09-23 12:44     ` Wolfgang Denk
@ 2009-09-28  8:02       ` Tuma
  0 siblings, 0 replies; 6+ messages in thread
From: Tuma @ 2009-09-28  8:02 UTC (permalink / raw)
  To: u-boot


On Wednesday 23 September 2009 16:44:50 you wrote:
> Dear Tuma,
>
> In message <200909231144.25176.chernigovskiy@spb.gs.ru> you wrote:
> > Yes, I've studied the structure of cmv_-file, and here is my code:
> >
> > ------------------------------------------------
> >
> > /*
> >  *  (C) Copyright 2009
> >  */
> >
> > #include <command.h>
> >
> > int PrintSerialNo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> > {
>
> Why do you think such new command is needed?
>
> Is anything wrong with just running "printenv serial#" ?

Uhm... Sorry, we did'nt know about 'printenv serial#'.
My project manager said me to study U-Boot. This command was just for testing 
purposes. In real new comman maybe ANY functional. Serial Number is just for 
test. =)

Thank a lot. Everythink about command works.


> Best regards,
>
> Wolfgang Denk



-- 
Software Developer
General Satellite Corp.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-09-28  8:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-22  7:44 [U-Boot] Adding new U-Boot Command Tuma
2009-09-22  9:52 ` Detlev Zundel
2009-09-23  7:44   ` Tuma
2009-09-23 12:06     ` Tuma
2009-09-23 12:44     ` Wolfgang Denk
2009-09-28  8:02       ` Tuma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.