mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 2/2] ARM: i.MX bbu: support partitions starting at i.MX header
Date: Fri, 29 Jun 2018 11:29:21 -0700	[thread overview]
Message-ID: <CAHQ1cqHFy5rRQAV4hWNmqPmMCDbzjE5+TfH5qCReDMPxK_deqA@mail.gmail.com> (raw)
In-Reply-To: <20180629064914.518-2-s.hauer@pengutronix.de>

On Thu, Jun 28, 2018 at 11:50 PM Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
> The i.MX header is at an offset in the boot device, usually 0x400 bytes.
> This patch adds a flag to support the case that the partition the image
> is written to starts at that offset rather than 0x0.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  arch/arm/mach-imx/imx-bbu-internal.c | 7 +++++--
>  arch/arm/mach-imx/include/mach/bbu.h | 8 ++++++++
>  2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
> index 5422235b1b..23686e9d61 100644
> --- a/arch/arm/mach-imx/imx-bbu-internal.c
> +++ b/arch/arm/mach-imx/imx-bbu-internal.c
> @@ -58,12 +58,15 @@ static int imx_bbu_write_device(struct imx_internal_bbu_handler *imx_handler,
>         if (fd < 0)
>                 return fd;
>
> -       if (imx_handler->handler.flags & IMX_BBU_FLAG_KEEP_HEAD) {
> +       if (imx_handler->handler.flags & (IMX_BBU_FLAG_KEEP_HEAD |
> +           IMX_BBU_FLAG_PARTITION_STARTS_AT_HEADER)) {
>                 image_len -= imx_handler->flash_header_offset;
> -               offset += imx_handler->flash_header_offset;
>                 buf += imx_handler->flash_header_offset;
>         }
>
> +       if (imx_handler->handler.flags & IMX_BBU_FLAG_KEEP_HEAD)
> +               offset += imx_handler->flash_header_offset;
> +
>         if (imx_handler->flags & IMX_INTERNAL_FLAG_ERASE) {
>                 pr_debug("%s: unprotecting %s from 0x%08x to 0x%08x\n", __func__,
>                                 devicefile, offset, image_len);
> diff --git a/arch/arm/mach-imx/include/mach/bbu.h b/arch/arm/mach-imx/include/mach/bbu.h
> index c2e875d342..19b446ed60 100644
> --- a/arch/arm/mach-imx/include/mach/bbu.h
> +++ b/arch/arm/mach-imx/include/mach/bbu.h
> @@ -16,6 +16,14 @@ struct imx_dcd_v2_entry;
>   */
>  #define IMX_BBU_FLAG_KEEP_HEAD (1 << 16)
>
> +/*
> + * Set this flag when the partition the update image is written to
> + * actually starts at the offset where the i.MX flash header is expected
> + * (usually 0x400). This means for the update code that it has to skip
> + * the first 0x400 bytes of the image.
> + */
> +#define IMX_BBU_FLAG_PARTITION_STARTS_AT_HEADER        (1 << 17)
> +

BIT(17)?

Thanks,
Andrey Smirnov

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

  reply	other threads:[~2018-06-29 18:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  6:49 [PATCH 1/2] ARM: i.MX bbu: reimplement IMX_INTERNAL_FLAG_KEEP_DOSPART flag Sascha Hauer
2018-06-29  6:49 ` [PATCH 2/2] ARM: i.MX bbu: support partitions starting at i.MX header Sascha Hauer
2018-06-29 18:29   ` Andrey Smirnov [this message]
2018-06-29 18:28 ` [PATCH 1/2] ARM: i.MX bbu: reimplement IMX_INTERNAL_FLAG_KEEP_DOSPART flag Andrey Smirnov
2018-07-02  4:41   ` Sascha Hauer

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=CAHQ1cqHFy5rRQAV4hWNmqPmMCDbzjE5+TfH5qCReDMPxK_deqA@mail.gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@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