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

* Re: [RAUC] [PATCH] config_file: bootchooser: add barebox-statename parameter
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Lübbe @ 2018-03-13  9:02 UTC (permalink / raw)
  To: rauc

Hi Andreas,

On Sun, 2018-03-11 at 17:00 +0100, Andreas Schmidt wrote:
> 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.

The code looks fine, but we'd need documentation for this new key in
docs/reference.rst:
https://rauc.readthedocs.io/en/latest/reference.html#system-configuration-file

Regards,
Jan

> ---
>  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");
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
RAUC mailing list

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

* [RAUC] [PATCH v2 0/2] Add barebox-statename parameter
  2018-03-13  9:02 ` Jan Lübbe
@ 2018-03-15 19:13   ` Andreas Schmidt
  2018-03-15 19:13     ` [RAUC] [PATCH v2 1/2] config_file: bootchooser: add " Andreas Schmidt
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andreas Schmidt @ 2018-03-15 19:13 UTC (permalink / raw)
  To: rauc

Hi Jan,
thanks for comments. I' afraid my English not good enough for documentation.
My colleague made the documentation patch additionally to already
send source code patch.

Changes since v1:
 - add documentation

Regards,
Andreas

Andreas Schmidt (1):
  config_file: bootchooser: add barebox-statename parameter

Oleg Karfich (1):
  docs: add documentation for barebox-statename in reference.rst

 docs/reference.rst    | 6 ++++++
 include/config_file.h | 1 +
 src/bootchooser.c     | 8 ++++++++
 src/config_file.c     | 4 ++++
 4 files changed, 19 insertions(+)

-- 
2.14.1


_______________________________________________
RAUC mailing list

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

* [RAUC] [PATCH v2 1/2] config_file: bootchooser: add barebox-statename parameter
  2018-03-15 19:13   ` [RAUC] [PATCH v2 0/2] Add " Andreas Schmidt
@ 2018-03-15 19:13     ` 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
  2 siblings, 0 replies; 6+ messages in thread
From: Andreas Schmidt @ 2018-03-15 19:13 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>
---
 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

* [RAUC] [PATCH v2 2/2] docs: add documentation for barebox-statename in reference.rst
  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     ` Andreas Schmidt
  2018-03-16 16:05     ` [RAUC] [PATCH v2 0/2] Add barebox-statename parameter Jan Lübbe
  2 siblings, 0 replies; 6+ messages in thread
From: Andreas Schmidt @ 2018-03-15 19:13 UTC (permalink / raw)
  To: rauc; +Cc: Oleg Karfich

From: Oleg Karfich <oleg.karfich@wago.com>

Signed-off-by: Oleg Karfich <oleg.karfich@wago.com>
---
 docs/reference.rst | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/docs/reference.rst b/docs/reference.rst
index 2af2aac..6596a8c 100644
--- a/docs/reference.rst
+++ b/docs/reference.rst
@@ -81,6 +81,12 @@ Example configuration:
   This file should be located on a filesystem which is not overwritten during
   updates.
 
+``barebox-statename``
+  Only valid when ``bootloader`` is set to ``barebox``.
+  Overwrites the default state ``state`` to a user-defined state name. If this
+  key not exists, the bootchooser framework searches per default for ``/state``
+  or ``/aliases/state``.
+
 **[keyring] section**
 
 The ``keyring`` section refers to the trusted keyring used for signature
-- 
2.14.1


_______________________________________________
RAUC mailing list

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

* Re: [RAUC] [PATCH v2 0/2] Add barebox-statename parameter
  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     ` Jan Lübbe
  2 siblings, 0 replies; 6+ messages in thread
From: Jan Lübbe @ 2018-03-16 16:05 UTC (permalink / raw)
  To: rauc

Hi Andreas,

On Thu, 2018-03-15 at 20:13 +0100, Andreas Schmidt wrote:
> Hi Jan,
> thanks for comments. I' afraid my English not good enough for
> documentation.
> My colleague made the documentation patch additionally to already
> send source code patch.

Thanks!

I've applied your patches:
https://github.com/rauc/rauc/pull/252

If you like, you can also send pull requests directly on github.

Regards,
Jan
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
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