9
0
Fork 0
Commit Graph

38 Commits

Author SHA1 Message Date
Sascha Hauer deef1e80f3 Do not use macros in command help
The help texts are parsed by sphinx which cannot handle macros, so
replace them with their values.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-08 07:52:36 +02:00
Holger Schurig f1f532084a commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:

* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
  options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
  is listed by character in this (short) option string (the long
  description is in the long help text, as before)
* help texts have been reworked, to make them
  - sometimes smaller
  - sometimes describe the options better
  - more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
  macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
  all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
  is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
  errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
  compiled long help texts
* 'help -v' gives a list of commands with their short description, this
  is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:43 +02:00
Holger Schurig ab23d0bb3f commands: group 'help' output
The old output of "help" was just producing a long list, that usually
scrolled of the screen (even on a X11 terminal). This list is more
compact, and also sorted by groups.

The old output format (plus grouping) is now available with 'help -v'.

Example:

   Information commands:
     ?, devinfo, help, iomem, meminfo, version
   Boot commands:
     boot, bootm, go, loadb, loads, loadx, loady, saves, uimage
   ...

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 07:59:55 +02:00
Sascha Hauer d28c9bb55d dhcp: replace dhcp_getenv_int with getenv_uint
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-07 07:59:00 +02:00
Sascha Hauer 774580c2bd Make hostname available to C Code
The boards often have a sane default for the hostname. Provide a C
function for setting/getting it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-16 08:40:37 +02:00
Sascha Hauer 016082f85e globalvar: Allow to set initial value
Calling globalvar_add_simple() and setting a value is more than common.
Add a parameter for the initial value.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-16 08:40:33 +02:00
Sascha Hauer 66691793b0 net: dhcp: Fix tftp servername handling
When the dhcp code discovered the tftp-server-name option it immediately
tries to resolve the name. This can't succeed since the we are somewhere
in the dhcp processing and the nameserver may not even be known.

Fix this by resolving the name when dhcp is completed. While at it, do
this in a way that net_set_serverip is only called when resolv() returns
something useful. Otherwise we may end up overwriting a previously
configured serverip which came from the bootp bp_siaddr field.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-14 11:51:24 +02:00
Sascha Hauer 37b0cce64d net: dhcp: Fix return value on ctrl-c
the dhcp command will return with 0 when ctrl-c is pressed. Fix this to
-EINTR instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-14 11:50:18 +02:00
Sascha Hauer ca9a1827dc net: dhcp: fix typo
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-28 13:06:49 +01:00
Jean-Christophe PLAGNIOL-VILLARD 5db42bd619 dhcp: add retries limit support
via -r opt, global.dhcp.retries or dhcp_retries

set the priority order;

This will allow to do not stay infinite loop if no dhcp available
for boot sequence as example

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-02 08:57:07 +02:00
Jean-Christophe PLAGNIOL-VILLARD d166d74211 dhcp: add copy_only_if_valid support
This will allow to only update a var if recive a valid data.
This is need for hostname.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-02 08:57:07 +02:00
Jean-Christophe PLAGNIOL-VILLARD 91b563613e dhcp: switch to global var support
This way you can specify as previously set the dhcp parameter via global.dhcp.xxx
and get the result via global.dhcp.xxx

