1. 21 8月, 2018 2 次提交
    • J
      cmd: Add bind/unbind commands to bind a device to a driver from the command line · 49c752c9
      Jean-Jacques Hiblot 提交于
      In some cases it can be useful to be able to bind a device to a driver from
      the command line.
      The obvious example is for versatile devices such as USB gadget.
      Another use case is when the devices are not yet ready at startup and
      require some setup before the drivers are bound (ex: FPGA which bitsream is
      fetched from a mass storage or ethernet)
      
      usage example:
      
      bind usb_dev_generic 0 usb_ether
      unbind usb_dev_generic 0 usb_ether
      or
      unbind eth 1
      
      bind /ocp/omap_dwc3@48380000/usb@48390000 usb_ether
      unbind /ocp/omap_dwc3@48380000/usb@48390000
      Signed-off-by: NJean-Jacques Hiblot <jjhiblot@ti.com>
      49c752c9
    • S
      cmd: fastboot: Validate user input · aa51579f
      Sam Protsenko 提交于
      In case when user provides '-' as USB controller index, like this:
      
          => fastboot -
      
      data abort occurs in strcmp() function in do_fastboot(), here:
      
          if (!strcmp(argv[1], "udp"))
      
      (tested on BeagleBone Black).
      
      That's because argv[1] is NULL when user types in the '-', and null
      pointer dereference occurs in strcmp() (which is ok according to C
      standard specification). So we must validate user input to prevent such
      behavior.
      
      While at it, check also the result of strtoul() function and handle
      error cases properly.
      Signed-off-by: NSam Protsenko <semen.protsenko@linaro.org>
      Reviewed-by: NSimon Glass <sjg@chromium.org>
      Reviewed-by: NLukasz Majewski <lukma@denx.de>
      aa51579f
  2. 18 8月, 2018 1 次提交
  3. 11 8月, 2018 2 次提交
  4. 10 8月, 2018 1 次提交
  5. 30 7月, 2018 4 次提交
  6. 28 7月, 2018 1 次提交
    • M
      tpm: allow TPM v1 and v2 to be compiled at the same time · 2a2096ea
      Miquel Raynal 提交于
      While there is probably no reason to do so in a real life situation, it
      will allow to compile test both stacks with the same sandbox defconfig.
      
      As we cannot define two 'tpm' commands at the same time, the command for
      TPM v1 is still called 'tpm' and the one for TPM v2 'tpm2'. While this
      is the exact command name that must be written into eg. test files, any
      user already using the TPM v2 stack can continue to do so by just writing
      'tpm' because as long as TPM v1 support is not compiled, U-Boot prompt
      will search for the closest command named after 'tpm'.
      
      The command set can also be changed at runtime (not supported yet, but
      ready to be), but as one can compile only either one stack or the other,
      there is still one spot in the code where conditionals are used: to
      retrieve the v1 or v2 command set.
      Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
      Reviewed-by: NSimon Glass <sjg@chromium.org>
      [trini: In sandbox_tpm2_fill_buf() use NULL not \0 to ensure NULL
      terminated string due to LLVM warning]
      Signed-off-by: NTom Rini <trini@konsulko.com>
      2a2096ea
  7. 27 7月, 2018 1 次提交
  8. 26 7月, 2018 1 次提交
    • T
      cmd/ubi.c: Fix format warning · 13415337
      Tom Rini 提交于
      On 64bit platforms we would otherwise see:
      ../cmd/ubi.c: In function 'ubi_volume_read':
      ../cmd/ubi.c:359:16: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'size_t {aka long unsigned int}' [-Wformat=]
      
      Fixes: 68c7025d ("cmd: ubi: print load size after establishing volume size")
      Signed-off-by: NTom Rini <trini@konsulko.com>
      13415337
  9. 25 7月, 2018 7 次提交
  10. 24 7月, 2018 2 次提交
  11. 23 7月, 2018 1 次提交
  12. 21 7月, 2018 2 次提交
    • Q
      cmd: nvedit: env import can now import only variables passed as parameters · eaf73472
      Quentin Schulz 提交于
      While the `env export` can take as parameters variables to be exported,
      `env import` does not have such a mechanism of variable selection.
      
      Let's add the ability to add parameters at the end of the command for
      variables to be imported.
      
      Every env variable from the env to be imported passed by parameter to
      this command will override the value of the variable in the current env.
      
      If a variable exists in the current env but not in the imported env, if
      this variable is passed as a parameter to env import, the variable will
      be unset ONLY if the -d option is passed to env import, otherwise the
      current value of the variable is kept.
      
      If a variable exists in the imported env, the variable in the current
      env will be set to the value of the one from the imported env.
      
      All the remaining variables are left untouched.
      
      As the size parameter of env import is positional but optional, let's
      add the possibility to use the sentinel '-' for when we don't want to
      give the size parameter (when the env is '\0' terminated) but we pass a
      list of variables at the end of the command.
      
      env import addr
      env import addr -
      env import addr size
      env import addr - foo1 foo2
      env import addr size foo1 foo2
      
      are all valid.
      
      env import -c addr
      env import -c addr -
      env import -c addr - foo1 foo2
      
      are all invalid because they don't pass the size parameter required for
      checking, while the following are valid.
      
      env import addr size
      env import addr size foo1 foo2
      
      Nothing's changed for the other parameters or the overall behaviour.
      
      One of its use case could be to load a secure environment from the
      signed U-Boot binary and load only a handful of variables from an
      other, unsecure, environment without completely losing control of
      U-Boot.
      Signed-off-by: NQuentin Schulz <quentin.schulz@bootlin.com>
      Tested-by: NAlex Kiernan <alex.kiernan@gmail.com>
      Tested-by: NStephen Warren <swarren@nvidia.com>
      eaf73472
    • Q
      env: add the same prefix to error messages to make it detectable by tests · 6c90f623
      Quentin Schulz 提交于
      The error message should start with `## Error: ` so that it's easily
      detectable by tests without needing to have a complex regexp for
      matching all possible error message patterns.
      
      Let's add the `## Error: ` prefix to the error messages since it's the
      one already in use.
      Suggested-by: NStephen Warren <swarren@wwwdotorg.org>
      Signed-off-by: NQuentin Schulz <quentin.schulz@bootlin.com>
      Reviewed-by: NSimon Glass <sjg@chromium.org>
      Reviewed-by: NStephen Warren <swarren@nvidia.com>
      Tested-by: NStephen Warren <swarren@nvidia.com>
      6c90f623
  13. 20 7月, 2018 5 次提交
    • Y
      env: common: accept flags on reset to default env · c5d548a9
      Yaniv Levinsky 提交于
      The function set_default_env() sets the hashtable flags for import_r().
      Formally set_default_env() doesn't accept flags from its callers. In
      practice the caller can (un)set the H_INTERACTIVE flag, but it has to be
      done using the first character of the function's string argument. Other
      flags like H_FORCE can't be set by the caller.
      
      Change the function to accept flags argument. The benefits are:
      1. The caller will have to explicitly set the H_INTERACTIVE flag,
         instead of un-setting it using a special char in a string.
      2. Add the ability to propagate flags from the caller to himport(),
         especially the H_FORCE flag from do_env_default() in nvedit.c that
         currently gets ignored for "env default -a -f" commands.
      3. Flags and messages will not be coupled together. A caller will be
         able to set flags without passing a string and vice versa.
      
      Please note:
      The propagation of H_FORCE from do_env_default() does not introduce any
      functional changes, because currently himport_r() is set to destroy the
      old environment regardless if H_FORCE flag is set or not. More changes
      are needed to utilize the propagation of H_FORCE.
      Signed-off-by: NYaniv Levinsky <yaniv.levinsky@compulab.co.il>
      Acked-by: NIgor Grinberg <grinberg@compulab.co.il>
      c5d548a9
    • Y
      cmd: nvedit: set H_INTERACTIVE in do_env_default · 5a04264e
      Yaniv Levinsky 提交于
      The function set_default_vars() in common.c adds H_INTERACTIVE to the
      h_import() flag, but the function has no way of telling if the command
      actually was user directed like this flag suggest. The flag should be
      set by the calling function do_env_default() in nvedit.c instead, where
      the command is certainty user directed.
      
      Move the H_INTERACTIVE flag from set_default_vars() to do_env_default().
      Signed-off-by: NYaniv Levinsky <yaniv.levinsky@compulab.co.il>
      Acked-by: NIgor Grinberg <grinberg@compulab.co.il>
      5a04264e
    • Y
      cmd: nvedit: propagate envflag to set_default_vars · 477f8116
      Yaniv Levinsky 提交于
      The env_flag in do_env_default() doesn't get propagated and therefore
      gets ignored by himport_r(). This breaks to ability to "forcibly" reset
      variables to their default values using the environment command.
      
      Scenario example of the problem:
      	# setenv kernel uImage
      	# setenv .flags kernel:so
      	# env default -f kernel
      	## Error: Can't overwrite "kernel"
      	himport_r: can't insert "kernel=zImage" into hash table
      
      Change the call path so it will pass the flag correctly.
      Signed-off-by: NYaniv Levinsky <yaniv.levinsky@compulab.co.il>
      Acked-by: NIgor Grinberg <grinberg@compulab.co.il>
      477f8116
    • Y
      cmd: nvedit: rename flags in do_env_default · 30091494
      Yaniv Levinsky 提交于
      The naming convention for flags in nvedit.c is:
      * The hashtable flag (defined in search.h) is named "env_flag"
      * The command flag argument (defined in command.h) is named "flag"
      
      This convention is kept in functions like do_env_print(), do_env_set()
      and do_env_delete(), but not in do_env_default().
      
      Rename the hashtable flag in do_env_default() from "flag" to "env_flag".
      Rename the command flag in do_env_default() from "__flag" to "flag".
      
      No functional change.
      Signed-off-by: NYaniv Levinsky <yaniv.levinsky@compulab.co.il>
      Reviewed-by: NIgor Grinberg <grinberg@compulab.co.il>
      30091494
    • A
      cmd: fit_image: Add default property for FIT format scripts · 201d9cd2
      Alex Kiernan 提交于
      When sourcing a FIT format script, if we've not been told the unit name
      to use, look for a default property at the root of /images to work out
      which unit we should use.
      Signed-off-by: NAlex Kiernan <alex.kiernan@gmail.com>
      Reviewed-by: NSimon Glass <sjg@chromium.org>
      201d9cd2
  14. 12 7月, 2018 2 次提交
    • S
      cmd: ubi: Add additional message upon UBI attach error · 4a94e53b
      Stefan Roese 提交于
      When trying to attach an UBI MTD partition via "ubi part", it may happen
      that the MTD partition defined in U-Boot (via mtdparts) is not big
      enough than the one, where the UBI device has been created on. This
      may lead to errors, which are not really descriptive to debug and
      solve this issue, like:
      
      ubi0 error: vtbl_check: too large reserved_pebs 1982, good PEBs 1020
      ubi0 error: vtbl_check: volume table check failed: record 0, error 9
      
      or:
      
      ubi0 error: init_volumes: not enough PEBs, required 1738, available 1020
      ubi0 error: ubi_wl_init: no enough physical eraseblocks (-718, need 1)
      ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -12
      
      Lets add an additional message upon attach failure, to aid the U-Boot
      user to solve this problem.
      Signed-off-by: NStefan Roese <sr@denx.de>
      Cc: Stefano Babic <sbabic@denx.de>
      Cc: Heiko Schocher <hs@denx.de>
      4a94e53b
    • S
      cmd: ubi: print load size after establishing volume size · 68c7025d
      Stefan Agner 提交于
      When using static volumes, the file size stored in the volume is
      determined at runtime. Currently the ubi command prints the file
      size specified on the console, which leads to a rather confusing
      series of messages:
        # ubi read ${fdt_addr_r} testvol
        Read 0 bytes from volume testvol to 82000000
        No size specified -> Using max size (179924992)
      
      Make sure to print the actual size read in any case:
        # ubi read ${fdt_addr_r} testvol
        No size specified -> Using max size (179924992)
        Read 179924992 bytes from volume testvol to 82000000
      Signed-off-by: NStefan Agner <stefan.agner@toradex.com>
      68c7025d
  15. 11 7月, 2018 1 次提交
  16. 03 7月, 2018 3 次提交
    • A
      net: Add option to prefer bootp/dhcp serverip · bdce340c
      Alexander Graf 提交于
      Currently we can choose between 2 different types of behavior for the
      serverip variable:
      
        1) Always overwrite it with the DHCP server IP address (default)
        2) Ignore what the DHCP server says (CONFIG_BOOTP_SERVERIP)
      
      This patch adds a 3rd option:
      
        3) Use serverip from DHCP if no serverip is given
           (CONFIG_BOOTP_PREFER_SERVERIP)
      
      With this new option, we can have the default case that a boot file gets
      loaded from the DHCP provided TFTP server work while allowing users to
      specify their own serverip variable to explicitly use a different tftp
      server.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Acked-by: NJoe Hershberger <joe.hershberger@ni.com>
      bdce340c
    • A
      net: Prefer command line arguments · 449312c1
      Alexander Graf 提交于
      We can call commands like dhcp and bootp without arguments or with
      explicit command line arguments that really should tell the code where
      to look for files instead.
      
      Unfortunately, the current code simply overwrites command line arguments
      in the dhcp case with dhcp values.
      
      This patch allows the code to preserve the command line values if they
      were set on the command line. That way the semantics are slightly more
      intuitive.
      
      The reason this patch does that by introducing a new variable is that we
      can not rely on net_boot_file_name[0] being unset, as today it's
      completely legal to call "dhcp" and afterwards run "tftp" and expect the
      latter to repeat the same query as before. I would prefer not to break
      that behavior in case anyone relies on it.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Acked-by: NJoe Hershberger <joe.hershberger@ni.com>
      449312c1
    • L
      net: Add new wol command - Wake on LAN · d8970dae
      Lothar Felten 提交于
      Add a new command 'wol': Wait for an incoming Wake-on-LAN packet or
      time out if no WoL packed is received.
      If the WoL packet contains a password, it is saved in the environment
      variable 'wolpassword' using the etherwake format (dot or colon
      separated decimals).
      
      Intended use case: a networked device should boot an alternate image.
      It's attached to a network on a client site, modifying the DHCP server
      configuration or setup of a tftp server is not allowed.
      After power on the device waits a few seconds for a WoL packet. If a
      packet is received, the device boots the alternate image. Otherwise
      it boots the default image.
      
      This method is a simple way to interact with a system via network even
      if only the MAC address is known. Tools to send WoL packets are
      available on all common platforms.
      
      Some Ethernet drivers seem to pad the incoming packet. The additional
      padding bytes might be recognized as Wake-on-LAN password bytes.
      
      By default enabled in pengwyn_defconfig.
      Signed-off-by: NLothar Felten <lothar.felten@gmail.com>
      Acked-by: NJoe Hershberger <joe.hershberger@ni.com>
      d8970dae
  17. 02 7月, 2018 1 次提交
  18. 24 6月, 2018 1 次提交
  19. 19 6月, 2018 2 次提交