Commit Graph

68675 Commits

Author SHA1 Message Date
David Woodhouse
b0493bb75a env/ext4.c: allow loading from an EXT4 partition on the MMC boot device
This parallels what I added for FAT in commit 6731bef696, allowing the
environment to be found in a specific partition on the device that the
board's mmc_get_env_dev() returns. On the Banana Pi R2 that means the
device that U-Boot was loaded from; either the internal eMMC or an SD
card.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2020-10-14 11:16:34 -04:00
David Woodhouse
4dee3f7851 mmc: remove duplicate mmc_get_env_dev() implementations
Since it's so trivial I could just about tolerate this when there were only
two copies of it. But now there are about to be three.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2020-10-14 11:16:34 -04:00
Heinrich Schuchardt
684710dc33 arm: enable DM_RNG on QEMU by default
The EFI_RNG_PROTOCOL is needed for address randomization in Linux.
We should provide it by default on QEMU.

Reported-by: François Ozog <francois.ozog@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-10-14 11:16:34 -04:00
Heinrich Schuchardt
a6bfd71a96 cmd/button: return button status
To make the button command useful in a shell script it should return the
status of the button:

* 0 (true) - pressed, on
* 1 (false) - not pressed, off

The button command takes only one argument. Correct maxargs.

Adjust the Python unit test.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-10-14 11:16:34 -04:00
Heinrich Schuchardt
7cd96a4728 drivers: gpio: keep output value for input on sandbox
For testing purposes keep the output value when switching to input.
This allows us to manipulate the input value via the gpio command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-10-14 11:16:34 -04:00
Heinrich Schuchardt
39916bb45f test: sharpen button label unit test
Using different strings for the device tree node labels and the label
property of buttons sharpens the button label unit test.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-10-14 11:16:34 -04:00
Frédéric Danis
9ea0a1ee93 cmd: Fixup DT to pass PStore Ramoops parameters
To simplify configuration and keep synchronized the PStore/Ramoops between
U-Boot and the Linux kernel, this commit dynamically adds the Ramoops
parameters defined in the U-Boot session to the Device Tree.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
2020-10-14 11:16:34 -04:00
Frédéric Danis
26f555a6e5 test: Add PStore command tests
Add PStore command to sandbox and sandbox64 defconfigs.
Add test checking:
- 'pstore display' of all records
- 'pstore display' only the 2nd dump record
- 'pstore save' of all records

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
[trini: Adjust to always load files from source directory]
Signed-off-by: Tom Rini <trini@konsulko.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
2020-10-14 11:16:34 -04:00
Frédéric Danis
9744d1a547 cmd: Add command to display or save Linux PStore dumps
This patch adds a new pstore command allowing to display or save ramoops
logs (oops, panic, console, ftrace and user) generated by a previous
kernel crash.
PStore parameters can be set in U-Boot configuration file, or at run-time
using "pstore set" command. Records size should be the same as the ones
used by kernel, and should be a power of 2.
This command allows:
- to display uncompressed logs
- to save compressed or uncompressed logs, compressed logs are saved as a
  compressed stream, it may need some work to be able to decompress it,
  e.g. adding a fake header:
  "printf "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x00" |
  cat - dmesg-ramoops-0.enc.z | gzip -dc"
- ECC part is not used to check memory corruption
- only 1st FTrace log is displayed or saved

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
[trini: Minor updates for current design, correct spacing in rST]
Signed-off-by: Tom Rini <trini@konsulko.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
2020-10-14 11:16:19 -04:00
Tom Rini
55fca74a5b Merge branch '2020-10-12-assorted-encryption-changes'
- Fix verified boot on BE targets
- Add support for multiple required keys in verified boots
- Add support for Initialization Vectors in AES keys in FIT images
- Assorted fixes in the RSA code
2020-10-13 10:04:17 -04:00
Heinrich Schuchardt
ec71cc34c1 lib: rsa: superfluous initialization in rsa_verify()
Remove initialization of ret with unused value.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-12 21:30:38 -04:00
Rasmus Villemoes
3f8808ebaa rsa: fix retrieving public exponent on big-endian systems
Commit fdf0819afb (rsa: fix alignment issue when getting public
exponent) changed the logic to avoid doing an 8-byte access to a
possibly-not-8-byte-aligned address.

