Commit graph

1958 commits

Author SHA1 Message Date
Sascha Hauer
179d4060e8 Merge branch 'for-next/state' 2016-10-10 08:31:08 +02:00
Sascha Hauer
bfdb14c7da Merge branch 'for-next/misc' 2016-10-10 08:31:07 +02:00
Sascha Hauer
db9c78d579 Merge branch 'for-next/defenv' 2016-10-10 08:31:06 +02:00
Sascha Hauer
c80ba33cbe Merge branch 'for-next/bootchooser' 2016-10-10 08:31:06 +02:00
Sascha Hauer
790980bf18 Make generic default environment type a use choice
So far it was hardcoded for each board if defenv-1 or defenv-2 is used.
Make this a user choice so that a particular board no longer enforces
a defenv type.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-10 08:30:36 +02:00
Sascha Hauer
e4a45c0961 completion: Fix completion for devices with a dot in the name
Devices can have a dot in the name, so do not expect the full
device name before the first dot.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-07 09:09:01 +02:00
Sascha Hauer
f5d77d80f5 Allow device parameters for devices with dots in name
Devices can have a dot in the name, so we can't expect to find the
full device name before the first dot. Currently parameters of devices
with a dot in the name are inaccessible from the shell.
Fix this by iterating over the possible device name / parameter name
combinations to find a existing combination.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-07 09:07:41 +02:00
Lucas Stach
38c0c1105a arm64: don't allow to build relocatable image
The current ARM64 implementation is lacking the lowlevel functions
to do the relocation. Don't allow to select it.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-04 08:12:19 +02:00
Ulrich Ölmann
322890fa62 blspec: fix typo
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-28 08:29:18 +02:00
Ulrich Ölmann
bfe946c959 blspec: fix return value of entry_is_of_compatible()
The function returns a boolean and not an integer. Hence the former
explicit/implicit cast of an ERR_PTR to a boolean has led to a return value of
true although a bootspec entry with a faulty devicetree is not compatible.

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-28 08:28:49 +02:00
Ulrich Ölmann
71f6328d00 blspec: fix erroneus free in entry_is_of_compatible()
Whenever of_unflatten_dtb() encountered an error it already released the memory
before returning the error code. Make this apparent by setting the pointer to
NULL to avoid an erroneus free.

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-27 08:22:17 +02:00
Sam Ravnborg
8b07b925ac environment: "wrong magic" gives the impression of an error
From 15e7ff689cfda27eab10aacda5c26a1ba47979ec Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <srn@skov.dk>
Date: Thu, 22 Sep 2016 06:54:42 +0200
Subject: [PATCH 1/1] environment: "wrong magic" give the impression of an
 error

Introduce a more soft wording when the magic of
the superblock does not match.
Include a hint to the typical reason "(envfs never written?)"

This prevents a "what is wrong?" moment when looking at
the boot log.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-26 08:04:51 +02:00
Marc Kleine-Budde
cc532a3f73 boot: add framework for redundant boot scenarios
There are several use cases where a redundant Linux system is needed. The
barebox bootchooser framework provides the building blocks to model different
use cases without the need to start from the scratch over and over again.

The bootchooser works on abstract boot targets, each with a set of properties
and implements an algorithm which selects the highest priority target to boot.

See the documentation contained in this patch for more information.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:44:23 +02:00
Sascha Hauer
6d8beeaad1 globalvar: introduce globalvar_add_simple_bitmask
Using the just introduced param_bitmask this adds the corresponding
globalvar convenience function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:35:00 +02:00
Sascha Hauer
5cc00c3e2a globalvar: Allow full variable name in globalvar_add
As a convenience for users allow to pass the full name, including
the leading "global.", to globalvar_add().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:31:38 +02:00
Sascha Hauer
f5bf5b9c5a nv: Allow full variable name in nvvar_add
As a convenience for users allow to pass the full name, including
the leading "nv.", to nvvar_add().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:31:34 +02:00
Sascha Hauer
d3e108645b globalvar: Also create globalvars from for nonvolatile device vars
nv variables beginning with "nv.dev.<devname>.<varname>" are directly
mirrored to <devname>.<varname> and there is no globalvar for it. To
make it a bit more consistent and to increase the visibility of the
nonvolatile device variables create globalvars for them aswell.