This is need for the defaultenv-2 to add the bootp suppport.
Use it on defaultenv too to have only one set of var.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-02 08:57:07 +02:00
Jean-Christophe PLAGNIOL-VILLARD 8166603baa defaultenv: switch hostname to global.hostname
Udpate dhcp with it too.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-02 08:57:07 +02:00
Sascha Hauer e4e3fbd22b improve complete support
The following patch serie improve the complete support
 by adding a complete framework to aalow commands complete support.
 
 The add also car complete support for eval and setting and executable
 file support
 
 This also include an update of the stringlist API to support asprintf
 API
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJPnohsAAoJEOrjwV5ZMRf2qeIQAIC7WrIao0mB2pIB+51MqeU+
 sof7GLxUl0MWXFFc3OFEHDcY5grC867mBmB9+uDG1mvcxa/bUpw+jMRMrki5j4Kg
 mjaHQ2UCvDjMHqQi7ISc/WTyJb09mtduFIceP0EftAmG8Mb5n9XOMaKwL9r/UQHB
 ps9MijnI/QeFqbrmBZcuaCp59QsPvipYw8NMJITBu2VvWrpKTIox33qPfNATDuEV
 SzMoLwz+uD7W7dEAM/A1uFdo4K5fLyZruDVGQoQ8CRS+zW3E6rr/EakpN5mhr/66
 dVZYO1xWppBaefIJQ1RD6bvwlFvesuuvQmMtDxsCsp07fyBolEWfFzblrwdkbueY
 NPwWExV5nzbRdAKKSyhU/nHiQ2edOQQZtHDAbnM4zh5e6lK7YLrzVklzT4Dfhzn0
 GRdnjCmiQiaZdmAEHe8wte2nr3Lc01fTsj/EFVA+LYP3a9by1iG2Zn3/ChieVcN4
 R+o/2lMBdhxsTszcmwMOemdqVPlt/0VmEXrKGtjTIZEViuQyyhY8ZtEaf4C0zeln
 Jf60t0ZvkehAJc0Lo4UOygjzvErqcKoHMk7utAjP+bi1KcMgF3Q+HmtCnJJs2FHw
 c40FZj1WcLPStEiS1way7miBakxOy2zPumKi1OXx+140L25C1nvQPYu8ilOZHEyU
 opNlo+wQ8h5sG/054kYL
 =rYfw
 -----END PGP SIGNATURE-----

Merge tag 'complete_update_support' of git://git.jcrosoft.org/barebox into next

improve complete support

The following patch serie improve the complete support
by adding a complete framework to allow commands complete support.

The add also car complete support for eval and setting and executable
file support

This also include an update of the stringlist API to support asprintf
API
2012-05-01 21:41:59 +02:00
Jean-Christophe PLAGNIOL-VILLARD 8e6f45f54f complete: add empty complete support
for cpuinfo, clear, dhcp, false, login, lsmod, meminfo, passwd, pwd, reginfo,
reset, true, usb, version

for mach-imx and mach-mxs: dump_clocks
for u_serial: mycdev

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-30 20:37:40 +08:00
Sascha Hauer cac75c0f23 dhcp: set start time
The dhcp command starts with an unitialized start time. The start
time is often long in the past which results in an immediate timeout
and resend of the dhcp packet. Fix this by initializing the start time
correctly.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:28:56 +02:00
Jean-Christophe PLAGNIOL-VILLARD 0613fca0b3 dhcp: fix typo introduce during rebase of hostname patch
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-18 15:36:10 +02:00
Jean-Christophe PLAGNIOL-VILLARD 903d939193 net: dhcp: add support to send the hostname to the dhcp server
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-18 11:59:10 +02:00
Sascha Hauer 87be17d7db dhcp: set global nameserver/domainname
The nameserver and domainname are now globally available using
the 'net' device. Use it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-15 16:26:07 +02:00
Jean-Christophe PLAGNIOL-VILLARD b00be49bdb net: dhcp: add private extention 224 to pass the oftree file via dhcp.
DHCP option 224 to 254 are for private use, so use one.

Export it via env dhcp_oftree_file.

E.g. the ISC dhcp server can be configured with

   | option oftree-path code 224 = string
   | class "at91sam9x5ek" {
   | match if substring (option vendor-class-identifier,0,20) = "barebox-at91sam9x5ek";
   |
   | filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage";
   | option tftp-server-name "192.168.200.98";
   | option root-path "192.168.200.98:/opt/work/buildroot/build/sam9x5/target";
   | option oftree-path "/tftpboot/atmel/at91sam9x5/sam9x5ek/sam9g25ek/dtb";
   | }

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-10 09:54:43 +02:00
Jean-Christophe PLAGNIOL-VILLARD f76899fa98 net: dhcp: allow to set transmitted user class
For net boot setups it is useful to submit boot params like server or
bootfile over dhcp. To distinguish diffrent type of OS running on the same hardware,
a custom vendor id can be sent in dhcp discover/request messages.