However, using rsa_convert_big_endian is wrong: That function converts
an array of big-endian (32-bit) words with the most significant word
first (aka a BE byte array) to an array of cpu-endian words with the
least significant word first. While the exponent is indeed _stored_ as
a big-endian 64-bit word (two BE words with MSW first), we want to
extract it as a cpu-endian 64 bit word. On a little-endian host,
swapping the words and byte-swapping each 32-bit word works, because
that's the same as byte-swapping the whole 64 bit word. But on a
big-endian host, the fdt32_to_cpu are no-ops, but
rsa_convert_big_endian() still does the word-swapping, breaking
verified boot.

To fix that, while still ensuring we don't do unaligned accesses, add
a little helper that first memcpy's the bytes to a local fdt64_t, then
applies fdt64_to_cpu(). [The name is chosen based on the
[bl]eXX_to_cpup in linux/byteorder/generic.h].

Fixes: fdf0819afb ("rsa: fix alignment issue when getting public exponent")
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-12 21:30:38 -04:00
Matthieu CASTET
167fb1f8dc lib: rsa: check algo match in rsa_verify_with_keynode
The algo name should match between the FIT's signature node and the
U-Boot's control FDT.

If we do not check it, U-Boot's control FDT can expect sha512 hash but
nothing will prevent to accept image with sha1 hash if the signature is correct.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
2020-10-12 21:30:38 -04:00
Philippe Reynes
54ab7cf1dd fit: cipher: aes: allow to read the IV in the FIT image
This commit add the support in u-boot to read the IV
in the FIT image instead of u-boot device tree.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-10-12 21:30:38 -04:00
Philippe Reynes
a6982a6f76 fit: cipher: aes: allow to store the IV in the FIT image
Binaries may be encrypted in a FIT image with AES. This
algo needs a key and an IV (Initialization Vector). The
IV is provided in a file (pointer by iv-name-hint in the
ITS file) when building the ITB file.

This commits adds provide an alternative way to manage
the IV. If the property iv-name-hint is not provided in
the ITS file, the tool mkimage will generate an random
IV and store it in the FIT image.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-10-12 21:30:37 -04:00
Heinrich Schuchardt
34ca77c1e1 lib/hashtable: remove superfluous check
We assign first_deleted = 0. There is no need to check its value without
any further assignment in between.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-12 21:30:37 -04:00
Thirupathaiah Annapureddy
6a0498a5fd doc: verified-boot: add required-mode information
Add documentation about 'required-mode' property in /signature node
in U-Boot's control FDT.

Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-12 21:30:37 -04:00
Thirupathaiah Annapureddy
feaeee8b5f test: vboot: add tests for multiple required keys
This patch adds vboot tests to verify the support for multiple
required keys using new required-mode DTB policy.

This patch also fixes existing test where dev
key is assumed to be marked as not required, although
it is marked as required.

Note that this patch re-added sign_fit_norequire().
sign_fit_norequire() was removed as part of the following:
commit b008677daf ("test: vboot: Fix pylint errors").
This patch leverages sign_fit_norequire() to fix the
existing bug.

Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-12 21:30:37 -04:00
Thirupathaiah Annapureddy
182eeefcb4 vboot: add DTB policy for supporting multiple required conf keys
Currently FIT image must be signed by all required conf keys. This means
Verified Boot fails if there is a signature verification failure
using any required key in U-Boot DTB.

This patch introduces a new policy in DTB that can be set to any required
conf key. This means if verified boot passes with one of the required
keys, U-Boot will continue the OS hand off.

There were prior attempts to address this:
https://lists.denx.de/pipermail/u-boot/2019-April/366047.html
The above patch was failing "make tests".
https://lists.denx.de/pipermail/u-boot/2020-January/396629.html

Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-12 21:30:37 -04:00
Tom Rini
9885313b9a Merge branch 'for-next' of https://github.com/lftan/u-boot 2020-10-12 07:55:17 -04:00
Tom Rini
47e9c70421 Merge tag 'ti-v2021.01-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
- Minor cleanup on K3 env variables
- Fix OSPI compatible for J721e
- Drop unused property in omap-usb2-phy
- Update Maintainer for am335x-guardian board.
2020-10-12 07:26:57 -04:00
Vignesh Raghavendra
555ee39493 phy: omap-usb2-phy: Drop usage of "ti, dis-chg-det-quirk" DT property
"ti,dis-chg-det-quirk" property is not part of Linux kernel DT binding
documentation.  Therefore drop this and instead use soc_device_match()
to distinguish b/w AM654 SR1.0 and SR2.0 devices similar to Linux kernel
driver.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2020-10-12 08:11:11 +05:30
Nishanth Menon
87b4521fd8 configs: am65x_evm: Use DEFAULT_LINUX_BOOT_ENV and remove overlayaddr
Use DEFAULT_LINUX_BOOT_ENV to define the standard addresses used in rest
of TI platforms as defined in ti_armv7_common.h

