We used to have the login functionality in the /env/bin/init script.
This is hard to review and it's too easy to break the login functionality
with changes to this script. Move the places to ask for a password to
C code where we have only a few places where we have to ask for a password.
Mainly these are run_shell() and the menutree command.
This patch introduces a login() function which will only return if the correct
password has been entered. Following calls will return immediately without
asking for a password again.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
so generic code can check if the console is enabled
and now we can use loadb & loadxy
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
as the console is always enable
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
so we guarantee that barebox is secured again user interaction
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Convert to static inline functions and use lower case letters for function
names. Also, include mach/debug_ll.h when an architecture provides support
for debug_ll, not only when it's actually enabled. This allows architecures
to put some UART initialization code into mach/debug_ll.h which is compiled
out when debug_ll is disabled.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The different console implementations share a good amount of code,
share this in console_common.c.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This will allow to have the same feature as earlyprintk in the kernel
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
There can be only one console for console_simple, so
return with -EBUSY when the second gets registered.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Since fprintf and console_puts now return the number of
character written the prototypes have changes. We forgot
to fix console_simple which now fails to compile with:
common/console_simple.c:48:6: error: conflicting types for 'fprintf'
include/stdio.h:57:5: note: previous declaration of 'fprintf' was here
common/console_simple.c:67:6: error: conflicting types for 'console_puts'
include/stdio.h:20:5: note: previous declaration of 'console_puts' was here
Fix this by returning the proper numbers of characters written.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Some console are transient, like the USB connected serial
console which should be removed when the USB connection is
severed.
Enable console removal for such devices.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
In a noninteractive environment barebox will be compiled without
command support. So move version_string to a seperate file which
is compiled unconditionally.
Also, display the banner when the simple console support is used.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
commands/loadb.c doesn't build with CONFIG_CONSOLE_SIMPLE, because it uses
fprintf / for_each_console (which uses console_list).
Fix it by adding trivial implementations of both in console_simple.
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add a simple console layer which is not able to handle multiple
consoles for those who don't need it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>