9
0
Fork 0
Commit Graph

1646 Commits

Author SHA1 Message Date
Harald Welte 59d35fe8f9 Print error message if of_state_fixup() fails
If of_state_fixup() fails for some reason, boot/bootm will fail, too

However, it is completely unclear where the error has happened, and to
the user it rather seems like the kernel device tree loaded from some
file was broken/corrupt, not that in fact some fixup routine was
failing.

Adding a meaningful error message can help debugging significantly.

Signed-off-by: Harald Welte <laforge@gnumonks.org>
2016-02-17 20:04:16 +01:00
Jan Luebbe 59835890e5 state: fix missing newline in error message
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-07-08 15:25:51 +02:00
Jan Luebbe cb9695a3ea state: handle write-protection in the raw backend
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-07-03 14:41:47 +02:00
Marc Kleine-Budde 6a11cd1539 bootstate: add framework for redundant boot scenarios
There are several use cases where a redundant Linux system is needed. The
barebox,bootstate framework provides the building blocks to model different
use cases without the need to start from the scratch over and over again.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-06-10 13:42:33 +02:00
Sascha Hauer e4cabc3d89 blspec: automatically append bootargs
When bootloader spec is used to boot devices it is often desirable
to boot the same image from different media. Since the fs images
need to contain the root= parameters to tell Linux where to boot
from the images can't be identical on different media.