This avoids the standard pitfalls we've had with kernel images and fdt
addresses stomping on each other.

As part of this process, redefine overlayaddr to be dtboaddr (defined
in ti_armv7_common.h for this very purpose) and get rid of the
definition of overlayaddr..

Signed-off-by: Nishanth Menon <nm@ti.com>
2020-10-12 08:09:53 +05:30
Nishanth Menon
a9cdba9cc1 configs: j721e_evm: Get rid of overlayaddr
Now that we dont have any further users of overlayaddr, get rid of it.

Signed-off-by: Nishanth Menon <nm@ti.com>
2020-10-12 08:09:53 +05:30
Nishanth Menon
cb56936ce5 env: ti: ufs: Use dtboaddr instead of overlayaddr
Use dtboaddr to define the overlay address common to all TI platforms
instead of creating a new overlayaddr for the purpose.

Signed-off-by: Nishanth Menon <nm@ti.com>
2020-10-12 08:09:53 +05:30
Nishanth Menon
25364f5ec8 configs: j721e_evm: Use DEFAULT_LINUX_BOOT_ENV
Use DEFAULT_LINUX_BOOT_ENV to define the standard addresses used in rest
of TI platforms as defined in ti_armv7_common.h

This avoids the standard pitfalls we've had with kernel images and fdt
addresses stomping on each other.

As part of this process, redefine overlayaddr to be dtboaddr (defined
in ti_armv7_common.h for this very purpose).. we will get rid of
overlayaddr later in the series.

Signed-off-by: Nishanth Menon <nm@ti.com>
2020-10-12 08:09:53 +05:30
Vignesh Raghavendra
85bdcf03b7 dma: ti: k3-udma: Reset the channel during release
Reset the channel completely during channel release in order to clear
teardown bit before handing over to next user or jumping to Linux.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
2020-10-12 08:09:18 +05:30
Vignesh Raghavendra
6d7364016a configs: am335x_evm_defconfig: Enable CONFIG_OF_LIBFDT_OVERLAY
This enables applying DTBOs at U-Boot prompt before booting to kernel.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2020-10-12 08:08:28 +05:30
Vignesh Raghavendra
5a8a7a95a0 board: ti: j721e: Fix OSPI node compatible
Update detect_enable_hyperflash() to look for "ti,am654-ospi" compatible
to match the upstream DT node.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2020-10-12 08:07:41 +05:30
Moses Christopher
381c5c163c am335x, guardian: update the maintainer list
I am leaving Bosch, so replacing myself with Gireesh

Signed-off-by: Moses Christopher <BollavarapuMoses.Christopher@in.bosch.com>
2020-10-12 08:03:38 +05:30
Tom Rini
726561a941 Merge branch '2020-10-10-log-improvements'
- Assorted improvements to our log functionality.
2020-10-11 15:22:05 -04:00
Heinrich Schuchardt
1ecb6beb95 doc: remove redundant doc/README.log
doc/README.log was already moved to doc/develop/logging.rst but has been
recreated by an incorrect merge.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-10 16:50:35 -04:00
Sean Anderson
a4326612ac log: syslog: Handle errors in net_init
Since the previous patch, net_init now exposes some errors, so check for
them.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-10 16:50:12 -04:00
Sean Anderson
c3f0278e29 net: Expose some errors generated in net_init
net_init does not always succeed, and there is no existing mechanism to
discover errors. This patch allows callers of net_init (such as net_init)
to handle errors. The root issue is that eth_get_dev can fail, but
net_init_loop doesn't expose that. The ideal way to fix eth_get_dev would
be to return an error with ERR_PTR, but there are a lot of callers, and all
of them just check if it's NULL. Another approach would be to change the
signature to something like

