2017-05-24 |
globalvar: Fix value of new globalvar when nvvar exists
...
When a new globalvar with a value is created and the corresponding
nvvar exists, then the globalvar gets the value of the nvvar, not
from the newly assigned value as expected.
nv quux=foo; global quux=bar; echo ${global.quux}
Should give "bar", not "foo". Fix this.
Reported-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 24 May 2017
|
clock: initialize dummy clocksource statically
...
Assigning the dummy clocksource in a initcall has the problem that
get_time_ns() crashes before that initcall is executed. This happens
when dmesg support is enabled in conjunction with CONFIG_DEBUG_INITCALLS.
In this case the dmesg code wants to have the timestamp of a log
message.
Solve this by setting the current clocksource to the dummy clock
statically and not at runtime. This way we always have a dummy
clock available.
Fixes:
commit 8972eb7
Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Date: Fri Mar 3 13:34:02 2017 +0100
clocksource: move dummy clock source to init_clock
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 24 May 2017
|
2017-04-26 |
common: BLSPEC needs boot infrastructure and at least simple command support
...
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Lucas Stach
authored
on 25 Apr 2017
Sascha Hauer
committed
on 26 Apr 2017
|
2017-04-25 |
globalvar: don't use nv_device if CONFIG_NVVAR is disabled
...
At the moment barebox crashes if CONFIG_NVVAR is disabled
because of access to unregistered nv_device in
get_param_by_name(&nv_device, "version").
How to reproduce the crash:
barebox$ unset ARCH
barebox$ unset CROSS_COMPILE
barebox$ make sandbox_defconfig
barebox$ sed -i "s/CONFIG_ENV_HANDLING=y/# CONFIG_ENV_HANDLING is not set/" .config
barebox$ make oldconfig
barebox$ ./barebox
Segmentation fault
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Antony Pavlov
authored
on 24 Apr 2017
Sascha Hauer
committed
on 25 Apr 2017
|
2017-04-24 |
state: backend_raw: init digest earlier
...
In backend_format_raw_pack() digest_length is used before it's
initialized in backend_raw_digest_init() which results in a too small
memory allocation for the raw backend. Fix this and prevent a memory
corruption.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 24 Apr 2017
|
2017-04-21 |
state: Fix "pack" returning freed data for DTB backend
...
`state_backend_format_dtb_pack()` passes a buffer containing state
packed in flattened DTB format back to its caller via its `buf`
parameter. It then frees the buffer before returning. This means the
caller (`state_save()`) will be working on freed buffer contents before
freeing the buffer a second time itself. Fix it by removing the
spurious call to `free()`.
This should fix a bug reported by Norbert Wiedmann in
<http://lists.infradead.org/pipermail/barebox/2017-April/029980.html>.
Cc: Norbert Wiedmann <info@n-wiedmann.de>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Ian Abbott
authored
on 21 Apr 2017
Sascha Hauer
committed
on 21 Apr 2017
|
2017-04-19 |
state: Fix error return value
...
When the backend phandle cannot be resolved we jump to the error
return path without initializing ret. Fix this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 19 Apr 2017
|
state: backend_storage: Set needs_refresh back to 0 after refreshing
...
Set needs_refresh back to 0 after refreshing so that we do not refresh
it again without need. This would only happen when we read the state
from the storage multiple times, which normally is not the case.
However, it's more consistent like this.
Reported-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 19 Apr 2017
|
state: backend_bucket_circular: Do not leak memory
...
buf was just allocated, free it before returning an error.
Reported-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 19 Apr 2017
|
common: bootchooser: add dependencies
...
Bootchooser isn't worth much without the boot infrastructure, also
it needs at least the simple shell variant to be enabled.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Lucas Stach
authored
on 12 Apr 2017
Sascha Hauer
committed
on 19 Apr 2017
|
2017-04-07 |
Merge branch 'for-next/state'
Sascha Hauer
committed
on 7 Apr 2017
|
Merge branch 'for-next/ofpart'
Sascha Hauer
committed
on 7 Apr 2017
|
Merge branch 'for-next/misc'
Sascha Hauer
committed
on 7 Apr 2017
|
Merge branch 'for-next/hwrng'
Sascha Hauer
committed
on 7 Apr 2017
|
globalvar: remove code for unqualified globalvars
...
The globalvar_add_simple_* functions will fail when a globalvar of
the name already exists. This happened when the globalvar was created
previously because a corresponding nvvar existed. For this reason we
removed the globalvars that have been previously created by nvvar
creation (we called these unqualified globalvars). Since we no longer
create the corresponding globalvars on nvvar creation this code is
no longer needed. Remove it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 7 Apr 2017
|
nv: Do not create globalvars from nvvars
...
When we create a new nvvar there's no need to create the corresponding
globalvar, because whoever wants to use the corresponding globalvar
will create it before usage anyway. Doing this means that we have to
test for existence of a corresponding nvvar when we create a globalvar,
and if it does, set the value of the globalvar from the nvvar.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 7 Apr 2017
|
globalvar: remove unused globalvar_add()
...
globalvar_add() is unused in the tree. Remove it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 7 Apr 2017
|
nvvar: Fix creation without value
...
When a new nvvar is added without a value we want to get the value
from the corresponding globalvar. We do this by using nv_set which
ends up freeing the exact string that we passed into nv_set as
value. This results in a corrupt value. Fix this by assigning a
value manually without calling nv_set.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 7 Apr 2017
|
2017-04-06 |
bootchooser: export bootchooser_boot
...
Some boards that boot directly from C code do already know that
they want to boot from bootchooser and nothing else. For these
it's easiest to call bootchooser_boot directly, so export this
function.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 6 Apr 2017
|
bootchooser: register as bootentry provider
...
Instead of using a global function called by
bootentry_create_from_name(), register the bootchooser as bootentry
provider.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 6 Apr 2017
|
blspec: register as bootentry provider
...
Instead of using a global function called by
bootentry_create_from_name(), register blspec as bootentry
provider.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 6 Apr 2017
|
boot: Allow to register boot entry providers
...
bootentry_create_from_name() takes a name and creates bootentries
for it. It tries different providers that interpret the name:
blspec, bootchooser or script pathes. Instead of hardcoding the
different providers in the function, allow the providers to register
themselves.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 6 Apr 2017
|
2017-04-04 |
state: remove unused variable type
...
enum state_variable_type is never used. Remove it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 4 Apr 2017
|
global command: print info about variables
...
The info contains useful information at least for enums, for these the
possible values are printed. This makes the output of the "global"
command more useful and similar to "devinfo global"
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 4 Apr 2017
|
2017-03-31 |
state: find device node from device path, not from device node path
...
The device node path may change from the internal device tree to the
one Linux is started with, so using this path to fixup the tree is
not very robust. Instead, use of_find_node_by_devpath() which has
been created for exactly this purpose.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 31 Mar 2017
|
state: Remove -EUCLEAN check from userspace tool
...
The state code is used for the userspace tool aswell, kept in sync
manually. This patch only introduces a change for the userspace
tool, not for barebox.
In Linux userspace there is no direct possibility to check for -EUCLEAN.
To indirectly check for -EUCLEAN the state tool reads the number of
corrected bits before and after reading a block. Unfortunately it does
not take the number of acceptable bitflips into account, but instead
returns -EUCLEAN even when only a single bitflip occurred on a whole
page. To be correct the algorithm must be more complicated: We would
have to read the bitflip_threshold from sysfs. This value is per ECC
step (often 512 byte), not per page. We would have to read the page
in ECC step size chunks, testing for bitflips lower than the threshold
for each chunk. Even if we would do that, there's still another issue.
The eccstats ioctl delivers the eccstats for the whole device, so a
concurrent reader would falsify the result.
Let's decide that this is not worth the hassle and assume that no
device has enough uptime that a cleanup in barebox is not sufficient.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 31 Mar 2017
|
state: Do not load state during state_new_from_node
...
The caller of state_new_from_node() may have it's own ideas what to
do when loading the state fails, so do not load it in the initialization
function, but instead let the caller do it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 31 Mar 2017
|
state: Allow to load without authentification
...
Sometimes it's useful to be able to load a state even when it
can't be authentificated. Add an option for this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 31 Mar 2017
|
state: backend bucket circular: Explain metadata
...
Explain why we have metadata and where it is used.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 31 Mar 2017
|
state: backend_circular: Set minumum writesize to 8
...
NOR flashes have a write size of 1. With this the metadata may
end up on non-4-byte-aligned offsets. Force the minimum writesize
to 8 so that the metadata is always at aligned offsets.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 31 Mar 2017
|