This patch changes this by introducing a 'appendroot' option for
bootloader spec. If set to true, barebox will construct a Linux
commandline option for the device the bootloader spec entry is found
on.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:42:33 +02:00
Sascha Hauer c5ced0d7c7 blspec: honour default/once entries again and move them to a different place
Support for default/once entries was lost earlier. This fixes this
and also looks for default/once entries in the loader directory instead
of the loader parent directory. This keeps the bootloader spec files
together under a common loader directory.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:42:33 +02:00
Jan Luebbe 6d8bfbc837 state: add support for uint8 variables
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Jan Luebbe b80f568076 state: add some more error messages
This helps with finding out why the state cannot be loaded correctly.

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde 8a82dc00f3 state: backend_raw: update documentation of struct state_backend_raw members
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde 2a30b4aec2 state: backend_raw: add sanity check of data_len during load
The length of the data must fit into the remaining available space until the
next copy of the data.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde 0e30d7c6e8 state: backend_raw: rename backend_raw_write_one() -> backend_raw_save_one()
Use a consistent naming scheme: backend_raw_save_one() is called from
backend_raw_save().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde 9604a9909d state: backend_raw: factor out state_backend_raw_file_get_size() into separate function
This patch factors out the state_backend_raw_file_get_size() into a separate
function and adds some ifdefs to make this code work under Linux aswell.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde 8f5b7cbc17 state: backend_raw: properly align write and erase size
This patch makes it easier to share the code with linux, on Linux the ease and
write size have to be aligned. Use stride (which is already aligned to erase
block size) during erase, align size_full to writesize and use it while
writing.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde 39b9ed09cf state: backend_raw: rename struct state_backend_raw::step -> stride
This patch renames the member "step" of the struct state_backend_raw to
"stride" and tries to clarifies its meaning.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde e7e79b0934 state: backend_raw: remove hard coded limit of two copies
Although there is the define RAW_BACKEND_COPIES, the state_backend_raw_save()
function silently assumes exactly two copies. This patch removes that assumtion
by looping over all copies, but saving the one we're read from at the end.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde 60dbe695da state: mtd_get_meminfo: make usage of mtd's meminfo compatible to linux
This patch makes it possible to share the code with linux.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde 4606d34fcf state: mtd_get_meminfo: open path readonly instead of readwrite
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde 5bd9b2566d state: add fixup to copy state from barebox to kernel device tree
This patch registers a DT fixup, that copies the state nodes from the active
to the kernel DT. The backend reference will be a phandles.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Uwe Kleine-König e30ee4fa55 of: add a function to remove an of_fixup
This function is needed when a device that already registered a fixup in
the probe routine fails later to probe completely. Without unregistering
the fixup the function might later be called with invalid data.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde 827421e7d5 state: backend: support phandle and of_path references
This patch improves the backend property, it can be either a phandle or a
of_path. During probe() of the state driver the backend property is
dereferenced and the resulting of_path is saved in the state context. In a
later patch it will be used to generate a phandle reference to the backend
during DT fixup.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Marc Kleine-Budde 8850e5eea9 state: add functionality to export state description
This patch adds the functionality to export the description of the state, but
not the contents of the variables to a DT node. This will be used in a later
patch to "copy" the state description to the kernel device tree during DT
fixup.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:25 +02:00
Marc Kleine-Budde b858e28942 state: make state_release() non static
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:25 +02:00
Marc Kleine-Budde 6a4e286302 state: print proper error message, if reg property is not found
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:25 +02:00
Marc Kleine-Budde c58d3fed43 state: print name of property of size mismatch is detected
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:25 +02:00
Marc Kleine-Budde 2216338453 state: state_new_from_fdt(): remove unused function
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:25 +02:00
Marc Kleine-Budde df48398250 state: state_uint32_create: use %u to print unsigned variable
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:25 +02:00
Sascha Hauer 6d4afd96fc setenv: Be more informative when device parameter setting fails
When setting a device parameter fails not only the error code
is of interest, but also what the parameter name is, what the
device name is and whether a device was found for this name.
Add this information to the error message.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-04 09:27:35 +02:00
Marc Kleine-Budde 1aa3dbfc1a timeout: factor out wait-for-key-press loop into separate file
This patch factors out the wait-for-key-press loop from the shell command
"timeout" into a sparate file, so that it can be used from C, too.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-23 08:12:28 +02:00
Sascha Hauer ee0035e5cc Merge branch 'for-next/state' 2015-04-13 12:57:14 +02:00
Sascha Hauer 909dbe5334 Merge branch 'for-next/crypto' 2015-04-13 12:57:12 +02:00
Antony Pavlov d2dea77829 make PBL_CONSOLE depend on PBL_IMAGE
PBL_CONSOLE option is used only for building PBL. See this output:

    barebox$ git grep PBL_CONSOLE
    arch/arm/configs/tx28stk5_defconfig:CONFIG_PBL_CONSOLE=y
    common/Kconfig:config PBL_CONSOLE
    common/Makefile:pbl-$(CONFIG_PBL_CONSOLE)       += memory_display.o
    include/printk.h:       (defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
    include/stdio.h:        (defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
    lib/Makefile:pbl-$(CONFIG_PBL_CONSOLE) += vsprintf.o
    pbl/Makefile:pbl-$(CONFIG_PBL_CONSOLE) += console.o

PBL_CONSOLE looks confusing in PBL-less configuration
so it's better to enable it only if PBL is enabled.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-13 10:17:22 +02:00
Jean-Christophe PLAGNIOL-VILLARD e49a47fba8 password: add pbkdf2 support
We will use random 32 bytes salt and 10000 round to generate a
32 bytes key.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-20 11:45:55 +01:00
Jean-Christophe PLAGNIOL-VILLARD 9f15b42105 command: allow runtime usage
This will allow as example to list the currently supported digest.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-19 07:46:22 +01:00
Sascha Hauer 1487e6b9ad state: add framework for persistent state handling
This patch adds a framework to describe, access, store and restore a set of
variables. A state variable set can be fully described in a devicetree node.
This node could be part of the regular devicetree blob or it could be an extra
devicetree solely for the state. The state variable set contains variables of
different types and a place to store the variable set.

For more information see:
    Documentation/devicetree/bindings/barebox/barebox,state.rst

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 08:28:31 +01:00
Jean-Christophe PLAGNIOL-VILLARD 3a43692412 password: add support for sha512
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 07:58:24 +01:00
Jean-Christophe PLAGNIOL-VILLARD 27b2336029 digest: make it multi-instance
Now you need to call digest_alloc and when you finish to use it digest_free.

We need this for upcomming aes encryption support and secure boot
as we will need multiple instance of the same digest.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 07:58:24 +01:00
Jean-Christophe PLAGNIOL-VILLARD 804fae5d16 digest: introduce digest_{init/update/final/length}
This will allow to move from a one at a time digest to a multi-instance
with too much impact on the code using it

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 07:58:24 +01:00
Jean-Christophe PLAGNIOL-VILLARD 1ac61317c6 digest: move digest.c to crypto
with not the rest of the implementation

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 07:58:24 +01:00
Lucas Stach 444e04ff90 pbl: let pbl-console depend on !CONSOLE_NONE
It doesn't make much sense to have a console in the pbl
but not in the main barebox binary.

Fixes:
pbl/console.c:34:5: error: redefinition of 'ctrlc'
include/stdio.h:60:19: note: previous definition of 'ctrlc' was here

pbl/console.c:39:6: error: redefinition of 'console_putc'
include/stdio.h:49:20: note: previous definition of 'console_putc' was here

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-11 09:36:25 +01:00
Sascha Hauer fa20ea45e0 Merge branch 'for-next/tegra' 2015-03-09 08:32:26 +01:00
Sascha Hauer ac81a0d876 Merge branch 'for-next/misc' 2015-03-09 08:30:24 +01:00
Sascha Hauer 22e42ca3fc Merge branch 'for-next/arm' 2015-03-09 08:30:24 +01:00
Sascha Hauer ea2153ce86 Merge branch 'for-next/am335x' 2015-03-06 08:33:20 +01:00
Marc Kleine-Budde 7033089ddf environment: envfs_{load, save}: add possibility to call with filename and dirname == NULL
This patch moves fallback to default into the envfs_{load,save} functions.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:43:49 +01:00
Lucas Stach 21294b0516 bbu: make bbu confirm a bit more verbose
It is a lot more user friendly if we give a bit more feedback.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-04 11:34:08 +01:00
Sascha Hauer e2290aef31 console: Make locally used function static
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-04 11:32:59 +01:00
Wadim Egorov c918022532 reset_source: Add external reset
Some SoCs have special device pins for external reset signals.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-02 07:54:13 +01:00
Sascha Hauer e7e39180ad reset_source: make safe to call earlier
reset_source_init used to set the reset source to unknown in a
coredevice_initcall. This means if reset_source_set() has been called
earlier the value would have been overwritten. Fix this by calling
globalvar_add_simple() each time reset_source_set() is called.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-02 07:54:13 +01:00
Lucas Stach 43f133f68b menu: depend on !CONFIG_SHELL_NONE
It doesn't make much sense to have the menuframework but no
shell.

Fixes:
In function `menu_action_command': undefined reference to `run_command'

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-02 07:35:39 +01:00
Jan Luebbe d8a6e1c266 ARM/mem: handle data aborts gracefully for md
Sometimes memory ranges contain inaccessible registers which trigger a
data abort when accessed. To handle this gracefully, we extend the data
abort exception handler to ignore the exception when configured to do
so.

This allows detecting inaccessible memory from the md command. It will
show XX for unreadable bytes instead.

The previous behaviour:
barebox@TI AM335x BeagleBone:/ md 0x50000000
unable to handle paging request at address 0x500000ac
pc : [<8fe2e0dc>]    lr : [<8fe2e0b9>]
sp : 8ffff898  ip : 00000024  fp : 00000000
r10: 8bfa0204  r9 : 00000000  r8 : 8bfa0204
r7 : 00000100  r6 : 50000000  r5 : 8bfa0204  r4 : 00000004
r3 : 00000f00  r2 : 000000ac  r1 : 00000004  r0 : 00000014
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32
[<8fe2e0dc>] (memcpy_sz+0x40/0x48) from [<8fe2f337>] (mem_read+0x3b/0x48)
[<8fe2f337>] (mem_read+0x3b/0x48) from [<8fe2bb13>] (cdev_read+0x25/0x2e)
[<8fe2bb13>] (cdev_read+0x25/0x2e) from [<8fe2c15b>] (devfs_read+0x1b/0x1e)
[<8fe2c15b>] (devfs_read+0x1b/0x1e) from [<8fe2df5b>] (__read+0x43/0x5c)
[<8fe2df5b>] (__read+0x43/0x5c) from [<8fe2e61f>] (read+0x2b/0x48)
[<8fe2e61f>] (read+0x2b/0x48) from [<8fe1e4a5>] (do_mem_md+0xc1/0x144)
[<8fe1e4a5>] (do_mem_md+0xc1/0x144) from [<8fe02889>] (execute_command+0x21/0x48)
[<8fe02889>] (execute_command+0x21/0x48) from [<8fe061c1>] (run_list_real+0x549/0x634)
[<8fe061c1>] (run_list_real+0x549/0x634) from [<8fe05b43>] (parse_stream_outer+0xdb/0x174)
[<8fe05b43>] (parse_stream_outer+0xdb/0x174) from [<8fe06435>] (run_shell+0x29/0x54)
[<8fe06435>] (run_shell+0x29/0x54) from [<8fe02889>] (execute_command+0x21/0x48)
[<8fe02889>] (execute_command+0x21/0x48) from [<8fe061c1>] (run_list_real+0x549/0x634)
[<8fe061c1>] (run_list_real+0x549/0x634) from [<8fe05efb>] (run_list_real+0x283/0x634)

[<8fe31e1d>] (unwind_backtrace+0x1/0x64) from [<8fe24e61>] (panic+0x1d/0x34)
[<8fe24e61>] (panic+0x1d/0x34) from [<8fe322c1>] (do_exception+0xd/0x10)
[<8fe322c1>] (do_exception+0xd/0x10) from [<8fe32329>] (do_data_abort+0x21/0x2c)
[<8fe32329>] (do_data_abort+0x21/0x2c) from [<8fe31fe8>] (data_abort+0x48/0x60)

The new behaviour:
barebox@TI AM335x BeagleBone:/ md 0x50000000
50000000: 00000060 00000000 00000000 00000000                `...............
50000010: 00000000 00000001 00000000 00000000                ................
50000020: 00000000 00000000 00000000 00000000                ................
50000030: 00000000 00000000 00000000 00000000                ................
50000040: 00001ff0 400000ac 00000211 00000000                .......@........
50000050: 00000a00 00000001 00000000 00000000                ................
50000060: 00000000 00101001 22060514 10057016                ...........".p..
50000070: 010f1111 8f070000 00000f40 00000000                ........@.......
50000080: 00000000 00000000 00000000 00000000                ................
50000090: 00001000 00101001 22060514 10057016                ...........".p..
500000a0: 010f1111 8f070000 00000f00 XXXXXXXX                ................
500000b0: XXXXXXXX XXXXXXXX 00000000 00000000                ................
500000c0: 00001000 00101001 22060514 10057016                ...........".p..
500000d0: 010f1111 8f070000 00000f00 XXXXXXXX                ................
500000e0: XXXXXXXX XXXXXXXX 00000000 00000000                ................
500000f0: 00001000 00101001 22060514 10057016                ...........".p..

The current implementation breaks everything except ARM and takes several
shortcuts which need to be implemented more cleanly. Suggestions are very
welcome!

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-27 13:17:31 +01:00