summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/Kconfig13
-rw-r--r--commands/boot.c26
-rw-r--r--commands/login.c70
-rw-r--r--commands/menutree.c3
-rw-r--r--commands/splash.c21
-rw-r--r--commands/ubiformat.c1
6 files changed, 45 insertions, 89 deletions
diff --git a/commands/Kconfig b/commands/Kconfig
index 133dcbf22c..630cb12169 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -928,7 +928,7 @@ config CMD_LS
config CMD_MD5SUM
tristate
select COMPILE_HASH
- select MD5
+ select DIGEST_MD5_GENERIC
prompt "md5sum"
help
Usage: md5sum FILE|AREA...
@@ -993,7 +993,7 @@ config CMD_RMDIR
config CMD_SHA1SUM
tristate
select COMPILE_HASH
- select SHA1
+ select DIGEST_SHA1_GENERIC
prompt "sha1sum"
help
Calculate SHA1 digest
@@ -1005,7 +1005,7 @@ config CMD_SHA1SUM
config CMD_SHA224SUM
tristate
select COMPILE_HASH
- select SHA224
+ select DIGEST_SHA224_GENERIC
prompt "sha224sum"
help
Calculate SHA224 digest
@@ -1017,7 +1017,7 @@ config CMD_SHA224SUM
config CMD_SHA256SUM
tristate
select COMPILE_HASH
- select SHA256
+ select DIGEST_SHA256_GENERIC
prompt "sha256sum"
help
sha256sum - calculate SHA256 digest
@@ -1029,7 +1029,7 @@ config CMD_SHA256SUM
config CMD_SHA384SUM
tristate
select COMPILE_HASH
- select SHA384
+ select DIGEST_SHA384_GENERIC
prompt "sha384sum"
help
Calculate SHA384 digest
@@ -1041,7 +1041,7 @@ config CMD_SHA384SUM
config CMD_SHA512SUM
tristate
select COMPILE_HASH
- select SHA512
+ select DIGEST_SHA512_GENERIC
prompt "sha512sum"
help
sha512sum - calculate SHA512 digest
@@ -1458,6 +1458,7 @@ endif
config CMD_SPLASH
bool
select IMAGE_RENDERER
+ depends on VIDEO
prompt "splash"
help
Display a BMP image on a framebuffer device
diff --git a/commands/boot.c b/commands/boot.c
index 3341a05ebd..fd58824d98 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -14,6 +14,7 @@
#include <environment.h>
#include <globalvar.h>
#include <magicvar.h>
+#include <watchdog.h>
#include <command.h>
#include <readkey.h>
#include <common.h>
@@ -24,6 +25,7 @@
#include <clock.h>
#include <boot.h>
#include <glob.h>
+#include <init.h>
#include <menu.h>
#include <fs.h>
#include <complete.h>
@@ -71,10 +73,28 @@ out:
return ret;
}
+static unsigned int boot_watchdog_timeout;
+
+static int init_boot_watchdog_timeout(void)
+{
+ return globalvar_add_simple_int("boot.watchdog_timeout",
+ &boot_watchdog_timeout, "%u");
+}
+late_initcall(init_boot_watchdog_timeout);
+
+BAREBOX_MAGICVAR_NAMED(global_watchdog_timeout, global.boot.watchdog_timeout,
+ "Watchdog enable timeout in seconds before booting");
+
static int boot_entry(struct blspec_entry *be)
{
int ret;
+ if (IS_ENABLED(CONFIG_WATCHDOG) && boot_watchdog_timeout) {
+ ret = watchdog_set_timeout(boot_watchdog_timeout);
+ if (ret)
+ pr_warn("Failed to enable watchdog: %s\n", strerror(-ret));
+ }
+
if (be->scriptpath) {
ret = boot_script(be->scriptpath);
} else {
@@ -375,7 +395,7 @@ static int do_boot(int argc, char *argv[])
dryrun = 0;
timeout = -1;
- while ((opt = getopt(argc, argv, "vldmt:")) > 0) {
+ while ((opt = getopt(argc, argv, "vldmt:w:")) > 0) {
switch (opt) {
case 'v':
verbose++;
@@ -392,6 +412,9 @@ static int do_boot(int argc, char *argv[])
case 't':
timeout = simple_strtoul(optarg, NULL, 0);
break;
+ case 'w':
+ boot_watchdog_timeout = simple_strtoul(optarg, NULL, 0);
+ break;
}
}
@@ -477,6 +500,7 @@ BAREBOX_CMD_HELP_OPT ("-v","Increase verbosity")
BAREBOX_CMD_HELP_OPT ("-d","Dryrun. See what happens but do no actually boot")
BAREBOX_CMD_HELP_OPT ("-l","List available boot sources")
BAREBOX_CMD_HELP_OPT ("-m","Show a menu with boot options")
+BAREBOX_CMD_HELP_OPT ("-w SECS","Start watchdog with timeout SECS before booting")
BAREBOX_CMD_HELP_OPT ("-t SECS","specify timeout in SECS")
BAREBOX_CMD_HELP_END
diff --git a/commands/login.c b/commands/login.c
index bf5085c854..58bb592900 100644
--- a/commands/login.c
+++ b/commands/login.c
@@ -19,89 +19,23 @@
#include <command.h>
#include <complete.h>
#include <password.h>
-#include <getopt.h>
-#include <environment.h>
-#include <globalvar.h>
-#include <magicvar.h>
-#include <init.h>
-#include <console.h>
-
-#define PASSWD_MAX_LENGTH (128 + 1)
-
-#if defined(CONFIG_PASSWD_MODE_STAR)
-#define LOGIN_MODE STAR
-#elif defined(CONFIG_PASSWD_MODE_CLEAR)
-#define LOGIN_MODE CLEAR
-#else
-#define LOGIN_MODE HIDE
-#endif
-
-static int login_timeout = 0;
static int do_login(int argc, char *argv[])
{
- unsigned char passwd[PASSWD_MAX_LENGTH];
- int passwd_len, opt;
- int timeout = login_timeout;
- char *timeout_cmd = "boot";
-
- console_allow_input(true);
- if (!is_passwd_enable()) {
- puts("login: password not set\n");
- return 0;
- }
-
- while((opt = getopt(argc, argv, "t:")) > 0) {
- switch(opt) {
- case 't':
- timeout = simple_strtoul(optarg, NULL, 10);
- break;
- }
- }
-
- if (optind != argc)
- timeout_cmd = argv[optind];
-
- do {
- puts("Password: ");
- passwd_len = password(passwd, PASSWD_MAX_LENGTH, LOGIN_MODE, timeout);
-
- if (passwd_len < 0) {
- console_allow_input(false);
- run_command(timeout_cmd);
- }
-
- if (check_passwd(passwd, passwd_len) == 1)
- return 0;
- } while(1);
+ login();
return 0;
}
BAREBOX_CMD_HELP_START(login)
BAREBOX_CMD_HELP_TEXT("Asks for a password from the console before script execution continues.")
-BAREBOX_CMD_HELP_TEXT("The password can be set with the 'passwd' command. Instead of specifying")
-BAREBOX_CMD_HELP_TEXT("a TIMEOUT the magic variable 'global.login.timeout' could be set.")
-BAREBOX_CMD_HELP_TEXT("")
-BAREBOX_CMD_HELP_TEXT("Options:")
-BAREBOX_CMD_HELP_OPT("-t TIMEOUT", "Execute COMMAND if no login withing TIMEOUT seconds")
+BAREBOX_CMD_HELP_TEXT("The password can be set with the 'passwd' command.")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(login)
.cmd = do_login,
BAREBOX_CMD_DESC("ask for a password")
- BAREBOX_CMD_OPTS("[-t TIMEOUT] COMMAND")
BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
BAREBOX_CMD_HELP(cmd_login_help)
BAREBOX_CMD_COMPLETE(empty_complete)
BAREBOX_CMD_END
-
-static int login_global_init(void)
-{
- globalvar_add_simple_int("login.timeout", &login_timeout, "%d");
-
- return 0;
-}
-late_initcall(login_global_init);
-
-BAREBOX_MAGICVAR_NAMED(global_login_timeout, global.login.timeout, "timeout to type the password");
diff --git a/commands/menutree.c b/commands/menutree.c
index 5d30b67ee5..ea5f65f3a1 100644
--- a/commands/menutree.c
+++ b/commands/menutree.c
@@ -12,12 +12,15 @@
#include <common.h>
#include <getopt.h>
#include <menu.h>
+#include <password.h>
static int do_menutree(int argc, char *argv[])
{
int opt, ret;
char *path = "/env/menu";
+ login();
+
while ((opt = getopt(argc, argv, "m:")) > 0) {
switch (opt) {
case 'm':
diff --git a/commands/splash.c b/commands/splash.c
index 90f0a0cdf2..15b296b680 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -15,9 +15,9 @@ static int do_splash(int argc, char *argv[])
int opt;
char *fbdev = "/dev/fb0";
char *image_file;
- int offscreen = 0;
u32 bg_color = 0x00000000;
bool do_bg = false;
+ void *buf;
memset(&s, 0, sizeof(s));
@@ -41,8 +41,6 @@ static int do_splash(int argc, char *argv[])
case 'y':
s.y = simple_strtoul(optarg, NULL, 0);
break;
- case 'o':
- offscreen = 1;
}
}
@@ -52,21 +50,17 @@ static int do_splash(int argc, char *argv[])
}
image_file = argv[optind];
- sc = fb_open(fbdev, offscreen);
+ sc = fb_open(fbdev);
if (IS_ERR(sc)) {
perror("fd_open");
return PTR_ERR(sc);
}
- if (sc->offscreenbuf) {
- if (do_bg)
- gu_memset_pixel(sc->info, sc->offscreenbuf, bg_color,
- sc->s.width * sc->s.height);
- else
- memcpy(sc->offscreenbuf, sc->fb, sc->fbsize);
- } else if (do_bg) {
- gu_memset_pixel(sc->info, sc->fb, bg_color, sc->s.width * sc->s.height);
- }
+ buf = gui_screen_render_buffer(sc);
+
+ if (do_bg)
+ gu_memset_pixel(sc->info, buf, bg_color,
+ sc->s.width * sc->s.height);
ret = image_renderer_file(sc, &s, image_file);
if (ret > 0)
@@ -89,7 +83,6 @@ BAREBOX_CMD_HELP_OPT ("-f FB\t", "framebuffer device (default /dev/fb0)")
BAREBOX_CMD_HELP_OPT ("-x XOFFS", "x offset (default center)")
BAREBOX_CMD_HELP_OPT ("-y YOFFS", "y offset (default center)")
BAREBOX_CMD_HELP_OPT ("-b COLOR", "background color in 0xttrrggbb")
-BAREBOX_CMD_HELP_OPT ("-o\t", "render offscreen")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(splash)
diff --git a/commands/ubiformat.c b/commands/ubiformat.c
index e63f16e351..f9d952cff0 100644
--- a/commands/ubiformat.c
+++ b/commands/ubiformat.c
@@ -779,6 +779,7 @@ BAREBOX_CMD_HELP_OPT("-f FILE\t", "flash image file")
BAREBOX_CMD_HELP_OPT("-e VALUE", "use VALUE as erase counter value for all eraseblocks")
BAREBOX_CMD_HELP_OPT("-x NUM\t", "UBI version number to put to EC headers (default 1)")
BAREBOX_CMD_HELP_OPT("-Q NUM\t", "32-bit UBI image sequence number to use")
+BAREBOX_CMD_HELP_OPT("-y\t", "Assume yes for all questions")
BAREBOX_CMD_HELP_OPT("-q\t", "suppress progress percentage information")
BAREBOX_CMD_HELP_OPT("-v\t", "be verbose")
BAREBOX_CMD_HELP_TEXT("")