[PATCH 2/5] filetype: add GPT support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Thu Feb 14 11:53:23 EST 2013


On 17:36 Thu 14 Feb     , Sascha Hauer wrote:
> On Thu, Feb 14, 2013 at 04:52:24PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > GPT need to be check before MBR
> > 
> > Cc: Rob Herring <rob.herring at calxeda.com>
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> > ---
> >  common/filetype.c  |    4 ++++
> >  include/filetype.h |    1 +
> >  2 files changed, 5 insertions(+)
> > 
> > diff --git a/common/filetype.c b/common/filetype.c
> > index 22fc621..6563ecc 100644
> > --- a/common/filetype.c
> > +++ b/common/filetype.c
> > @@ -48,6 +48,7 @@ static const struct filetype_str filetype_str[] = {
> >  	[filetype_bmp] = { "BMP image", "bmp" },
> >  	[filetype_png] = { "PNG image", "png" },
> >  	[filetype_ext] = { "ext filesystem", "ext" },
> > +	[filetype_gpt] = { "GUID Partition Table", "gpt" },
> >  };
> >  
> >  const char *file_type_to_string(enum filetype f)
> > @@ -159,6 +160,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
> >  	if (bufsize < 512)
> >  		return filetype_unknown;
> >  
> > +	if (bufsize >= 520 && strncmp(&buf8[512], "EFI PART", 8) == 0)
> > +		return filetype_gpt;
> > +
> 
> The list is sorted by size, so please move this below:
on purpose

EFI need to be detect before mbr

Best Regards,
J.
> 
> 	if (bufsize < 1536)
> 		return filetype_unknown;
> 
> 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 |



More information about the barebox mailing list