summaryrefslogtreecommitdiffstats
path: root/src/barebox-state.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-16 13:32:34 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-16 14:27:29 +0100
commit89135e5522720bc75615a6ec22bb8bcb7b4994e2 (patch)
tree3565e64a8903117f80c1e78de0407068d4815f5e /src/barebox-state.c
parent898a46705d8e672932e8668149e94bb0c9f9a878 (diff)
downloaddt-utils-89135e5522720bc75615a6ec22bb8bcb7b4994e2.tar.gz
dt-utils-89135e5522720bc75615a6ec22bb8bcb7b4994e2.tar.xz
barebox-state: Add force switch
The force switch allows to read from a state even when the keystore blobs cannot be read. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'src/barebox-state.c')
-rw-r--r--src/barebox-state.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/barebox-state.c b/src/barebox-state.c
index 25f3bc3..c9b000c 100644
--- a/src/barebox-state.c
+++ b/src/barebox-state.c
@@ -37,6 +37,8 @@
#include <dt/dt.h>
#include <state.h>
+static int force;
+
struct state_variable;
static int __state_uint8_set(struct state_variable *var, const char *val);
@@ -360,7 +362,7 @@ struct state *state_get(const char *name, bool readonly)
return ERR_PTR(ret);
}
- state = state_new_from_node(node, devpath, offset, size, readonly);
+ state = state_new_from_node(node, devpath, offset, size, readonly, force);
if (IS_ERR(state)) {
pr_err("unable to initialize state: %s\n",
strerror(PTR_ERR(state)));
@@ -380,6 +382,7 @@ static struct option long_options[] = {
{"name", required_argument, 0, 'n' },
{"dump", no_argument, 0, 'd' },
{"dump-shell", no_argument, 0, OPT_DUMP_SHELL },
+ {"force", no_argument, 0, 'f' },
{"verbose", no_argument, 0, 'v' },
{"help", no_argument, 0, 'h' },
};
@@ -394,6 +397,7 @@ static void usage(char *name)
"-n, --name <name> specify the state to use (default=\"state\"). Multiple states are allowed.\n"
"-d, --dump dump the state\n"
"--dump-shell dump the state suitable for shell sourcing\n"
+"-f, --force ignore errors (like missing hmac algo)\n"
"-v, --verbose increase verbosity\n"
"-q, --quiet decrease verbosity\n"
"--help this help\n",
@@ -476,6 +480,9 @@ int main(int argc, char *argv[])
++nr_states;
break;
}
+ case 'f':
+ force = 1;
+ break;
case ':':
case '?':
default: