9
0
Fork 0
Commit Graph

941 Commits

Author SHA1 Message Date
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 824f84b6bc mtd: ubi: Let ubidetach take mtd as argument
The ubi number is a dynamically assigned number, so once multiple
ubis are attached, scripts cannot know the ubi number they want
to detach anymore. Convert the ubidetach command to take the mtd
device file instead which is the same argument that was previously
passed to ubiattach.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-13 14:35:04 +02:00
Sascha Hauer ee0035e5cc Merge branch 'for-next/state' 2015-04-13 12:57:14 +02:00
Sascha Hauer 9f13039b55 Merge branch 'for-next/misc' 2015-04-13 12:57:13 +02:00
Marc Kleine-Budde 134f24615b commands: dmesg: fi format security warning
commands/dmesg.c: In function ‘do_dmesg’:
commands/dmesg.c:71:3: warning: format not a string literal and no format arguments [-Wformat-security]

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-03 08:01:53 +02:00
Antony Pavlov 238ffb68f6 command: hashsum: Conding style fixup
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-30 19:08:14 +02:00
Jean-Christophe PLAGNIOL-VILLARD 5afec9c781 command: digest/hashsum: set key at command level
and only set the key when specified

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-27 07:49:37 +01:00
Jean-Christophe PLAGNIOL-VILLARD ca95c2531f crypto: digest: speficied when a digest need a key to be used
such as for hmac(xxx) you must provide a key

This will allow to enforce the correct parameter at digest command

<digest>sum is not impacted

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 b0be99fc10 command: add generic digest command
That can be used for digest calculation and verify

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 1f91b3e6da command: rename digest.c to hashsum.c
as I'll add a new generic command named 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
Jean-Christophe PLAGNIOL-VILLARD 92138a7754 crypto: digest: digest_file_window/digest_file/digest_file_by_name drop key params
expect the key to be set before calling

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-19 07:46:15 +01:00
Jean-Christophe PLAGNIOL-VILLARD 102d59f91f command: add hmac sum supportfor md5, sha1, sha224, sha256, sha384, sha512
pass the key via -h param

barebox@barebox sandbox:/ sha256sum -h test /dev/fd0
c297473e9bb221c5dc51d47ad75c76095f1bdc4ca9dff1d5931c2e22bf11a0de  /dev/fd0 0x00000000 ... 0xffffffffffffffff

use the same idea as openssl command

$ openssl dgst -sha256 -hmac "test" TODO
HMAC-SHA256(TODO)= c297473e9bb221c5dc51d47ad75c76095f1bdc4ca9dff1d5931c2e22bf11a0de

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-13 08:32:28 +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 2505dd9b41 command: add sha384sum and sha512sum support
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
Sascha Hauer ac81a0d876 Merge branch 'for-next/misc' 2015-03-09 08:30:24 +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
Sascha Hauer c1156d841f cmdlinepart: add function to parse a cmdline partition string
This adds a function to parse a full cmdline partition string. The
addpart command is switched to use this function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer 10a0aaabfe cmdlinepart: make argument types safer
The return size should be loff_t to support partitions bigger
than 4G. Also use const for the devname and endp.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer 39f6392d93 move cmdline partition parsing code to separate file
So it's no longer local to the addpart/delpart code and can be used
from other code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer ce961e3412 Merge branch 'for-next/misc' 2015-02-04 19:09:15 +01:00
Jan Luebbe 8ed32ae81b commands: crc: support setting environment variables
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-02 11:46:31 +01:00
Wjatscheslaw Stoljarski f7ee0beb26 loadenv: fix typo in help text
Signed-off-by: Wjatscheslaw Stoljarski <wjatscheslaw.stoljarski@kiwigrid.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-02 11:46:30 +01:00
Wadim Egorov f0f6a7477b Fix spelling: pathes -> paths
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-28 10:02:56 +01:00
Dmitry Lavnikevich 0d8ef327bb memtest: fix 4GB overflow fail
Add condition for checking size_t overflow. This fixes memtest fail
> Memtest failed. Error: -22
which appears when 4GB RAM is present.

Was tested on phyFLEX-i.MX6 modules with 4GB and 1GB RAM.

Signed-off-by: Dmitry Lavnikevich <d.lavnikevich@sam-solutions.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-27 09:03:07 +01:00
Sascha Hauer 33ddaad19a memtest: Fix SDRAM size calculations
Calculating the size and end of the test region as

  end = PAGE_ALIGN_DOWN(bank->res->end) - 1;
  size = end - start + 1;

is wrong. For an example resource of

  start = 0x80000000, end = 0x8fffffff

end results in:

  end = PAGE_ALIGN_DOWN(0x8fffffff) - 1 = 0x8fffefff

instead of 0x8fffffff. The size is then calculated to

  size = end - start + 1 = 0x8fffefff - 0x80000000 + 1 = 0x0ffff000

instead of 0x10000000