With this the propagation flow has changed from:

nv.dev.<devname>.<varname>
  -> <devname>.<varname>

to:

nv.dev.<devname>.<varname>
  -> global.dev.<devname>.<varname>
    -> <devname>.<varname>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:31:30 +02:00
Sascha Hauer
ffc6031313 nv: simplify nvvar_add
We do not need to have an extra code path when the variable already
exists, instead setting an existing variable can be done in the
variable creation code path aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:31:25 +02:00
Sascha Hauer
0ad0baac55 globalvar: Allow to remove multiple globalvars using wildcards
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:31:16 +02:00
Sascha Hauer
d60230bded convert users to %pI4
Convert users of ip_to_string() and print_IPaddr() to %pI4 and
remove the now unused functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:30:38 +02:00
Sascha Hauer
8776eca37a globalvar: sync with nvvars
This patch fixes the behaviour when a driver creates a globalvar using
globalvar_add_simple_[string|int|bool|enum|ip]) *after* nvvars are
initialized and this globalvar is overwritten with a nvvar. Currently
this fix is not needed because all globalvars are registered before the
nvvars are initialized.

We have two different typed of globalvars. The first type, here referred
to as qualified globalvars, has a backend variable storage (the ones
created with globalvar_add_simple_[string|int|bool|enum|ip]), the other
created with globalvar_add_simple only has a dynamically allocted string
as backend.

Normally during startup of barebox the qualified globalvars are
registered and during load of nvvars are synced with the values from the
nvvars. Everything works fine in this case. However, when during nvvar
initialisation a globalvar for a nvvar does not exist, then it is
registered as unqualified globalvar. When then later some driver wants
to register a qualified globalvar for which a unqualified globalvar
already exists, it will get a -EEXIST. This is not the expected
behaviour. Instead, the current unqualified globalvar should be removed,
recreated as qualified globalvar and then afterwards synced with the
corresponding nvvar. This behaviour is fixed with this patch.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:30:28 +02:00
Sascha Hauer
5126579f97 globalvar: Move static inline functions to common/
These functions will get bigger in the next patch which disqualifies
them as static inline functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 11:30:23 +02:00
Sascha Hauer
c42e8262c8 nv: Fix variable removal in nvvar_save()
When nv variables are removed during runtime then they are
present again when saved with nvvar_save(). This is because nvvar_save()
does not delete variables that exist on the saved environment. Delete
/nv on the saved environment before saving the new variables.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-22 10:10:18 +02:00
Sascha Hauer
fdf498cf02 state: consistently pass one type as private data to dev_add_param_*
The different dev_add_param_* calls all use different types as private
data. This is unnecessary, use struct state_variable * for all of them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-20 10:29:14 +02:00
Sascha Hauer
1d02283b2f state: make locally used function static
state_set_dirty() is only used in one file, make it static.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-20 10:29:06 +02:00
Sascha Hauer
3a690e4d69 state: Add state to state_variable
A state variable should know which state it belongs to. Add field
for it to struct state_variable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-20 10:29:01 +02:00
Michael Olbrich
8c6ca8acc5 state: fix finding the correct parent node
Looking for the parent node during fixup is broken. The path of the parent
node is not correctly terminated ('0' vs '\0'). Also, the new state node
should be added to the supplied device tree not the barebox device tree
used by of_find_node_by_path().

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-20 10:28:53 +02:00
Michael Olbrich
ba5e1708cd state: don't keep pointers to device tree nodes
Caching pointers to device tree nodes or is not save. The barebox internal
device tree may be changed by loading a new device tree or through fixup
handlers. As a result, the node may be deleted and replaced with a new one.
Keep a copy of the full path instead and resolve the node as needed.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-20 10:28:53 +02:00
Michael Olbrich
872e6069d5 state: copy backend of_path string
Caching pointers to device tree nodes or names is not safe. The barebox
internal device tree may be changed by loading a new device tree or through
fixup handlers. As a result, the string may be deleted.
Use local copies of the full path instead.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-20 10:28:46 +02:00
Sascha Hauer
074a8fdc92 Merge branch 'for-next/socfpga' 2016-09-13 14:56:06 +02:00
Sascha Hauer
0e1892b2e9 Merge branch 'for-next/rockchip' 2016-09-13 14:56:05 +02:00
Sascha Hauer
dd534571bd Merge branch 'for-next/misc' 2016-09-13 14:56:05 +02:00
Sascha Hauer
6b8ae8f2e1 Merge branch 'for-next/menu' 2016-09-13 14:56:05 +02:00
Sascha Hauer
b2c398f440 Merge branch 'for-next/imx' 2016-09-13 14:56:04 +02:00
Alexander Kurz
f6ebdf2194 Add i.MX50 support
Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-12 08:23:09 +02:00
Sam Van Den Berge
a1109d78dd Fix small typo in common/Kconfig
Fix small typo frendly -> friendly

