30 Nov, 2017

1 commit


02 Apr, 2016

1 commit


20 Nov, 2015

1 commit


28 Aug, 2015

1 commit


05 Aug, 2015

1 commit


28 Oct, 2014

1 commit

  • - Do not insert a whitespace between a function name and
    an open paranthesis
    - Fix comment style
    - Do not split an error message into multiple lines
    even if it exceeds 80 columns
    - Do not split "for" statement where it fits in 80 columns
    - Do not use assignment in if condition

    Signed-off-by: Masahiro Yamada
    Acked-by: Simon Glass

    Masahiro Yamada
     

05 Mar, 2014

2 commits

  • Add 64-bit data for memory commands, such as md, mw, mm, cmp. The new
    size ".q " is introduced.

    For 64-bit architecture, 64-bit data is enabled by default, by detecting
    compiler __LP64__. It is optional for other architectures.

    Signed-off-by: York Sun

    York Sun
     
  • U-Boot now uses errors defined in include/errno.h which are negative
    integers. Commands which fail need to report the error and return 1
    to indicate failure. Add this functionality in cmd_process_error().

    For now this merely reports the error number. It would be possible
    also to produce a helpful error message by storing the error strings
    in U-Boot.

    Signed-off-by: Simon Glass

    Simon Glass
     

14 Jan, 2014

1 commit


24 Jul, 2013

1 commit


04 Feb, 2013

1 commit


08 Nov, 2012

1 commit

  • commit 199adb601ff34bdbbd0667fac80dfe0a87bffc2b "common/misc: sparse
    fixes" broke the help command trying to fix the sparse error
    "command.c:44:38: error: bad constant expression".

    As Henrik points out, the fix was bad because the commit used
    CONFIG_SYS_MAXARGS whereas the code intended to use the maximum
    number of commands (not arguments to a command).

    Revert command.c changes to the original code as asked by Wolfgang.

    Reported-by: Henrik Nordström
    Signed-off-by: Anatolij Gustschin

    Anatolij Gustschin
     

05 Nov, 2012

1 commit

  • command.c:44:38: error: bad constant expression
    dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
    dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
    dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
    dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
    dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
    dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
    dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
    dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
    dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
    dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
    dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
    dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
    dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
    dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
    dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
    dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
    dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
    dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
    dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
    dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
    hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
    hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
    hush.c:2175:20: warning: Using plain integer as NULL pointer
    hush.c:2175:34: warning: Using plain integer as NULL pointer
    hush.c:2210:41: warning: Using plain integer as NULL pointer
    hush.c:2216:45: warning: Using plain integer as NULL pointer
    hush.c:2249:25: warning: Using plain integer as NULL pointer
    hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
    hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
    hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
    hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
    hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
    hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
    hush.c:3295:34: warning: Using plain integer as NULL pointer
    hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
    image.c:1282:29: warning: Using plain integer as NULL pointer
    image.c:1315:41: warning: Using plain integer as NULL pointer
    image.c:1330:25: warning: Using plain integer as NULL pointer
    image.c:1706:25: warning: Using plain integer as NULL pointer
    main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
    main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
    main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
    usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
    usb_storage.c:440:48: warning: Using plain integer as NULL pointer
    usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
    usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
    usb_storage.c:629:55: warning: Using plain integer as NULL pointer
    usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
    usb_storage.c:675:43: warning: Using plain integer as NULL pointer
    usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
    usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
    usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
    xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
    xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
    xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

    note: hush.c's nesting_level deleted because not used.

    Signed-off-by: Kim Phillips

    Kim Phillips
     

22 Oct, 2012

1 commit

  • This patch converts the old method of creating a list of command
    onto the new LG-arrays code. The old u_boot_cmd section is converted
    to new u_boot_list_cmd subsection and LG-array macros used as needed.

    Minor adjustments had to be made to the common code to work with the
    LG-array macros, mostly the fixup_cmdtable() calls are now passed the
    ll_entry_start and ll_entry_count instead of linker-generated symbols.

    The command.c had to be adjusted as well so it would use the newly
    introduced LG-array API instead of directly using linker-generated
    symbols.

    Signed-off-by: Marek Vasut
    Cc: Joe Hershberger
    Cc: Mike Frysinger

    Marek Vasut
     

