* [RAUC] [PATCH] Add suport for bare flash
@ 2019-12-06 14:43 Ladislav Michl
2019-12-06 15:01 ` Enrico Joerns
0 siblings, 1 reply; 3+ messages in thread
From: Ladislav Michl @ 2019-12-06 14:43 UTC (permalink / raw)
To: rauc
Add handler to write images using flashcp. Used to update barebox on at91
based board with dataflash.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
src/update_handler.c | 72 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/src/update_handler.c b/src/update_handler.c
index 0415c92..8385096 100644
--- a/src/update_handler.c
+++ b/src/update_handler.c
@@ -497,6 +497,42 @@ out:
return res;
}
+static gboolean flash_write_slot(const gchar *image, const gchar *device, GError **error)
+{
+ g_autoptr(GSubprocess) sproc = NULL;
+ GError *ierror = NULL;
+ gboolean res = FALSE;
+ g_autoptr(GPtrArray) args = g_ptr_array_new_full(5, g_free);
+
+ g_ptr_array_add(args, g_strdup("flashcp"));
+ g_ptr_array_add(args, g_strdup(image));
+ g_ptr_array_add(args, g_strdup(device));
+ g_ptr_array_add(args, NULL);
+
+ r_debug_subprocess(args);
+ sproc = g_subprocess_newv((const gchar * const *)args->pdata,
+ G_SUBPROCESS_FLAGS_NONE, &ierror);
+ if (sproc == NULL) {
+ g_propagate_prefixed_error(
+ error,
+ ierror,
+ "failed to start flashcp: ");
+ goto out;
+ }
+
+ res = g_subprocess_wait_check(sproc, NULL, &ierror);
+ if (!res) {
+ g_propagate_prefixed_error(
+ error,
+ ierror,
+ "failed to run flashcp: ");
+ goto out;
+ }
+
+out:
+ return res;
+}
+
static gboolean nand_format_slot(const gchar *device, GError **error)
{
g_autoptr(GSubprocess) sproc = NULL;
@@ -1046,6 +1082,41 @@ out:
return res;
}
+static gboolean img_to_flash_handler(RaucImage *image, RaucSlot *dest_slot, const gchar *hook_name, GError **error)
+{
+ GError *ierror = NULL;
+ gboolean res = FALSE;
+
+ /* run slot pre install hook if enabled */
+ if (hook_name && image->hooks.pre_install) {
+ res = run_slot_hook(hook_name, R_SLOT_HOOK_PRE_INSTALL, NULL, dest_slot, &ierror);
+ if (!res) {
+ g_propagate_error(error, ierror);
+ goto out;
+ }
+ }
+
+ /* write */
+ g_message("writing slot device %s", dest_slot->device);
+ res = flash_write_slot(image->filename, dest_slot->device, &ierror);
+ if (!res) {
+ g_propagate_error(error, ierror);
+ goto out;
+ }
+
+ /* run slot post install hook if enabled */
+ if (hook_name && image->hooks.post_install) {
+ res = run_slot_hook(hook_name, R_SLOT_HOOK_POST_INSTALL, NULL, dest_slot, &ierror);
+ if (!res) {
+ g_propagate_error(error, ierror);
+ goto out;
+ }
+ }
+
+out:
+ return res;
+}
+
static gboolean img_to_nand_handler(RaucImage *image, RaucSlot *dest_slot, const gchar *hook_name, GError **error)
{
GError *ierror = NULL;
@@ -1496,6 +1567,7 @@ RaucUpdatePair updatepairs[] = {
{"*.ubifs", "ubivol", img_to_ubivol_handler},
{"*.ubifs", "ubifs", img_to_ubifs_handler},
{"*.img", "ext4", img_to_fs_handler},
+ {"*.img", "flash", img_to_flash_handler},
{"*.img", "nand", img_to_nand_handler},
{"*.img", "ubifs", img_to_ubifs_handler},
{"*.img", "ubivol", img_to_ubivol_handler},
--
2.24.0
_______________________________________________
RAUC mailing list
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RAUC] [PATCH] Add suport for bare flash
2019-12-06 14:43 [RAUC] [PATCH] Add suport for bare flash Ladislav Michl
@ 2019-12-06 15:01 ` Enrico Joerns
2019-12-06 17:25 ` Ladislav Michl
0 siblings, 1 reply; 3+ messages in thread
From: Enrico Joerns @ 2019-12-06 15:01 UTC (permalink / raw)
To: Ladislav Michl; +Cc: rauc
Hi ladis,
Mind if I play the GitHub bridge?
On 12/6/19 3:43 PM, Ladislav Michl wrote:
> Add handler to write images using flashcp. Used to update barebox on at91
> based board with dataflash.
>
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
There we have all the checking and testing infrastructure. Patches via mailing
list are not officially supported as you know.
Or did you take the chance of creating an account already?
Regards, Enrico
> ---
> src/update_handler.c | 72 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 72 insertions(+)
>
> diff --git a/src/update_handler.c b/src/update_handler.c
> index 0415c92..8385096 100644
> --- a/src/update_handler.c
> +++ b/src/update_handler.c
> @@ -497,6 +497,42 @@ out:
> return res;
> }
>
> +static gboolean flash_write_slot(const gchar *image, const gchar *device, GError **error)
> +{
> + g_autoptr(GSubprocess) sproc = NULL;
> + GError *ierror = NULL;
> + gboolean res = FALSE;
> + g_autoptr(GPtrArray) args = g_ptr_array_new_full(5, g_free);
> +
> + g_ptr_array_add(args, g_strdup("flashcp"));
> + g_ptr_array_add(args, g_strdup(image));
> + g_ptr_array_add(args, g_strdup(device));
> + g_ptr_array_add(args, NULL);
> +
> + r_debug_subprocess(args);
> + sproc = g_subprocess_newv((const gchar * const *)args->pdata,
> + G_SUBPROCESS_FLAGS_NONE, &ierror);
> + if (sproc == NULL) {
> + g_propagate_prefixed_error(
> + error,
> + ierror,
> + "failed to start flashcp: ");
> + goto out;
> + }
> +
> + res = g_subprocess_wait_check(sproc, NULL, &ierror);
> + if (!res) {
> + g_propagate_prefixed_error(
> + error,
> + ierror,
> + "failed to run flashcp: ");
> + goto out;
> + }
> +
> +out:
> + return res;
> +}
> +
> static gboolean nand_format_slot(const gchar *device, GError **error)
> {
> g_autoptr(GSubprocess) sproc = NULL;
> @@ -1046,6 +1082,41 @@ out:
> return res;
> }
>
> +static gboolean img_to_flash_handler(RaucImage *image, RaucSlot *dest_slot, const gchar *hook_name, GError **error)
> +{
> + GError *ierror = NULL;
> + gboolean res = FALSE;
> +
> + /* run slot pre install hook if enabled */
> + if (hook_name && image->hooks.pre_install) {
> + res = run_slot_hook(hook_name, R_SLOT_HOOK_PRE_INSTALL, NULL, dest_slot, &ierror);
> + if (!res) {
> + g_propagate_error(error, ierror);
> + goto out;
> + }
> + }
> +
> + /* write */
> + g_message("writing slot device %s", dest_slot->device);
> + res = flash_write_slot(image->filename, dest_slot->device, &ierror);
> + if (!res) {
> + g_propagate_error(error, ierror);
> + goto out;
> + }
> +
> + /* run slot post install hook if enabled */
> + if (hook_name && image->hooks.post_install) {
> + res = run_slot_hook(hook_name, R_SLOT_HOOK_POST_INSTALL, NULL, dest_slot, &ierror);
> + if (!res) {
> + g_propagate_error(error, ierror);
> + goto out;
> + }
> + }
> +
> +out:
> + return res;
> +}
> +
> static gboolean img_to_nand_handler(RaucImage *image, RaucSlot *dest_slot, const gchar *hook_name, GError **error)
> {
> GError *ierror = NULL;
> @@ -1496,6 +1567,7 @@ RaucUpdatePair updatepairs[] = {
> {"*.ubifs", "ubivol", img_to_ubivol_handler},
> {"*.ubifs", "ubifs", img_to_ubifs_handler},
> {"*.img", "ext4", img_to_fs_handler},
> + {"*.img", "flash", img_to_flash_handler},
> {"*.img", "nand", img_to_nand_handler},
> {"*.img", "ubifs", img_to_ubifs_handler},
> {"*.img", "ubivol", img_to_ubivol_handler},
>
--
Pengutronix e.K. | Enrico Jörns |
Embedded Linux Consulting & Support | Teamleiter Integration |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-5080 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
RAUC mailing list
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RAUC] [PATCH] Add suport for bare flash
2019-12-06 15:01 ` Enrico Joerns
@ 2019-12-06 17:25 ` Ladislav Michl
0 siblings, 0 replies; 3+ messages in thread
From: Ladislav Michl @ 2019-12-06 17:25 UTC (permalink / raw)
To: Enrico Joerns; +Cc: rauc
On Fri, Dec 06, 2019 at 04:01:40PM +0100, Enrico Joerns wrote:
> Hi ladis,
>
> Mind if I play the GitHub bridge?
>
> On 12/6/19 3:43 PM, Ladislav Michl wrote:
> > Add handler to write images using flashcp. Used to update barebox on at91
> > based board with dataflash.
> >
> > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
>
> There we have all the checking and testing infrastructure. Patches via
> mailing list are not officially supported as you know.
Oh... That's why only this one was sent. There are few more in my queue,
but as I know I need to use GitHub :)
> Or did you take the chance of creating an account already?
Hmm, unlike other services from previous century this one claims my
username is already taken. So as soon as I found any unclaimed username
not being completely radom I put all the patches to the GitHub ;-)
> Regards, Enrico
>
> > ---
> > src/update_handler.c | 72 ++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 72 insertions(+)
> >
> > diff --git a/src/update_handler.c b/src/update_handler.c
> > index 0415c92..8385096 100644
> > --- a/src/update_handler.c
> > +++ b/src/update_handler.c
> > @@ -497,6 +497,42 @@ out:
> > return res;
> > }
> > +static gboolean flash_write_slot(const gchar *image, const gchar *device, GError **error)
> > +{
> > + g_autoptr(GSubprocess) sproc = NULL;
> > + GError *ierror = NULL;
> > + gboolean res = FALSE;
> > + g_autoptr(GPtrArray) args = g_ptr_array_new_full(5, g_free);
> > +
> > + g_ptr_array_add(args, g_strdup("flashcp"));
> > + g_ptr_array_add(args, g_strdup(image));
> > + g_ptr_array_add(args, g_strdup(device));
> > + g_ptr_array_add(args, NULL);
> > +
> > + r_debug_subprocess(args);
> > + sproc = g_subprocess_newv((const gchar * const *)args->pdata,
> > + G_SUBPROCESS_FLAGS_NONE, &ierror);
> > + if (sproc == NULL) {
> > + g_propagate_prefixed_error(
> > + error,
> > + ierror,
> > + "failed to start flashcp: ");
> > + goto out;
> > + }
> > +
> > + res = g_subprocess_wait_check(sproc, NULL, &ierror);
> > + if (!res) {
> > + g_propagate_prefixed_error(
> > + error,
> > + ierror,
> > + "failed to run flashcp: ");
> > + goto out;
> > + }
> > +
> > +out:
> > + return res;
> > +}
> > +
> > static gboolean nand_format_slot(const gchar *device, GError **error)
> > {
> > g_autoptr(GSubprocess) sproc = NULL;
> > @@ -1046,6 +1082,41 @@ out:
> > return res;
> > }
> > +static gboolean img_to_flash_handler(RaucImage *image, RaucSlot *dest_slot, const gchar *hook_name, GError **error)
> > +{
> > + GError *ierror = NULL;
> > + gboolean res = FALSE;
> > +
> > + /* run slot pre install hook if enabled */
> > + if (hook_name && image->hooks.pre_install) {
> > + res = run_slot_hook(hook_name, R_SLOT_HOOK_PRE_INSTALL, NULL, dest_slot, &ierror);
> > + if (!res) {
> > + g_propagate_error(error, ierror);
> > + goto out;
> > + }
> > + }
> > +
> > + /* write */
> > + g_message("writing slot device %s", dest_slot->device);
> > + res = flash_write_slot(image->filename, dest_slot->device, &ierror);
> > + if (!res) {
> > + g_propagate_error(error, ierror);
> > + goto out;
> > + }
> > +
> > + /* run slot post install hook if enabled */
> > + if (hook_name && image->hooks.post_install) {
> > + res = run_slot_hook(hook_name, R_SLOT_HOOK_POST_INSTALL, NULL, dest_slot, &ierror);
> > + if (!res) {
> > + g_propagate_error(error, ierror);
> > + goto out;
> > + }
> > + }
> > +
> > +out:
> > + return res;
> > +}
> > +
> > static gboolean img_to_nand_handler(RaucImage *image, RaucSlot *dest_slot, const gchar *hook_name, GError **error)
> > {
> > GError *ierror = NULL;
> > @@ -1496,6 +1567,7 @@ RaucUpdatePair updatepairs[] = {
> > {"*.ubifs", "ubivol", img_to_ubivol_handler},
> > {"*.ubifs", "ubifs", img_to_ubifs_handler},
> > {"*.img", "ext4", img_to_fs_handler},
> > + {"*.img", "flash", img_to_flash_handler},
> > {"*.img", "nand", img_to_nand_handler},
> > {"*.img", "ubifs", img_to_ubifs_handler},
> > {"*.img", "ubivol", img_to_ubivol_handler},
> >
>
> --
> Pengutronix e.K. | Enrico Jörns |
> Embedded Linux Consulting & Support | Teamleiter Integration |
> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-5080 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
RAUC mailing list
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-06 17:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 14:43 [RAUC] [PATCH] Add suport for bare flash Ladislav Michl
2019-12-06 15:01 ` Enrico Joerns
2019-12-06 17:25 ` Ladislav Michl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox