Commit Graph

56 Commits

Author SHA1 Message Date
Wolfgang Denk 67fb0622a9 unzip: return uncompressed size in `filesize', and print it.
The unzip command did not provide a way for the caller to get any
information about the uncompressed size.  To make it better usable in
scripts, we now store the uncompressed size in the `filesize'
variable, like we do when for example loading a file over the network
or when reading it from a file system.  Following that analogy, it is
only consequent to also print the size.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-02-15 21:46:39 +01:00
Alexander Holler c6b1ee664a Fix defines needed to enable command sha1sum
Documented is CONFIG_CMD_SHA1, through confusion in the source
CONFIG_CMD_SHA1 and CONFIG_CMD_SHA1SUM has to be used to enable
sha1sum.

Fix both, the documentation and the source, so that only
CONFIG_CMD_SHA1SUM is needed to enable the command sha1sum.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
2011-01-19 09:39:10 +01:00
Mike Frysinger d6efe244e4 cmd_mem: localize state variables
These "last" variables aren't used outside of this file, so add static.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-09 18:03:10 +01:00
Stefan Roese eaadb44edf cp/cmp: Add WATCHDOG_RESET in copy and compare loop
On some boards with a very short watchdog timeout, the "cp" and
"cmp" commands may reset the board. This patch adds some
watchdog resets inside the loops. Otherwise for example the lwmon5
board will reset while doing something like this:

=> cp.b fc000000 1000000 100000

Signed-off-by: Stefan Roese <sr@denx.de>
2010-10-12 22:50:19 +02:00
Wolfgang Denk 47e26b1bf9 cmd_usage(): simplify return code handling
Lots of code use this construct:

	cmd_usage(cmdtp);
	return 1;

Change cmd_usage() let it return 1 - then we can replace all these
ocurrances by

	return cmd_usage(cmdtp);

This fixes a few places with incorrect return code handling, too.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-24 20:43:57 +02:00
Wolfgang Denk 54841ab50c Make sure that argv[] argument pointers are not modified.
The hush shell dynamically allocates (and re-allocates) memory for the
argument strings in the "char *argv[]" argument vector passed to
commands.  Any code that modifies these pointers will cause serious
corruption of the malloc data structures and crash U-Boot, so make
sure the compiler can check that no such modifications are being done
by changing the code into "char * const argv[]".

This modification is the result of debugging a strange crash caused
after adding a new command, which used the following argument
processing code which has been working perfectly fine in all Unix
systems since version 6 - but not so in U-Boot:

int main (int argc, char **argv)
{
	while (--argc > 0 && **++argv == '-') {
/* ====> */	while (*++*argv) {
			switch (**argv) {
			case 'd':
				debug++;
				break;
			...
			default:
				usage ();
			}
		}
	}
	...
}

The line marked "====>" will corrupt the malloc data structures and
usually cause U-Boot to crash when the next command gets executed by
the shell.  With the modification, the compiler will prevent this with
an
	error: increment of read-only location '*argv'