07 Mar, 2012

2 commits


24 Oct, 2011

1 commit


18 Oct, 2011

1 commit


16 Oct, 2011

1 commit


26 Jul, 2011

1 commit


10 Jan, 2011

1 commit


29 Nov, 2010

1 commit

  • Rather than add runtime overhead of installing completion handlers, do it
    statically at build time. This requires a new build time helper macro to
    declare a command and the completion handler at the same time. Then we
    convert the env related funcs over to this.

    This gives an opportunity to also unify the U_BOOT_CMD macros.

    Signed-off-by: Mike Frysinger

    Mike Frysinger
     

28 Nov, 2010

1 commit

  • Guard strchr/strlen from being called with NULL pointer.
    This line is crashing when command "env" is called without subcommand.

    The cmd is NULL in this case because the calling function "do_env"
    decremented the argc without checking if there are still arguments available.

    Signed-off-by: Thomas Weber

    Thomas Weber
     

30 Oct, 2010

1 commit

  • By now, the majority of architectures have working relocation
    support, so the few remaining architectures have become exceptions.
    To make this more obvious, we make working relocation now the default
    case, and flag the remaining cases with CONFIG_NEEDS_MANUAL_RELOC.

    Signed-off-by: Wolfgang Denk
    Tested-by: Heiko Schocher
    Tested-by: Reinhard Meyer

    Wolfgang Denk
     

20 Sep, 2010

