From: Andreas Schmidt <mail@schmidt-andreas.de>
To: rauc@pengutronix.de
Subject: [RAUC] [PATCH] config_file: bootchooser: add barebox-statename parameter
Date: Sun, 11 Mar 2018 17:00:02 +0100 [thread overview]
Message-ID: <20180311160002.29290-1-mail@schmidt-andreas.de> (raw)
Name of the barebox boot state can be set by user in bootchooser
framework. barebox-state application has -n parameter to change
boot state name. This patch add possibility to change barebox boot
state name over rauc configuration file.
Signed-off-by: Andreas Schmidt <mail@schmidt-andreas.de>
---
Hi!
I have several states in barebox state framework. Of course, I named them with different
names. By default barebox-state without -n parameter search for /state or /aliases/state,
but my boot state get the name "bootstate". I created this patch to have a simple possibility
using rauc with not default barebox boot state names.
Regards,
Andreas
---
include/config_file.h | 1 +
src/bootchooser.c | 8 ++++++++
src/config_file.c | 4 ++++
3 files changed, 13 insertions(+)
diff --git a/include/config_file.h b/include/config_file.h
index 972dd48..eb71e2a 100644
--- a/include/config_file.h
+++ b/include/config_file.h
@@ -27,6 +27,7 @@ typedef struct {
RConfigSysVariant system_variant_type;
gchar *system_variant;
gchar *system_bootloader;
+ gchar *system_bb_statename;
/* path prefix where rauc may create mount directories */
gchar *mount_prefix;
gchar *store_path;
diff --git a/src/bootchooser.c b/src/bootchooser.c
index d9b2830..16f45d5 100644
--- a/src/bootchooser.c
+++ b/src/bootchooser.c
@@ -69,6 +69,10 @@ static gboolean barebox_state_get(const gchar* bootname, BareboxSlotState *bb_st
g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
g_ptr_array_add(args, g_strdup(BAREBOX_STATE_NAME));
+ if (r_context()->config->system_bb_statename) {
+ g_ptr_array_add(args, g_strdup("-n"));
+ g_ptr_array_add(args, g_strdup(r_context()->config->system_bb_statename));
+ }
g_ptr_array_add(args, g_strdup("-g"));
g_ptr_array_add(args, g_strdup_printf(BOOTSTATE_PREFIX ".%s.priority", bootname));
g_ptr_array_add(args, g_strdup("-g"));
@@ -157,6 +161,10 @@ static gboolean barebox_state_set(GPtrArray *pairs, GError **error) {
g_assert_cmpuint(pairs->len, >, 0);
g_ptr_array_add(args, g_strdup(BAREBOX_STATE_NAME));
+ if (r_context()->config->system_bb_statename) {
+ g_ptr_array_add(args, g_strdup("-n"));
+ g_ptr_array_add(args, g_strdup(r_context()->config->system_bb_statename));
+ }
for (guint i = 0; i < pairs->len; i++) {
g_ptr_array_add(args, g_strdup("-s"));
g_ptr_array_add(args, g_strdup(pairs->pdata[i]));
diff --git a/src/config_file.c b/src/config_file.c
index 34d9dcf..f28b59e 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -124,6 +124,10 @@ gboolean load_config(const gchar *filename, RaucConfig **config, GError **error)
goto free;
}
+ if (g_strcmp0(c->system_bootloader, "barebox") == 0) {
+ c->system_bb_statename = g_key_file_get_string(key_file, "system", "barebox-statename", NULL);
+ }
+
c->mount_prefix = g_key_file_get_string(key_file, "system", "mountprefix", NULL);
if (!c->mount_prefix) {
g_debug("No mount prefix provided, using /mnt/rauc/ as default");
--
2.14.1
_______________________________________________
RAUC mailing list
next reply other threads:[~2018-03-11 16:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-11 16:00 Andreas Schmidt [this message]
2018-03-13 9:02 ` Jan Lübbe
2018-03-15 19:13 ` [RAUC] [PATCH v2 0/2] Add " Andreas Schmidt
2018-03-15 19:13 ` [RAUC] [PATCH v2 1/2] config_file: bootchooser: add " Andreas Schmidt
2018-03-15 19:13 ` [RAUC] [PATCH v2 2/2] docs: add documentation for barebox-statename in reference.rst Andreas Schmidt
2018-03-16 16:05 ` [RAUC] [PATCH v2 0/2] Add barebox-statename parameter Jan Lübbe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180311160002.29290-1-mail@schmidt-andreas.de \
--to=mail@schmidt-andreas.de \
--cc=rauc@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox