mail archive of the rauc mailing list
 help / color / mirror / Atom feed
* [RAUC] [PATCH] config_file: bootchooser: add barebox-statename parameter
@ 2018-03-11 16:00 Andreas Schmidt
  2018-03-13  9:02 ` Jan Lübbe
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schmidt @ 2018-03-11 16:00 UTC (permalink / raw)
  To: rauc

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-03-16 16:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-11 16:00 [RAUC] [PATCH] config_file: bootchooser: add barebox-statename parameter Andreas Schmidt
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox