9
0
Fork 0
Commit Graph

1641 Commits

Author SHA1 Message Date
Jan Luebbe 918e1c52cd state: add support for uint8 variables
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-06-13 14:35:04 +02:00
Jan Luebbe fa7fc5c957 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>
2015-06-13 14:35:04 +02:00
Marc Kleine-Budde 51f97717c8 bootstate: add
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-06-13 14:35:04 +02:00
Sascha Hauer 052d9ac0cf 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-13 14:35:03 +02:00
Sascha Hauer f8cc8d3b0a 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-13 14:35:03 +02:00
Marc Kleine-Budde cbded3f539 state: backend_raw: update documentation of struct state_backend_raw members
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-06-13 14:35:03 +02:00
Marc Kleine-Budde c028c09a4b 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>
2015-06-13 14:35:03 +02:00
Marc Kleine-Budde 3d809e6595 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>
2015-06-13 14:35:03 +02:00
Marc Kleine-Budde cba8ec9e57 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>
2015-06-13 14:35:03 +02:00
Marc Kleine-Budde e5ec09d771 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>
2015-06-13 14:35:03 +02:00
Marc Kleine-Budde 0e7a86744a 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>
2015-06-13 14:35:03 +02:00
Marc Kleine-Budde 633d92e709 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>
2015-06-13 14:35:03 +02:00
Marc Kleine-Budde a8a3c2de5b 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>
2015-06-13 14:35:03 +02:00
Marc Kleine-Budde 6fecafad03 state: mtd_get_meminfo: open path readonly instead of readwrite
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-06-13 14:35:03 +02:00
Marc Kleine-Budde f25cc8d880 state: print name of property of size mismatch is detected
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-06-13 14:35:03 +02:00
Marc Kleine-Budde 0caa4b8075 state: print proper error message, if reg property is not found
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-06-13 14:35:02 +02:00
Marc Kleine-Budde 177c5b7739 state: add fixup to copy state from barebox to kernel device tree
This patch registeres a DT fixup, that copies the statate nodes from the active
to the kernel DT. The backend reference will be a phandles.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
[ukl: add call to of_unregister_fixup]
2015-06-13 14:35:02 +02:00
Marc Kleine-Budde 4e26c8c6d9 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>
2015-05-17 20:43:40 +02:00
Marc Kleine-Budde 1c3c233a93 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>
2015-05-17 20:43:40 +02:00
Marc Kleine-Budde 02c6da8d85 state: make state_release() non static
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-05-17 20:43:40 +02:00
Marc Kleine-Budde 618d712f91 state: state_new_from_fdt(): remove unused function
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Applied-Upstream: next, commit:9a6dc0376add
2015-05-17 20:43:40 +02:00
Marc Kleine-Budde 55396feb25 state: state_uint32_create: use %u to print unsigned variable
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Applied-Upstream: next, commit:2ce086b8beee
2015-05-17 20:43:39 +02:00
Uwe Kleine-König 25d8af0f01 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>
Forwarded: id:1431771149-27265-1-git-send-email-u.kleine-koenig@pengutronix.de
2015-05-17 20:42:55 +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
Sascha Hauer 61fc21c197 environment: Do not remove base env directory
When removing empty directories do not remove the base
directory.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-19 22:15:18 +01:00
Hubert Feurstein f52cf03aad common/bootargs: add blkdevparts variables
The kernel command line option blkdevparts works like mtdparts, but for all
block devices. So it can be used for eMMC devices without the need of a
traditional partition table.

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-17 08:46:36 +01:00
Andrey Panov 2464c7f7d7 ARM: Rockchip: Add DEBUG_LL based on mach-socfpga
Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-13 07:21:56 +01:00
Lucas Stach b2e8ce4b76 imd: provide dummy imd_command_setenv
If CONFIG_CMD_IMD is not set there is no imd_command_setenv in the
barebox binary that can be linked to. Although the whole imd infrastructure
will be removed by the linker later in the build process as soon as it
figures out that nothing inside barebox is using it, we still have to
provide a dummy function to keep the build going.

Fixes:
In function `imd_command': undefined reference to `imd_command_setenv'

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 10:58:08 +01:00
Sascha Hauer 6f88d51efd blspec: put blspec bootargs into a .dyn bootargs variable
So that they get deleted later when something else is booted.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-10 09:55:43 +01:00