int eth_get_dev(struct udevice **pdev)

but that would require rewriting all of the many callers.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-10 16:50:12 -04:00
Simon Glass
c7f5b85034 log: Disable the syslog driver by default
This driver interferes with other sandbox tests since it causes log output
to be interspersed with "No ethernet found." messages. Disable this driver
by default.

Enable it for the syslog tests so that they still pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-10 16:50:11 -04:00
Simon Glass
3d03ab6361 log: Add a way to enable/disable a log device
At present all log devices are enabled by default. Add a function to allow
devices to be disabled or enabled at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-10 16:50:11 -04:00
Simon Glass
bd180db2cc log: Drop #ifdef in log_test
This is not needed as the Makefile only builds the file if CONFIG_LOG_TEST
is enabled. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-10 16:50:11 -04:00
Simon Glass
b45203004e log: Add a flag to enable log drivers
At present there is no way to disable a log driver. But the syslog driver
causes (attempted) network traffic in sandbox every time a log message
is printed, which is often.

Add a flag to enable a log driver. Adjust struct log_device to use a short
for next_filter_num so that no more memory is used for devices. Also fix
a missing line in the struct log_driver comment while here.

To maintain compatibility, enable it for all drivers for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-10 16:50:11 -04:00
Simon Glass
26637e2e4c lib: Allow hexdump to be used in SPL
It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2020-10-10 16:49:58 -04:00
Simon Glass
52d3df7fef log: Allow LOG_DEBUG to always enable log output
At present if CONFIG_LOG enabled, putting LOG_DEBUG at the top of a file
(before log.h inclusion) causes _log() to be executed for every log()
call, regardless of the build- or run-time logging level.

However there is no guarantee that the log record will actually be
displayed. If the current log level is lower than LOGL_DEBUG then it will
not be.

Add a way to signal that the log record should always be displayed and
update log_passes_filters() to handle this.

With the new behaviour, log_debug() will always log if LOG_DEBUG is
enabled.

Move log_test_syslog_nodebug() into its own file since it cannot be made
to work where it is, with LOG_DEBUG defined.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-10 16:49:58 -04:00
Tom Rini
0437cc4155 Merge branch '2020-10-09-kconfig-reorg'
- Re-organize a number of Kconfig related entries to be better organized
  for long term maintenance.
2020-10-09 18:10:24 -04:00
Tom Rini
0817daa760 configs: Resync with savedefconfig
Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2020-10-09 12:22:06 -04:00
Simon Glass
1fa057be4a Kconfig: Create a new tools menu
At present MKIMAGE_DTC_PATH is in the devicetree menu but not within
'devicetree control' since it does not relate to that. As a result it
shows up in the top menu.

It actually relates to the mkimage tool, so create a new tools menu for it
and move it there.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-09 12:02:26 -04:00
Simon Glass
a4c4ecf4c9 Kconfig: Move BOARD_TYPES under init options
This actually relates to something displayed on start-up, so move it into
that menu.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-09 12:02:26 -04:00
Simon Glass
d472d821f3 Kconfig: Move BOUNCE_BUFFER under driver options
This option does not belong at the top level. Move it under generic
driver options.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-09 12:02:25 -04:00
Simon Glass
bc438b6e9a Kconfig: Move VERSION_VARIABLE under environment
This relates to the environment so should not be at the top level. Move
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-09 12:01:55 -04:00
Simon Glass
7e349e9669 Kconfig: MISC_INIT_R and BOARD_LATE_INIT -> start-up hooks
These are start-up hooks so put them under that menu.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-09 12:01:55 -04:00
Simon Glass
386631365d Kconfig: Move startup hooks under init options
These hooks relate to U-Boot init so move them under that menu.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-09 12:01:55 -04:00
Simon Glass
7df39e5b95 Kconfig: Create a new 'init options' menu
There are quite a few options at the top level relating to U-Boot init.
Move them into their own menu.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-09 12:01:55 -04:00
Simon Glass
832876a46a Kconfig: Move DEFAULT_FDT_FILE under boot options
This relates to booting since it is the default devicetree provided to
Linux. Move it under the 'boot options' menu.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-09 12:01:55 -04:00