2 commits

  • fixup_cmdtable() did all work for fixing up the cmdtable,
    if CONFIG_RELOC_FIXUP_WORKS is not defined.

    CONFIG_RELOC_FIXUP_WORKS is missing for i386! I talked
    with Graeme Russ, and he will fix this soon.

    Portions of this work were supported by funding from
    the CE Linux Forum.

    Signed-off-by: Heiko Schocher

    Heiko Schocher
     
  • Motivation:

    * Old environment code used a pessimizing implementation:
    - variable lookup used linear search => slow
    - changed/added variables were added at the end, i. e. most
    frequently used variables had the slowest access times => slow
    - each setenv() would calculate the CRC32 checksum over the whole
    environment block => slow
    * "redundant" envrionment was locked down to two copies
    * No easy way to implement features like "reset to factory defaults",
    or to select one out of several pre-defined (previously saved) sets
    of environment settings ("profiles")
    * No easy way to import or export environment settings

    ======================================================================

    API Changes:

    - Variable names starting with '#' are no longer allowed

    I didn't find any such variable names being used; it is highly
    recommended to follow standard conventions and start variable names
    with an alphanumeric character

    - "printenv" will now print a backslash at the end of all but the last
    lines of a multi-line variable value.

    Multi-line variables have never been formally defined, allthough
    there is no reason not to use them. Now we define rules how to deal
    with them, allowing for import and export.

    - Function forceenv() and the related code in saveenv() was removed.
    At the moment this is causing build problems for the only user of
    this code (schmoogie - which has no entry in MAINTAINERS); may be
    fixed later by implementing the "env set -f" feature.

    Inconsistencies:

    - "printenv" will '\\'-escape the '\n' in multi-line variables, while
    "printenv var" will not do that.

    ======================================================================

    Advantages:

    - "printenv" output much better readable (sorted)
    - faster!
    - extendable (additional variable properties can be added)
    - new, powerful features like "factory reset" or easy switching
    between several different environment settings ("profiles")

    Disadvantages:

    - Image size grows by typically 5...7 KiB (might shrink a bit again on
    systems with redundant environment with a following patch series)

    ======================================================================

    Implemented:

    - env command with subcommands:

    - env print [arg ...]

    same as "printenv": print environment

    - env set [-f] name [arg ...]

    same as "setenv": set (and delete) environment variables

    ["-f" - force setting even for read-only variables - not
    implemented yet.]

    - end delete [-f] name

    not implemented yet

    ["-f" - force delete even for read-only variables]

    - env save

    same as "saveenv": save environment

    - env export [-t | -b | -c] addr [size]

    export internal representation (hash table) in formats usable for
    persistent storage or processing:

    -t: export as text format; if size is given, data will be
    padded with '\0' bytes; if not, one terminating '\0'
    will be added (which is included in the "filesize"
    setting so you can for exmple copy this to flash and
    keep the termination).
    -b: export as binary format (name=value pairs separated by
    '\0', list end marked by double "\0\0")
    -c: export as checksum protected environment format as
    used for example by "saveenv" command
    addr: memory address where environment gets stored
    size: size of output buffer

    With "-c" and size is NOT given, then the export command will
    format the data as currently used for the persistent storage,
    i. e. it will use CONFIG_ENV_SECT_SIZE as output block size and
    prepend a valid CRC32 checksum and, in case of resundant
    environment, a "current" redundancy flag. If size is given, this
    value will be used instead of CONFIG_ENV_SECT_SIZE; again, CRC32
    checksum and redundancy flag will be inserted.

    With "-b" and "-t", always only the real data (including a
    terminating '\0' byte) will be written; here the optional size
    argument will be used to make sure not to overflow the user
    provided buffer; the command will abort if the size is not
    sufficient. Any remainign space will be '\0' padded.

    On successful return, the variable "filesize" will be set.
    Note that filesize includes the trailing/terminating '\0'
    byte(s).

    Usage szenario: create a text snapshot/backup of the current
    settings:

    => env export -t 100000
    => era ${backup_addr} +${filesize}
    => cp.b 100000 ${backup_addr} ${filesize}

    Re-import this snapshot, deleting all other settings:

    => env import -d -t ${backup_addr}

    - env import [-d] [-t | -b | -c] addr [size]

    import external format (text or binary) into hash table,
    optionally deleting existing values:

    -d: delete existing environment before importing;
    otherwise overwrite / append to existion definitions
    -t: assume text format; either "size" must be given or the
    text data must be '\0' terminated
    -b: assume binary format ('\0' separated, "\0\0" terminated)
    -c: assume checksum protected environment format
    addr: memory address to read from
    size: length of input data; if missing, proper '\0'
    termination is mandatory

    - env default -f

    reset default environment: drop all environment settings and load
    default environment

    - env ask name [message] [size]

    same as "askenv": ask for environment variable

    - env edit name

    same as "editenv": edit environment variable

    - env run

    same as "run": run commands in an environment variable

    ======================================================================

    TODO:

    - drop default env as implemented now; provide a text file based
    initialization instead (eventually using several text files to
    incrementally build it from common blocks) and a tool to convert it
    into a binary blob / object file.

    - It would be nice if we could add wildcard support for environment
    variables; this is needed for variable name auto-completion,
    but it would also be nice to be able to say "printenv ip*" or
    "printenv *addr*"

    - Some boards don't link any more due to the grown code size:
    DU405, canyonlands, sequoia, socrates.

    => cc: Matthias Fuchs ,
    Stefan Roese ,
    Heiko Schocher

    - Dropping forceenv() causes build problems on schmoogie

    => cc: Sergey Kubushyn

    - Build tested on PPC and ARM only; runtime tested with NOR and NAND
    flash only => needs testing!!

    Signed-off-by: Wolfgang Denk
    Cc: Matthias Fuchs ,
    Cc: Stefan Roese ,
    Cc: Heiko Schocher
    Cc: Sergey Kubushyn

    Wolfgang Denk
     

25 Jul, 2010

1 commit

  • 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

    Wolfgang Denk
     

05 Jul, 2010

1 commit

  • 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
    Acked-by: Mike Frysinger

    Wolfgang Denk
     

06 May, 2010

1 commit


23 Nov, 2009

1 commit


13 Jun, 2009

2 commits

  • 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

    Wolfgang Denk
     
  • In case of incorrect command invocations U-Boot used to print pretty
    useless "usage" messages, for example:

    => nand markbad
    Usage:
    nand - NAND sub-system

    In the result, the user would have to run the "help" command to get
    the (available) information about correct command usage. Change this,
    so that this information gets always printed.

    Note that this changes the user interface of all commands, but
    hopefully to the better.

    Signed-off-by: Wolfgang Denk

    Wolfgang Denk
     

28 Mar, 2009

1 commit


28 Jan, 2009

2 commits


19 Oct, 2008

2 commits


11 Sep, 2008

1 commit


21 May, 2008

1 commit

  • 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

    Wolfgang Denk
     

11 Jul, 2007

1 commit