N.B.: The code above can be trivially rewritten like this:

	while (--argc > 0 && **++argv == '-') {
		char *arg = *argv;
		while (*++arg) {
			switch (*arg) {
			...

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2010-07-04 23:55:42 +02:00
Wolfgang Wegner 87d93a1ba2 move prototypes for gunzip() and zunzip() to common.h
Prototype for gunzip/zunzip was only in lib_generic/gunzip.c and thus
repeated in every file using it. This patch moves the prototypes to
common.h and removes all prototypes distributed anywhere else.

Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de>
2009-12-21 21:39:59 +01:00
Paul Gortmaker 87b22b7787 mem_mtest: fix error reporting, allow escape with ^C
The basic memtest function tries to watch for ^C after each
pattern pass as an escape mechanism, but if things are horribly
wrong, we'll be stuck in an inner loop flooding the console with
error messages and never check for ^C.  To make matters worse,
if the user waits for all the error messages to complete, we
then incorrectly report the test passed without errors.

Adding a check for ^C after any error is printed will give
the end user an escape mechanism from a console flood without
slowing down the overall test speed on a slow processor.

Also, the more extensive memtest quit after just a single error,
which is inconsistent with the normal memtest, and not useful if
if you are doing dynamic environmental impact testing, such as
heating/cooling etc.

Both tests now track the error count and report it properly
at test completion.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2009-10-18 22:57:06 +02:00
Robin Getz 02c9aa1d41 Add md5sum and sha1 commands...
Now that we have sha1 and md5 in lib_generic, allow people to use
them on the command line, for checking downloaded files.

Signed-off-by: Robin Getz <rgetz@analog.com>
2009-08-25 12:57:54 +02:00
Wolfgang Denk a89c33db96 General help message cleanup
Many of the help messages were not really helpful; for example, many
commands that take no arguments would not print a correct synopsis
line, but "No additional help available." which is not exactly wrong,
but not helpful either.

Commit ``Make "usage" messages more helpful.'' changed this
partially. But it also became clear that lots of "Usage" and "Help"
messages (fields "usage" and "help" in struct cmd_tbl_s respective)
were actually redundant.

This patch cleans this up - for example:

Before:
	=> help dtt
	dtt - Digital Thermometer and Thermostat

	Usage:
	dtt         - Read temperature from digital thermometer and thermostat.

After:
	=> help dtt
	dtt - Read temperature from Digital Thermometer and Thermostat

	Usage:
	dtt

Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-06-12 20:47:16 +02:00
Andy Fleming b2e2ed0233 Eliminate support for using MMC as memory
MMC cards are not memory, so we stop treating them that way.

Signed-off-by: Andy Fleming <afleming@freescale.com>
2009-02-16 18:07:40 -06:00
Peter Tyser 2fb2604d5c Command usage cleanup
Remove command name from all command "usage" fields and update
common/command.c to display "name - usage" instead of
just "usage". Also remove newlines from command usage fields.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-01-28 08:49:52 +01:00
Peter Tyser 62c3ae7c6e Standardize command usage messages with cmd_usage()
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-01-28 08:43:45 +01:00
Dirk Eibach b6fc6fd49a common: Iteration limit for memory test.
The iteration limit is passed to mtest as a fourth parameter:
[start [end [pattern [iterations]]]]
If no fourth parameter is supplied, there is no iteration limit and the
test will loop forever.

Signed-off-by: Dirk Eibach <eibach@gdsys.de>
2009-01-24 01:42:05 +01:00
Peter Tyser d16da93430 cmd_mem: Remove unused variable
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2008-12-14 11:13:52 +01:00
Jean-Christophe PLAGNIOL-VILLARD 6d0f6bcf33 rename CFG_ macros to CONFIG_SYS
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-10-18 21:54:03 +02:00
Jean-Christophe PLAGNIOL-VILLARD b64b775e75 cmd_mem: Move conditional compilation to Makefile
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-09-10 22:48:05 +02:00
Jean-Christophe PLAGNIOL-VILLARD 8a40fb148e move cmd_get_data_size to command.c
add CMD_DATA_SIZE macro to enable it

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-09-10 22:48:05 +02:00
Markus Heidelberg 748b5274e7 common/cmd_mem.c: remove nested #if defined(CONFIG_CMD_MEMORY)
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
2008-09-09 23:35:53 +02:00
Wolfgang Denk 19f101412c cmd_mem.c: Fix help message alignment
Bug was introced by "Big white-space cleanup" (53677ef1)

Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-08-26 13:14:34 +02:00
Harald Welte fe2ce5500e add 'unzip' command to u-boot commandline
[PATCH] add new 'unzip' command to u-boot commandline

common/cmd_mem.c: new command "unzip srcaddr dstaddr [dstsize]" to unzip from
memory to memory, and option CONFIG_CMD_UNZIP to enable it

Signed-off-by: Werner Almesberger <werner@openmoko.org>
Signed-off-by: Harald Welte <laforge@openmoko.org>
2008-08-18 22:59:00 +02:00
Wolfgang Denk 53677ef18e Big white-space cleanup.
This commit gets rid of a huge amount of silly white-space issues.
Especially, all sequences of SPACEs followed by TAB characters get
removed (unless they appear in print statements).

Also remove all embedded "vim:" and "vi:" statements which hide
indentation problems.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-05-21 00:14:08 +02:00
Wolfgang Denk 4b7a6dd896 Merge branch 'master' of /home/wd/git/u-boot/lwmon5
Conflicts:

	common/cmd_bootm.c
	common/cmd_log.c
	include/common.h
	post/board/lwmon5/Makefile
	post/board/lwmon5/dsp.c
	post/board/lwmon5/dspic.c
	post/board/lwmon5/fpga.c
	post/board/lwmon5/gdc.c
	post/board/lwmon5/sysmon.c
	post/board/lwmon5/watchdog.c

Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-04-25 11:32:01 +02:00
Sergei Poselenov a6e6fc610e Added watchdog triggering calls in the "mtest" test function.
Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com>
2008-04-22 15:21:37 +02:00
Stelian Pop 880cc4381e Fix CFG_NO_FLASH compilation.
Many Atmel boards have no "real" (NOR) flash on board, and rely only
on DataFlash and NAND memories. This patch enables CFG_NO_FLASH to
be present in a board configuration file, while still enabling flash
commands like 'flinfo', 'protect', etc.

Signed-off-by: Stelian Pop <stelian@popies.net>
2008-03-30 21:19:40 +02:00
Kim B. Heino 84d0c2f1e3 fix copy from ram to dataflash
If I try to "cp.b <ram> <dataflash>", u-boot selects normal flash
routines instead of dataflash. This is because it checks "if source
address is not dataflash" instead of target address.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>
2008-03-03 21:48:02 +01:00
Guennadi Liakhovetski 6f4abee789 Fix wrong memory limit calculation in memory-test
If the length of the memory address range passed to the "mtest" command is
not of the form 2^x - 1, not all address lines are tested. This bug is
inherited from the original software at
http://www.netrino.com/Embedded-Systems/How-To/Memory-Test-Suite-C. Fix
this.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
2008-02-15 00:51:02 +01:00
Wolfgang Denk 6f99eec3dc Merge branch 'master' of git://www.denx.de/git/u-boot-blackfin
Conflicts:

	Makefile
	doc/README.standalone

Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-02-15 00:06:18 +01:00
Guennadi Liakhovetski 1f780aa6f1 Fix return value of mtest when CFG_ALT_MEMTEST set
Fix a missing return statement from a non-void function.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
2008-02-14 23:37:13 +01:00
Mike Frysinger 4c727c77e4 add support for memory commands with Blackfin L1 instruction memory
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2008-02-04 19:26:56 -05:00
Jon Loeliger 9025317883 common/: Remove lingering references to CFG_CMD_* symbols.
Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-10 11:02:44 -05:00
Jon Loeliger c76fe47425 common/cmd_[i-n]*: Remove obsolete references to CONFIG_COMMANDS.
Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-08 18:02:23 -05:00
Jon Loeliger 65c450b47a common/cmd_[i-z]* : Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).
This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
    #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
    #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-04 00:23:09 +02:00
Grant Likely c95c4280d7 [PATCH 3_9] Move buffer print code from md command to common function
Printing a buffer is a darn useful thing.  Move the buffer print code
into print_buffer() in lib_generic/

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2007-02-20 09:05:00 +01:00
Wolfgang Denk 029b6dc77c Make code better readable.
Patch by Ladislav Michl, 14 Sep 2005
2006-07-21 11:37:40 +02:00
Wolfgang Denk 77ddac9480 Cleanup for GCC-4.x 2005-10-13 16:45:02 +02:00
stroese 4aaf29b2f5 memory commands "mdc" and "mwc" added for cyclic read/write 2004-12-16 17:42:39 +00:00
wdenk e1599e83d6 * Patch by Gridish Shlomi, 30 Aug 2004:
- Add support to revA version of PQ27 and PQ27E.
  - Reverted MPC8260ADS baudrate back to original 115200

* Patch by Hojin, 17 Sep 2004:
  Fix typo in cfi_flash.c

* Patch by Mark Jonas, 09 September 2004:
  mtest's data line test (with CFG_ALT_MEMTEST set) returned a wrong
  error message

* Patch by Mark Jonas, 31 August 2004:
  Added option CFG_XLB_PIPELINING to enable XLB pipelining. This
  improves FTP performance for MPC5200 systems. Enabled for IceCube
  by default.
2004-10-10 23:27:33 +00:00
wdenk 810509266f * Cleanup
* Patch by Mark Jonas, 05 Jul 2004:
  add support for the Total5100's and Total5200's LCD screen

* Patches by Dan Eisenhut, 01 Jul 2004:
  - README fixes.
  - Move doc2000.h include to prevent compiler warning on some boards
2004-07-11 20:04:51 +00:00
wdenk 56523f1283 * Patch by Martin Krause, 30 Jun 2004:
Add support for TQM5200 board

* Patch by Martin Krause, 29 Jun 2004:
  Add loopw command: infinite write loop on address range
2004-07-11 17:40:54 +00:00
wdenk 6e5923851e * Cleanup, minor fixes
* Patch by Rune Torgersen, 16 Apr 2004:
  LBA48 fixes

* Patches by Pantelis Antoniou, 16 Apr 2004:
  - Fix some compile problems;
    add "once" functionality for the netretry variable
2004-04-18 17:39:38 +00:00
wdenk c26e454dfc Patches by Pantelis Antoniou, 16 Apr 2004:
- add support for a new version of an Intracom board and fix
  various other things on others.
- add verify support to the crc32 command (define
  CONFIG_CRC32_VERIFY to enable it)
- fix FEC driver for MPC8xx systems:
  1. fix compilation problems for boards that use dynamic
     allocation of DPRAM
  2. shut down FEC after network transfers
- HUSH parser fixes:
  1. A new test command was added. This is a simplified version of
     the one in the bourne shell.
  2. A new exit command was added which terminates the current
     executing script.
  3. Fixed handing of $? (exit code of last executed command)
2004-04-18 10:13:26 +00:00
wdenk 4b9206ed51 * Patches by Thomas Viehweger, 16 Mar 2004:
- show PCI clock frequency on MPC8260 systems
  - add FCC_PSMR_RMII flag for HiP7 processors
  - in do_jffs2_fsload(), take load address from load_addr if not set
    explicit, update load_addr otherwise
  - replaced printf by putc/puts when no formatting is needed
    (smaller code size, faster execution)
2004-03-23 22:14:11 +00:00
wdenk cbd8a35c6d * Patch by Masami Komiy, 22 Feb 2004:
Add support for NFS for file download

* Minor code cleanup
2004-02-24 02:00:03 +00:00
wdenk 2d1a537d87 * Patch by Thomas Elste, 10 Feb 2004:
Add support for NET+50 CPU and ModNET50 board

* Patch by Sam Song, 10 Feb 2004:
  Fix typos in cfi_flash.c

* Patch by Leon Kukovec, 10 Feb 2004
  Fixed long dir entry slot id calculation in get_vfatname

* Patch by Robin Gilks, 10 Feb 2004:
  add "itest" command (operators: -eq, -ne, -lt, -gt, -le, -ge, ==,
  !=, <>, <, >, <=, >=)
2004-02-23 19:30:57 +00:00
wdenk d4ca31c40e * Cleanup lowboot code for MPC5200
* Minor code cleanup (coding style)

* Patch by Reinhard Meyer, 30 Dec 2003:
  - cpu/mpc5xxx/fec.c: added CONFIG_PHY_ADDR, added CONFIG_PHY_TYPE,
  - added CONFIG_PHY_ADDR to include/configs/IceCube.h,
  - turned debug print of PHY registers into a function (called in two places)
  - added support for EMK MPC5200 based modules

* Fix MPC8xx PLPRCR_MFD_SHIFT typo

* Add support for TQM866M modules

* Fixes for TQM855M with 4 MB flash (Am29DL163 = _no_ mirror bit flash)

* Fix a few compiler warnings
2004-01-02 14:00:00 +00:00
wdenk 5779d8d985 * Patch by Nicolas Lacressonnière, 12 Nov 2003:
update for for Atmel AT91RM9200DK development kit:
  - support for environment variables in DataFlash
  - Atmel DataFlash AT45DB1282 support

* Patch by Jeff Carr, 11 Nov 2003:
  add support for new version of 8270 processors

* Patches by George G. Davis, 05 Nov 2003:
  - only pass the ARM linux initrd tag to the kernel when an initrd
    is actually present
  - update omap1510inn configuration file
2003-12-06 23:55:10 +00:00
wdenk 5f535fe170 * Patches by Anders Larsen, 17 Sep 2003:
- fix spelling errors
  - set GD_FLG_DEVINIT flag only after device function pointers
    are valid
  - Allow CFG_ALT_MEMTEST on systems where address zero isn't
    writeable
  - enable 3.rd UART (ST-UART) on PXA(XScale) CPUs
  - trigger watchdog while waiting in serial driver
2003-09-18 09:21:33 +00:00
wdenk 27b207fd0a * Implement new mechanism to export U-Boot's functions to standalone
applications: instead of using (PPC-specific) system calls we now
  use a jump table; please see doc/README.standalone for details

* Patch by Dave Westwood, 24 Jul 2003:
  added support for Unity OS (a proprietary OS)
2003-07-24 23:38:38 +00:00
wdenk 0d4983930a Patch by Kenneth Johansson, 30 Jun 2003:
get rid of MK_CMD_ENTRY macro; update doc/README.command
2003-07-01 21:06:45 +00:00