E.g. the ISC dhcp server can be configured with

 | option client-uuid code 97 = { unsigned integer 8, string };
 | class "at91sam9x5ek" {
 |         match if substring (option vendor-class-identifier,0,20) = "barebox-at91sam9x5ek";
 |
 |         filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage";
 |         if substring (option dhcp-client-identifier,0,7) = "ser2net" {
 |                 filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage-ser2net";
 |         }
 |         if substring (option client-uuid,0,7) = "test" {
 |                 filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage-ser2net";
 |         }
 |         if substring (option user-class,0,4) = "toto" {
 |                 filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage-toto";
 |         }
 |         option tftp-server-name "192.168.200.98";
 |         option option-150 192.168.200.98;
 |         next-server 192.168.200.98;
 |         option root-path "192.168.200.98:/opt/work/buildroot/build/sam9x5/target";
 | }

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-03 11:39:29 +08:00
Jean-Christophe PLAGNIOL-VILLARD c106abc619 net: dhcp: allow to set transmitted client uuid
For net boot setups it is useful to submit boot params like server or
bootfile over dhcp. To distinguish diffrent type of OS running on the same hardware,
a custom client uuid can be sent in dhcp discover/request messages.

E.g. the ISC dhcp server can be configured with

 | option client-uuid code 97 = { unsigned integer 8, string };
 | class "at91sam9x5ek" {
 |         match if substring (option vendor-class-identifier,0,20) = "barebox-at91sam9x5ek";
 |
 |         filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage";
 |         if substring (option dhcp-client-identifier,0,7) = "ser2net" {
 |                 filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage-ser2net";
 |         }
 |         if substring (option client-uuid,0,7) = "test" {
 |                 filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage-ser2net";
 |         }
 |         option tftp-server-name "192.168.200.98";
 |         option option-150 192.168.200.98;
 |         next-server 192.168.200.98;
 |         option root-path "192.168.200.98:/opt/work/buildroot/build/sam9x5/target";
 | }

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-03 11:39:29 +08:00
Jean-Christophe PLAGNIOL-VILLARD b0660bd84f net: dhcp: allow to set transmitted client id
For net boot setups it is useful to submit boot params like server or
bootfile over dhcp. To distinguish diffrent type of OS running on the same hardware,
a custom client id can be sent in dhcp discover/request messages.

E.g. the ISC dhcp server can be configured with

 | class "at91sam9x5ek" {
 |         match if substring (option vendor-class-identifier,0,20) = "barebox-at91sam9x5ek";
 |
 |         filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage";
 |         if substring (option dhcp-client-identifier,0,7) = "ser2net" {
 |                 filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage-ser2net";
 |         }
 |         option tftp-server-name "192.168.200.98";
 |         option option-150 192.168.200.98;
 |         next-server 192.168.200.98;
 |         option root-path "192.168.200.98:/opt/work/buildroot/build/sam9x5/target";
 | }

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-03 11:39:29 +08:00
Jean-Christophe PLAGNIOL-VILLARD 7fd2d7658e net: dhcp: factorise setting option code
This will allow to add more easly new option with less impact in the binary.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-03 11:39:29 +08:00
Jean-Christophe PLAGNIOL-VILLARD 1f9e76d840 net: dhcp: add support of tftp name server
if the DNS is enable resolve it. The server ip will be set if no server ip it
is set in the bootp.
Export it via env dhcp_tftp_server_name.