Signed-off-by: Sam Van Den Berge <sam.van.den.berge@telenet.be>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-05 08:53:24 +02:00
Andrey Smirnov
da1f91422c of_unflatten_dtb(): Check return value with IS_ERR
Of_unflatten_dtb returns a ERR_PTR value so checking it against NULL is
incorrect. Fix it in all of the places where this was happening.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-05 08:29:12 +02:00
Aleksey Kuleshov
bf2abf9050 rework menu so that it can support multiline titles
Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-05 08:26:47 +02:00
Sascha Hauer
79a2cc9fe6 blspec: Handle nfs:// pathes from boot
Fixes: cb47dde boot: Call blspec_scan_directory() only on strings containing an absolute path

This commit introduced a check if the path contains a '/' at the
beginning. For booting a bootloader spec entry from NFS we have to
test the path for starting with "nfs://" aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-29 17:37:12 +02:00
Wadim Egorov
4372a3ed06 ARM: rockchip: Add early debug support for RK3288
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-26 07:28:31 +02:00
Alexander Kurz
6b40ff8c7e Kconfig: defaultenv-2 select CMD_TEST
CMD_TEST is required for scripts in defaultenv-2, e.g. automount.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-22 07:49:46 +02:00
Aleksey Kuleshov
d0b8f4e075 properly remove menu entry
Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-18 09:13:27 +02:00
Aleksey Kuleshov
5397742078 fix double free
it already gets free in bootentries_free
no need to do this in ->release method

Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-18 09:12:59 +02:00
Steffen Trumtrar
1047fa8ab4 filetype: add new filetype for SoCFPGA xload image
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-18 08:19:25 +02:00
Renaud Barbier
39391164e5 bbu: parameters are inverted in error message
The error message warning the user that the image is too big for
the device has its parameters in the wrong order. Swap the two
parameters so that the output makes sense.

Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-18 08:18:32 +02:00
Sascha Hauer
94b1e5a321 Merge branch 'for-next/nv' 2016-08-03 08:08:23 +02:00
Sascha Hauer
b927df0329 Merge branch 'for-next/misc' 2016-08-03 08:08:23 +02:00
Sascha Hauer
94e7bdcd9a Merge branch 'for-next/boot' 2016-08-03 08:08:22 +02:00
Sascha Hauer
16dc0b0b48 blspec: Turn message back to debug level
Normally one should not be interested that the blspec code scans
a directory. In case blspec is not actively used it might even be
confusing, so lower priority of the message in blspec_scan_directory()
to pr_debug.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-26 08:31:36 +02:00
Sascha Hauer
80c5692ff8 boot: add single quotes when printing boot target names
It's nicer to read when target names have quotes around them, it
makes it clear that this is a string passed in somewhere.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-26 08:31:36 +02:00