mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Xavier Douville <barebox@douville.org>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/1] commands/ubi.c: Add support for VID header offset in ubiattach
Date: Mon, 11 Feb 2013 10:19:05 +0100	[thread overview]
Message-ID: <20130211091905.GQ1906@pengutronix.de> (raw)
In-Reply-To: <20130208200200.IIAE15122.toroondcbmts07-srv.bellnexxia.net@toip55-bus.srvr.bell.ca>

Hi Xavier,

On Fri, Feb 08, 2013 at 03:01:53PM -0500, Xavier Douville wrote:
> Hi
> 
> On my board I needed to pass a custom VID header offset to ubiattach.
> This patch adds the required option to the barebox command.

I don't know exactly, but I suspect something is wrong on your board
then. Normally the VID header offset should be detected correctly
automatically. Does the kernel also need a special VID header offset?
Have you flashed an UBI image or did you generate the UBI on the target
directly?

> 
> I also fixed a bug in the error handling of the return value of
> ubi_attach_mtd_dev().
> This function doesn't always return 0 on success, it returns the UBI number.
> So without this patch, an error message is printed when attaching
> many UBI devices.
> 
> thanks for your work
> 
> Xavier Douville
> 
> 
>  commands/ubi.c |   25 +++++++++++++++++--------
>  1 file changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/commands/ubi.c b/commands/ubi.c
> index 1653eaa..a10ea1c 100644
> --- a/commands/ubi.c
> +++ b/commands/ubi.c
> @@ -60,9 +60,14 @@ static int do_ubiattach(int argc, char *argv[])
>  {
>      struct mtd_info_user user;
>      int fd, ret;
> +    int vid_hdr_offset = 0;
> 
> -    if (argc != 2)
> -        return COMMAND_ERROR_USAGE;
> +    if (argc != 2) {
> +        if (argc == 3)
> +            vid_hdr_offset = simple_strtol(argv[2], NULL, 0);
> +        else
> +            return COMMAND_ERROR_USAGE;
> +    }

Please use getopt() for additional arguments.

> 
>      fd = open(argv[1], O_RDWR);
>      if (fd < 0) {
> @@ -71,19 +76,23 @@ static int do_ubiattach(int argc, char *argv[])
>      }
> 
>      ret = ioctl(fd, MEMGETINFO, &user);
> -    if (!ret)
> -        ret = ubi_attach_mtd_dev(user.mtd, UBI_DEV_NUM_AUTO, 0);
> +    if (!ret) {
> +        ret = ubi_attach_mtd_dev(user.mtd, UBI_DEV_NUM_AUTO,
> vid_hdr_offset);

You mailer wraps lines. I won't be able to apply this patch.

Sascha


-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-02-11  9:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 20:01 Xavier Douville
2013-02-11  9:19 ` Sascha Hauer [this message]
2013-02-11 15:14   ` Xavier Douville
2013-02-11 15:21     ` Sascha Hauer
2013-02-14 16:23       ` Jan Lübbe
2013-02-15 15:54         ` Xavier Douville
2013-02-15 16:06           ` Jan Lübbe
2013-02-15 16:58             ` Xavier Douville
2013-02-12 22:49     ` Marc Kleine-Budde
2013-02-12 22:52       ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-13  9:00         ` Marc Kleine-Budde
2013-02-12 15:31   ` [PATCH] Do not print error message when successfully attaching more than one UBI device Xavier Douville

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=20130211091905.GQ1906@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@douville.org \
    --cc=barebox@lists.infradead.org \
    /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