E.g. the ISC dhcp server can be configured with

   | class "at91sam9x5ek" {
   |         match if substring (option vendor-class-identifier,0,20) = "barebox-at91sam9x
   |
   |         filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage";
   |         option tftp-server-name "192.168.200.98";
   |         option root-path "192.168.200.98:/opt/work/buildroot/build/sam9x5/target";
   |         }
   | }

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-03 11:39:27 +08:00
Jean-Christophe PLAGNIOL-VILLARD af387f080f net: dhcp: reset env variable before do a dhcp request
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-03 11:38:43 +08:00
Jean-Christophe PLAGNIOL-VILLARD 16a07dc526 net: dhcp: factorise option recption handling
Instead of using a static switch case the handle the received option
use an array of supported option.

This will allow to unset the env var without duplicating the code.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-03 11:38:39 +08:00
Enrico Scholz 3661e874aa net: dhcp: allow to set transmitted vendor id
For net boot setups it is useful to submit boot params like server or
bootfile over dhcp. To distinguish barebox from e.g. pxe machines,
a custom vendor id can be sent in dhcp discover/request messages.

E.g. the ISC dhcp server can be configured with

| if substring(option vendor-class-identifier,0,8) = "barebox:" {
|       next-server             192.168.3.24;
|       server-name             "192.168.3.24";
|       option tftp-server-name "192.168.3.24";
|       option root-path = concat("/srv/sysroots/by-mac/",
|          binary-to-ascii (16, 8, "-", substring (hardware, 1, 6)));
| }

to sent boot params which are valid for barebox hosts only.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Jean-Christophe PLAGNIOL-VILLARD:
 - update the use dhcp command option
 - support to set the vendor via env dhcp_vendor_id
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-03-12 22:44:06 +01:00
Sascha Hauer 33d1cc4bf2 commands: remove struct command pointer from commands
This is unused in all commands and thus can be removed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-27 20:28:07 +01:00
Sascha Hauer 7766c288ff dhcp: Add magicvars
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 20:51:32 +01:00
Sascha Hauer c75ab78763 net: add a context to the packet handler
This is not yet used, but with this the different network
commands can get rid of their global data.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:56 +02:00
Sascha Hauer 870e64993b implement dhcp using new network stack
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:17 +02:00
Sascha Hauer 922bb41a47 remove typedef cmd_tbl_t and replace it with struct command
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-01 17:25:32 +01:00
Sascha Hauer a3ffa97f40 rename U-Boot-v2 project to barebox
This has been done with the following script:

find -path ./.git -prune -o -type f -print0 | xargs -0 -r sed -i \
	-e 's/u2boot/barebox/g' \
	-e 's/U2Boot/barebox/g' \
	-e 's/U-boot V2/barebox/g' \
	-e 's/u-boot v2/barebox/g' \
	-e 's/U-Boot V2/barebox/g' \
	-e 's/U-Boot-v2/barebox/g' \
	-e 's/U_BOOT/BAREBOX/g' \
	-e 's/UBOOT/BAREBOX/g' \
	-e 's/uboot/barebox/g' \
	-e 's/u-boot/barebox/g' \
	-e 's/u_boot/barebox/g' \
	-e 's/U-Boot/barebox/g' \
	-e 's/U-boot/barebox/g' \
	-e 's/U-BOOT/barebox/g'

find -path ./.git -prune -o \( -name "*u-boot*" -o -name "*uboot*" -o -name "*u_boot*" \) -print0 | \
	xargs -0 -r rename 's/u[-_]?boot/barebox/'

It needs some manual fixup following in the next patch

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-12-15 10:18:30 +01:00
Sascha Hauer 420a3173f0 commands: remove maxargs
No need to check for maximum argument counts. The commands are
safe to be called with more arguments, so lets safe some bytes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-19 16:18:33 +02:00
Sascha Hauer 146f9b6e5b remove sntp support. Has been broken for long enough
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 11:19:28 +02:00
Sascha Hauer 4d0670f227 net: cleanup header file
move contents of bootp.h to .c file and remove it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 11:02:15 +02:00
Sascha Hauer 87048e4a66 rename bootp.c to dhcp.c 2009-10-13 11:02:15 +02:00