22 Mar, 2019

1 commit


25 Feb, 2019

1 commit


16 Jan, 2019

3 commits

  • Most cmd/xxx.c source files expose several commands through a single
    entry point. Some of them are doing the sub-command parsing manually in
    their do_() function, others are declaring a table of sub-commands
    and then use find_cmd_tbl() to delegate the request to the sub command
    handler.

    In either case, the amount of code to do that is not negligible and
    repetitive, not to mention that almost no commands are implementing
    the auto-completion hook, which means most u-boot commands lack
    auto-completion.

    Provide several macros to easily define commands exposing sub-commands.

    Signed-off-by: Boris Brezillon
    Reviewed-by: Tom Rini

    Boris Brezillon
     
  • The repeatable property is currently attached to the main command and
    sub-commands have no way to change the repeatable value (the
    ->repeatable field in sub-command entries is ignored).

    Replace the ->repeatable field by an extended ->cmd() hook (called
    ->cmd_rep()) which takes a new int pointer to store the repeatable cap
    of the command being executed.

    With this trick, we can let sub-commands decide whether they are
    repeatable or not.

    We also patch mmc and dtimg who are testing the ->repeatable field
    directly (they now use cmd_is_repeatable() instead), and fix the help
    entry manually since it doesn't use the U_BOOT_CMD() macro.

    Signed-off-by: Boris Brezillon
    Reviewed-by: Tom Rini

    Boris Brezillon
     
  • Some commands have a table of sub-commands. With minor adjustments,
    complete_cmdv() is able to provide auto-completion for sub-commands
    (it's just about passing the table of commands instead of taking the
    global one).
    We rename this function into complete_subcmd() and implement
    complete_cmdv() as a wrapper around complete_subcmdv().

    Signed-off-by: Boris Brezillon
    Reviewed-by: Tom Rini

    Boris Brezillon
     

20 Oct, 2018

1 commit


19 Jul, 2018

1 commit

  • command_ret_t enum contains 3 return values but only two are handled
    now. Extend cmd_process_error() and handle CMD_RET_USAGE separately.

    These commands are affected by this change.
    cmd/demo.c
    cmd/efi.c
    cmd/gpio.c
    cmd/qfw.c
    cmd/x86/fsp.c
    test/dm/cmd_dm.c

    And scripts shouldn't be affected because return value is not 0. But
    every command implementation can choose what it is correct to pass.
    I would expect that RET_USAGE is called when parameters are not
    correctly passed (have incorrect value, missing parameters)
    and RET_FAILURE when correct parameters are passed but command fails.

    Signed-off-by: Michal Simek
    Reviewed-by: Simon Glass

    Michal Simek
     

07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

23 Mar, 2018

1 commit


12 Aug, 2017

1 commit


02 Apr, 2016

1 commit


23 Mar, 2016

1 commit

  • When CONFIG_CMDLINE is disabled we need to remove all the command-line
    code. Most can be removed by dropping the appropriate linker lists from the
    images, but sub-commands must be dealt with specially.

    A simple mechanism is used to avoid 'unused static function' errors.

    Signed-off-by: Simon Glass
    Reviewed-by: Tom Rini

    Simon Glass
     

14 Jan, 2016

1 commit

  • Add a 'poweroff' command to boot commands, this only gets enabled if the
    board Kconfig does a "select CMD_POWEROFF".

    Signed-off-by: Michael van Slingerland
    [hdegoede@redhat.com: Make the cmd conditional on a CMD_POWEROFF Kconfig]
    Signed-off-by: Hans de Goede

    Michael van Slingerland
     

07 Dec, 2015

1 commit


28 Jul, 2015

1 commit

  • The sysboot and pxe commands currently support either U-Boot formats or
    raw zImages. Add support for the AArch64 Linux port's native image format
    too.

    As with zImage support, there is no auto-detection of the native image
    format. Rather, if the image is auto-detected as a U-Boot format, U-Boot
    will try to interpret it as such. Otherwise, U-Boot will fall back to a
    raw/native image format, if one is enabled.

    My belief is that CONFIG_CMD_BOOTZ won't ever be enabled for any AArch64
    port, hence there's never a need to differentiate between CONFIG_CMD_
    _BOOTI and _BOOTZ at run-time; compile-time will do. Even if this isn't
    true, we want to prefer _BOOTI over _BOOTZ when defined, since _BOOTI is
    definitely the native format for AArch64.

    Change-Id: I83c5cc7566032afd72516de46f4e5eb7a780284a
    Signed-off-by: Stephen Warren
    Signed-off-by: Tom Warren

    Stephen Warren
     