The correct way to do this is to calculate the real size and apply a
PAGE_ALIGN_DOWN afterwards:

  size = PAGE_ALIGN_DOWN(bank->res->end - start + 1) = 0x10000000

Fix this in three different places.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-26 09:59:56 +01:00
Antony Pavlov 2009c67867 commands/splash: fix '-y' option handling
The '-y' and '-o' options are independent,
so just add missing 'break'.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-26 09:14:54 +01:00
Masahiro Yamada 18b74c3ec6 commands: fix a warning in help.c
Fix the following warning:

commands/help.c: In function ‘list_group’:
commands/help.c:57:4: warning: format not a string literal and
no format arguments [-Wformat-security]
    printf(cmdtp->name);
    ^

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-13 08:55:48 +01:00
Jean-Christophe PLAGNIOL-VILLARD 3f577105a6 command/splash: fix return value
return errno when possible

otherwise return 0 for ok or 1 for error

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-13 08:47:30 +01:00
Robert Jarzmik e515682daf commands: loady: fix bug with netconsole
Netconsole doesn't have a baudrate. Loady supposes a console has one,
and tries to compute the console's baudrate variable value, regardless
of its existence.

This triggers a NULL pointer dereference on netconsole. If attempting
loady on a netconsole is a bit useless, barebox should not panic. Fix
this by checking the variable exists before reading its value.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 13:05:27 +01:00
Sascha Hauer 9b1d12fff0 Merge branch 'for-next/randconfig' 2014-12-08 14:54:11 +01:00
Sascha Hauer 3eade89c75 Merge branch 'for-next/persistent-vars'
Conflicts:
	arch/arm/boards/efika-mx-smartbook/defaultenv-efikasb/config
2014-12-08 14:54:09 +01:00
Sascha Hauer c2b5a7015b Merge branch 'for-next/misc' 2014-12-08 14:53:59 +01:00
Sascha Hauer 7a9bf3b079 command: load[sbxy]: Depend on CONSOLE_FULL
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-27 17:15:00 +01:00
Sascha Hauer 2fd1b13969 command: dmesg: depend on !CONSOLE_NONE
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-27 14:34:01 +01:00
Sascha Hauer 8c3b230807 command: passwd: depend on CMD_LOGIN rather than selecting it
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-27 14:33:57 +01:00
Sascha Hauer d014f7fd0f command: login: depend on !CONSOLE_NONE
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-27 14:33:52 +01:00
Jan Weitzel 8e2c7b3de3 xymodem: select CRC16 from lib
Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-12 09:22:22 +01:00
Sascha Hauer abf9c94b53 command: memset: Fix argument order in help text
memset takes ADDR DATA COUNT just like the C function, not
ADDR COUNT DATA.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-10 08:00:46 +01:00
Sascha Hauer 32e879f0a3 globalvar: Add support for printing all global variables
This could previously only be done with 'devinfo global'. While
this is still possible this adds a more direct access via the
globalvar command. This variant also adds a '*' in front of
the variable if the corresponding non volatile variable exists.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 12:23:12 +01:00
Sascha Hauer b25d333493 Add defaultenv command
This adds a command to explicitly restore the environment (or
parts thereof) from the default environment.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 12:23:12 +01:00
Sascha Hauer 837e517669 cp: Add recursive copy
This adds the -r option to the cp command.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 10:58:55 +01:00
Sascha Hauer 3249006a2f Add support for non volatile variables
This adds (back) support for non volatile variables. Non volatile
variables are variables which are stored in the environment over
reboot. They are used in the same way as the global variables, but
with a 'nv' command and device. The variables are stored under
/env/nv/, one variable per file. Adding a nv variable automatically
adds a global variable with the same name. Changing a nv variable
also changes the same global variable, but not the other way round.
This allows for example to configure the username as:

nv user=sha; saveenv

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 10:58:54 +01:00
Sascha Hauer fe39e8aadc magicvar: Add support for dynamically added magicvars
Add support to add a new magicvar using the magicvar command.
This is useful for magicvars assigned and used only in the
environment.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 10:58:54 +01:00
Sascha Hauer 7b4cc54579 Merge branch 'for-next/tegra' 2014-11-05 15:47:39 +01:00
Sascha Hauer da1a9005c2 Merge branch 'for-next/fs' 2014-11-05 15:47:38 +01:00
Sascha Hauer 6aaba64b0c commands: implement 'cmp' command
This command compares two files. It does not show the differences,
it only returns successfully if both files are identical and with
an error if they differ.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-04 12:36:19 +01:00
Sascha Hauer 15f8f9282e saveenv: Fix saving to specified file
Since e805b7d saveenv: provide a zeroed/empty/ignore environment
barebox no longer honors the file argument when the directory
argument is also givin. Fix this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-23 23:02:57 +02:00
Steffen Trumtrar 11632790da commands: firmwareload: add CMD_GROUP
To be able to build the documentation the CMD_GROUP macro needs
to be defined. Without this the firmwareload command breaks "make docs".

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-10 08:36:32 +02:00