mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: barebox@lists.infradead.org, Krzysztof Halasa <khc@pm.waw.pl>
Subject: Re: [PATCH] ARM: put a valid "barebox" signature in the header on big-endian systems.
Date: Sun, 13 May 2012 02:17:31 +0200	[thread overview]
Message-ID: <20120513001731.GC22395@pengutronix.de> (raw)
In-Reply-To: <CAA4bVAG8Hf6hDKk2=UXh5_TxXSSG+1c15=ER8LNKM-omtOnorw@mail.gmail.com>

On Sun, May 13, 2012 at 03:56:48AM +0400, Antony Pavlov wrote:
> On 13 May 2012 01:38, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> > Hello Krzysztof,
> >
> > On Sat, May 05, 2012 at 11:47:19PM +0200, Krzysztof Halasa wrote:
> >> Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
> >>
> >> diff --git a/arch/arm/include/asm/barebox-arm-head.h b/arch/arm/include/asm/barebox-arm-head.h
> >> index 0dc3074..2c250e9 100644
> >> --- a/arch/arm/include/asm/barebox-arm-head.h
> >> +++ b/arch/arm/include/asm/barebox-arm-head.h
> >> @@ -24,8 +24,7 @@ static inline void barebox_arm_head(void)
> >>               "1: b 1b\n"
> >>               "1: b 1b\n"
> >>  #endif
> >> -             ".word 0x65726162\n"                    /* 'bare' */
> >> -             ".word 0x00786f62\n"                    /* 'box' */
> >> +             ".asciz \"barebox\"\n"
> >>               ".word _text\n"                         /* text base. If copied there,
> >>                                                        * barebox can skip relocation
> >>                                                        */
> > Another downside of this patch (apart from the file type detection that
> > still needs adaption?) is that the magic is different depending on
> > endianess.
> 
> Can this addition to the patch fix the endianess issue?
> 
> --- a/common/filetype.c
> +++ b/common/filetype.c
> @@ -56,7 +56,7 @@ enum filetype file_detect_type(void *_buf)
> 
>         if (strncmp(buf8, "#!/bin/sh", 9) == 0)
>                 return filetype_sh;
> -       if (buf[8] == 0x65726162 && buf[9] == 0x00786f62)
> +       if (strncmp(buf8 + 0x20, "barebox", 7) == 0)
the original checked 8 bytes, you only check 7. Is this intended?

>                 return filetype_arm_barebox;
>         if (buf[9] == 0x016f2818 || buf[9] == 0x18286f01)
>                 return filetype_arm_zimage;

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

  reply	other threads:[~2012-05-13  0:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-05 21:47 Krzysztof Halasa
2012-05-06 18:17 ` Sascha Hauer
2012-05-06 20:19   ` Krzysztof Halasa
2012-05-10 12:30 ` Sascha Hauer
2012-05-12 21:38 ` Uwe Kleine-König
2012-05-12 23:56   ` Antony Pavlov
2012-05-13  0:17     ` Uwe Kleine-König [this message]
2012-05-13 10:05   ` Krzysztof Halasa
2012-05-13 12:20     ` 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=20120513001731.GC22395@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=khc@pm.waw.pl \
    /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