9
0
Fork 0
Commit Graph

950 Commits

Author SHA1 Message Date
Pau Espin a07b1b7503 login: Follow timeout guidelines when password returns in time
If there's noise in the serial line, it will usually end up in Password:
prompt and after timeout, autoboot process will be triggered.
However, if the noise is translated to \n or whatever character code
used to finish the password string, the login() funcion will against
request the password() with the full timeout. If the noise keeps
printing the \n or similar character with a high frequency, barebox will
become stuck in the boot process.

Related: SYS#4128
2018-02-15 18:55:53 +01:00
Hubert Feurstein 9917f610da login: fix broken login command
It was possible to login with ctrl-c or an empty password. This bug was
introduced by the recent digest changes in common/password.c (e49a47fb).
The function check_passwd returns now also negative error codes which were
not correctly handled in do_login.

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-24 17:14:25 +02:00
Sascha Hauer db0d4ccd56 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-10 13:42:33 +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 6792d94a4b md: use memmap when possible
This adds the missing pieces for:

d8a6e1c ARM/mem: handle data aborts gracefully for md

When possible use memmap and directly and dereference the input pointer
directly in memory_display() so that the data abort occurs where we expect
it and not in the md command. With this d8a6e1c can work as expected.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-28 12:26:33 +02:00
Marc Kleine-Budde 82d21cf155 commands/Kconfig: fix typo in CMD_BOOTM_OFTREE help
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 09:19:31 +02:00
Marc Kleine-Budde 01fdbb9652 bootm: add magicvar description for global.bootm.oftree
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 09:19:30 +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
Marc Kleine-Budde 78caf2d171 command: timeout: add documentation for option '-v'
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
Marc Kleine-Budde 2daf357206 command: timeout: remove unhandled '-t' option
This patch removes the option '-t', as it's unhandled in the code since it was
added to barebox.

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
Marc Kleine-Budde 4f315f3670 command: state: harmonize in-barebox documentation
According to this patch by Holger Schurig:

    f1f532084a commands: harmonize in-barebox documentation

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-17 07:31:35 +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