27 Oct, 2014

1 commit

  • The run command treats each argument an an environment variable. It gets the
    value of each variable and executes it as a command. If an environment
    variable contains a newline and the hush cli is used, it is supposed to
    execute each line one after the other.

    Normally a newline signals to hush to exit - this is used in normal command
    line entry - after a command is entered we want to return to allow the user
    to enter the next one. But environment variables obviously need to execute
    to completion.

    Add a special case for the execution of environment variables which
    continues when a newline is seen, and add a few tests to check this
    behaviour.

    Note: it's not impossible that this may cause regressions in other areas.
    I can't think of a case but with any change of behaviour with limited test
    coverage there is always a risk. From what I can tell this behaviour has
    been around since at least U-Boot 2011.03, although this pre-dates sandbox
    and I have not tested it on real hardware.

    Reported-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     

19 Jun, 2014

1 commit


05 Mar, 2014

1 commit

  • 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
     

24 Jul, 2013

1 commit


25 Jun, 2013

1 commit


13 Mar, 2013

1 commit

  • Refactor linker-generated array code so that symbols
    which were previously linker-generated are now compiler-
    generated. This causes relocation records of type
    R_ARM_ABS32 to become R_ARM_RELATIVE, which makes
    code which uses LGA able to run before relocation as
    well as after.

    Note: this affects more than ARM targets, as linker-
    lists span possibly all target architectures, notably
    PowerPC.

    Conflicts:
    arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
    arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds
    arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
    board/ait/cam_enc_4xx/u-boot-spl.lds
    board/davinci/da8xxevm/u-boot-spl-da850evm.lds
    board/davinci/da8xxevm/u-boot-spl-hawk.lds
    board/vpac270/u-boot-spl.lds

    Signed-off-by: Albert ARIBAUD

    Albert ARIBAUD
     

04 Feb, 2013

1 commit


12 Dec, 2012

1 commit

  • Provide u-boot console functions to access IO space registers. A no
    thrills implementation, accessing one register at a time.

    For example:
    boot > iod 80
    0080: 00000094
    boot > iod.w 80
    0080: 0094
    boot > iod.b 80
    0080: 94
    boot > iow.b 0x80 12
    boot > iod 0x80
    0080: 00000012

    Signed-off-by: Vadim Bendebury
    Signed-off-by: Simon Glass

    Vadim Bendebury
     

22 Oct, 2012

2 commits

  • The command declaration now uses the new LG-array method to generate
    list of commands. Thus the __u_boot_cmd section is now superseded and
    redundant and therefore can be removed. Also, remove externed symbols
    associated with this section from include/command.h .

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

    Marek Vasut
     
  • 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
     

26 Sep, 2012

1 commit


07 Mar, 2012

2 commits


22 Nov, 2011

1 commit

  • Cleanup the cmd_nvedit.c checkpatch warnings, errors and coding style.
    There are 10 wanrings left about the simple_strtoul() function:
    WARNING: simple_strtoul is obsolete, use kstrtoul instead
    #359: FILE: cmd_nvedit.c:359:
    + load_addr = simple_strtoul(argv[2], NULL, 16);

    ...

    total: 0 errors, 10 warnings, 1043 lines checked

    Signed-off-by: Igor Grinberg

    Igor Grinberg
     

18 Oct, 2011

1 commit

  • By default sections are 16-byte aligned on some architectures, but the
    command name structure (struct cmd_tbl_s) does not have padding to
    16 bytes. This reduces the alignment to 4-bytes so that the command
    table can be accessed correctly on any architecture.

    (Note: this needs doing properly)

    Signed-off-by: Simon Glass

    Simon Glass
     

26 Jul, 2011

2 commits


29 Nov, 2010

5 commits


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

1 commit

  • 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
     

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