Re: [U-Boot] [Resend RFC PATCH v1 1/3] add support of GPT partitioning over MTD

2016-11-30 Thread Patrick DELAUNAY
Hi Simon,

> 
> Hi Simon,
> 
> >
> > Hi Patrick,
> >
> > On 24 November 2016 at 03:27, Patrick DELAUNAY
> >  wrote:
> > > Hi Simon,
> > >
> > >>
> > >> Hi Patrick,
> > >>
> > >> On 22 November 2016 at 06:24, Patrick Delaunay
> > >>  wrote:
> > >> > From: Patrick Delaunay 
> > >> >
> > >> > Signed-off-by: Patrick Delaunay 
> > >> > Signed-off-by: Patrick Delaunay 
> > >> > ---
> > >> >
> > >> >  Kconfig|  12 ++
> > >> >  cmd/gpt.c  |  98 --
> > >> >  cmd/mtdparts.c | 103 ++-
> > >> >  cmd/part.c |  48 -
> > >> >  disk/part_efi.c| 526
> > >> -
> > >> >  doc/README.gpt.mtd | 189 +++
> > >> >  include/part.h |  13 +-
> > >> >  include/uuid.h |   1 +
> > >> >  lib/uuid.c |  33 
> > >> >  9 files changed, 944 insertions(+), 79 deletions(-)  create mode
> > >> > 100644 doc/README.gpt.mtd
> > >>
> > >> General comments:
> > >>
> > >> - use 'U-Boot' consistently rather than variations
> > >> - can you split your large function up a bit?
> > >> - can you make a precursor patch to refactor things, so reducing
> > >> the size of this one?
> > >
> > > Yes, I will do this split in v2 to reduce each patch size:
> > > - one patch to uuid new function
> > > - one precursor for efi part : refactor
> > > - one patch for GPT over MTD in part_efi.c
> > > & I will split large function
> > > - one patch for each command update
> > >
> > >> - nice README!
> > >>
> > >> >
> > >> > diff --git a/Kconfig b/Kconfig
> > >> > index 1263d0b..c2388e1 100644
> > >> > --- a/Kconfig
> > >> > +++ b/Kconfig
> > >> > @@ -335,6 +335,18 @@ config ARCH_FIXUP_FDT
> > >> >
> > >> >  endmenu# Boot images
> > >> >
> > >> > +config EFI_PARTITION_MTD
> > >> > +   bool "Support GPT over MTD"
> > >> > +   help
> > >> > + The GPT partition is normally defined only for block device 
> > >> > with
> > >> > + built-in controller which manage flash translation layer
> > >> > + This option activate the GPT partition support over RAW 
> > >> > device
> > >> > + using the MTD framework
> > >> > + - manage partition over MTD devices (as flash: NOR and NAND)
> > >> > + - extract MTD information
> > >> > + - update command gpt, mtdparts and part
> > >> > + NB: depends on EFI_PARTITION
> > >>
> > >> So do you want 'depends on EFI_PARTITION'?
> > >
> > > Yes I expect it, I try to add
> > > depends on EFI_PARTITION
> > > but is not working as it is not (yet ?)  one KCONFIG option.
> > > I add this comment to add this line when part lib will integrate
> > > KCONFIG
> >
> > I see. Well if you have the energy you could use moveconfig.py to convert
> it.
> 
> I will try to propose something (first usage of moveconfig.py script...) if I 
> have
> no issue with cross-compilation
> 
> =>  Create "disk/Kconfig" with PARTITIONS all associated option
> (MAC_PARTITION, DOS_PARTITION, ISO_PARTITION, AMIGA_PARTITION,
> EFI_PARTITION)

I push today the proposed patch for move disk  to Kconfig in mailing list 
(after some issue for target with SPL)
And I will rebase this RFC for GPT over MTD only when I will really push it on 
master branch.

> 
> 
> > Regards,
> > Simon

Regards Patrick
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [Resend RFC PATCH v1 1/3] add support of GPT partitioning over MTD

2016-11-28 Thread Patrick DELAUNAY
Hi Simon,

> 
> Hi Patrick,
> 
> On 24 November 2016 at 03:27, Patrick DELAUNAY
>  wrote:
> > Hi Simon,
> >
> >>
> >> Hi Patrick,
> >>
> >> On 22 November 2016 at 06:24, Patrick Delaunay
> >>  wrote:
> >> > From: Patrick Delaunay 
> >> >
> >> > Signed-off-by: Patrick Delaunay 
> >> > Signed-off-by: Patrick Delaunay 
> >> > ---
> >> >
> >> >  Kconfig|  12 ++
> >> >  cmd/gpt.c  |  98 --
> >> >  cmd/mtdparts.c | 103 ++-
> >> >  cmd/part.c |  48 -
> >> >  disk/part_efi.c| 526
> >> -
> >> >  doc/README.gpt.mtd | 189 +++
> >> >  include/part.h |  13 +-
> >> >  include/uuid.h |   1 +
> >> >  lib/uuid.c |  33 
> >> >  9 files changed, 944 insertions(+), 79 deletions(-)  create mode
> >> > 100644 doc/README.gpt.mtd
> >>
> >> General comments:
> >>
> >> - use 'U-Boot' consistently rather than variations
> >> - can you split your large function up a bit?
> >> - can you make a precursor patch to refactor things, so reducing the
> >> size of this one?
> >
> > Yes, I will do this split in v2 to reduce each patch size:
> > - one patch to uuid new function
> > - one precursor for efi part : refactor
> > - one patch for GPT over MTD in part_efi.c
> > & I will split large function
> > - one patch for each command update
> >
> >> - nice README!
> >>
> >> >
> >> > diff --git a/Kconfig b/Kconfig
> >> > index 1263d0b..c2388e1 100644
> >> > --- a/Kconfig
> >> > +++ b/Kconfig
> >> > @@ -335,6 +335,18 @@ config ARCH_FIXUP_FDT
> >> >
> >> >  endmenu# Boot images
> >> >
> >> > +config EFI_PARTITION_MTD
> >> > +   bool "Support GPT over MTD"
> >> > +   help
> >> > + The GPT partition is normally defined only for block device 
> >> > with
> >> > + built-in controller which manage flash translation layer
> >> > + This option activate the GPT partition support over RAW device
> >> > + using the MTD framework
> >> > + - manage partition over MTD devices (as flash: NOR and NAND)
> >> > + - extract MTD information
> >> > + - update command gpt, mtdparts and part
> >> > + NB: depends on EFI_PARTITION
> >>
> >> So do you want 'depends on EFI_PARTITION'?
> >
> > Yes I expect it, I try to add
> > depends on EFI_PARTITION
> > but is not working as it is not (yet ?)  one KCONFIG option.
> > I add this comment to add this line when part lib will integrate
> > KCONFIG
> 
> I see. Well if you have the energy you could use moveconfig.py to convert it.

I will try to propose something (first usage of moveconfig.py script...)
if I have no issue with cross-compilation

=>  Create "disk/Kconfig" with PARTITIONS all associated option
(MAC_PARTITION, DOS_PARTITION, ISO_PARTITION, AMIGA_PARTITION, EFI_PARTITION)


> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [Resend RFC PATCH v1 1/3] add support of GPT partitioning over MTD

2016-11-27 Thread Simon Glass
Hi Patrick,

On 24 November 2016 at 03:27, Patrick DELAUNAY  wrote:
> Hi Simon,
>
>>
>> Hi Patrick,
>>
>> On 22 November 2016 at 06:24, Patrick Delaunay
>>  wrote:
>> > From: Patrick Delaunay 
>> >
>> > Signed-off-by: Patrick Delaunay 
>> > Signed-off-by: Patrick Delaunay 
>> > ---
>> >
>> >  Kconfig|  12 ++
>> >  cmd/gpt.c  |  98 --
>> >  cmd/mtdparts.c | 103 ++-
>> >  cmd/part.c |  48 -
>> >  disk/part_efi.c| 526
>> -
>> >  doc/README.gpt.mtd | 189 +++
>> >  include/part.h |  13 +-
>> >  include/uuid.h |   1 +
>> >  lib/uuid.c |  33 
>> >  9 files changed, 944 insertions(+), 79 deletions(-)  create mode
>> > 100644 doc/README.gpt.mtd
>>
>> General comments:
>>
>> - use 'U-Boot' consistently rather than variations
>> - can you split your large function up a bit?
>> - can you make a precursor patch to refactor things, so reducing the size of
>> this one?
>
> Yes, I will do this split in v2 to reduce each patch size:
> - one patch to uuid new function
> - one precursor for efi part : refactor
> - one patch for GPT over MTD in part_efi.c
> & I will split large function
> - one patch for each command update
>
>> - nice README!
>>
>> >
>> > diff --git a/Kconfig b/Kconfig
>> > index 1263d0b..c2388e1 100644
>> > --- a/Kconfig
>> > +++ b/Kconfig
>> > @@ -335,6 +335,18 @@ config ARCH_FIXUP_FDT
>> >
>> >  endmenu# Boot images
>> >
>> > +config EFI_PARTITION_MTD
>> > +   bool "Support GPT over MTD"
>> > +   help
>> > + The GPT partition is normally defined only for block device with
>> > + built-in controller which manage flash translation layer
>> > + This option activate the GPT partition support over RAW device
>> > + using the MTD framework
>> > + - manage partition over MTD devices (as flash: NOR and NAND)
>> > + - extract MTD information
>> > + - update command gpt, mtdparts and part
>> > + NB: depends on EFI_PARTITION
>>
>> So do you want 'depends on EFI_PARTITION'?
>
> Yes I expect it, I try to add
> depends on EFI_PARTITION
> but is not working as it is not (yet ?)  one KCONFIG option.
> I add this comment to add this line when part lib will integrate KCONFIG

I see. Well if you have the energy you could use moveconfig.py to convert it.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [Resend RFC PATCH v1 1/3] add support of GPT partitioning over MTD

2016-11-24 Thread Patrick DELAUNAY
Hi Simon,

> 
> Hi Patrick,
> 
> On 22 November 2016 at 06:24, Patrick Delaunay
>  wrote:
> > From: Patrick Delaunay 
> >
> > Signed-off-by: Patrick Delaunay 
> > Signed-off-by: Patrick Delaunay 
> > ---
> >
> >  Kconfig|  12 ++
> >  cmd/gpt.c  |  98 --
> >  cmd/mtdparts.c | 103 ++-
> >  cmd/part.c |  48 -
> >  disk/part_efi.c| 526
> -
> >  doc/README.gpt.mtd | 189 +++
> >  include/part.h |  13 +-
> >  include/uuid.h |   1 +
> >  lib/uuid.c |  33 
> >  9 files changed, 944 insertions(+), 79 deletions(-)  create mode
> > 100644 doc/README.gpt.mtd
> 
> General comments:
> 
> - use 'U-Boot' consistently rather than variations
> - can you split your large function up a bit?
> - can you make a precursor patch to refactor things, so reducing the size of
> this one?

Yes, I will do this split in v2 to reduce each patch size:
- one patch to uuid new function
- one precursor for efi part : refactor
- one patch for GPT over MTD in part_efi.c
& I will split large function
- one patch for each command update

> - nice README!
> 
> >
> > diff --git a/Kconfig b/Kconfig
> > index 1263d0b..c2388e1 100644
> > --- a/Kconfig
> > +++ b/Kconfig
> > @@ -335,6 +335,18 @@ config ARCH_FIXUP_FDT
> >
> >  endmenu# Boot images
> >
> > +config EFI_PARTITION_MTD
> > +   bool "Support GPT over MTD"
> > +   help
> > + The GPT partition is normally defined only for block device with
> > + built-in controller which manage flash translation layer
> > + This option activate the GPT partition support over RAW device
> > + using the MTD framework
> > + - manage partition over MTD devices (as flash: NOR and NAND)
> > + - extract MTD information
> > + - update command gpt, mtdparts and part
> > + NB: depends on EFI_PARTITION
> 
> So do you want 'depends on EFI_PARTITION'?

Yes I expect it, I try to add 
depends on EFI_PARTITION
but is not working as it is not (yet ?)  one KCONFIG option.
I add this comment to add this line when part lib will integrate KCONFIG

> 
> Regards,
> Simon

Regards,
Patrick
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [Resend RFC PATCH v1 1/3] add support of GPT partitioning over MTD

2016-11-23 Thread Simon Glass
Hi Patrick,

On 22 November 2016 at 06:24, Patrick Delaunay
 wrote:
> From: Patrick Delaunay 
>
> Signed-off-by: Patrick Delaunay 
> Signed-off-by: Patrick Delaunay 
> ---
>
>  Kconfig|  12 ++
>  cmd/gpt.c  |  98 --
>  cmd/mtdparts.c | 103 ++-
>  cmd/part.c |  48 -
>  disk/part_efi.c| 526 
> -
>  doc/README.gpt.mtd | 189 +++
>  include/part.h |  13 +-
>  include/uuid.h |   1 +
>  lib/uuid.c |  33 
>  9 files changed, 944 insertions(+), 79 deletions(-)
>  create mode 100644 doc/README.gpt.mtd

General comments:

- use 'U-Boot' consistently rather than variations
- can you split your large function up a bit?
- can you make a precursor patch to refactor things, so reducing the
size of this one?
- nice README!

>
> diff --git a/Kconfig b/Kconfig
> index 1263d0b..c2388e1 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -335,6 +335,18 @@ config ARCH_FIXUP_FDT
>
>  endmenu# Boot images
>
> +config EFI_PARTITION_MTD
> +   bool "Support GPT over MTD"
> +   help
> + The GPT partition is normally defined only for block device with
> + built-in controller which manage flash translation layer
> + This option activate the GPT partition support over RAW device
> + using the MTD framework
> + - manage partition over MTD devices (as flash: NOR and NAND)
> + - extract MTD information
> + - update command gpt, mtdparts and part
> + NB: depends on EFI_PARTITION

So do you want 'depends on EFI_PARTITION'?

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [Resend RFC PATCH v1 1/3] add support of GPT partitioning over MTD

2016-11-22 Thread Patrick Delaunay
From: Patrick Delaunay 

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrick Delaunay 
---

 Kconfig|  12 ++
 cmd/gpt.c  |  98 --
 cmd/mtdparts.c | 103 ++-
 cmd/part.c |  48 -
 disk/part_efi.c| 526 -
 doc/README.gpt.mtd | 189 +++
 include/part.h |  13 +-
 include/uuid.h |   1 +
 lib/uuid.c |  33 
 9 files changed, 944 insertions(+), 79 deletions(-)
 create mode 100644 doc/README.gpt.mtd

diff --git a/Kconfig b/Kconfig
index 1263d0b..c2388e1 100644
--- a/Kconfig
+++ b/Kconfig
@@ -335,6 +335,18 @@ config ARCH_FIXUP_FDT
 
 endmenu# Boot images
 
+config EFI_PARTITION_MTD
+   bool "Support GPT over MTD"
+   help
+ The GPT partition is normally defined only for block device with
+ built-in controller which manage flash translation layer
+ This option activate the GPT partition support over RAW device
+ using the MTD framework
+ - manage partition over MTD devices (as flash: NOR and NAND)
+ - extract MTD information
+ - update command gpt, mtdparts and part
+ NB: depends on EFI_PARTITION
+
 source "common/Kconfig"
 
 source "cmd/Kconfig"
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 897596a..9e398e9 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -20,6 +20,10 @@
 #include 
 #include 
 
+#ifdef CONFIG_EFI_PARTITION_MTD
+#include 
+#endif
+
 #ifndef CONFIG_PARTITION_UUIDS
 #error CONFIG_PARTITION_UUIDS must be enabled for CONFIG_CMD_GPT to be enabled
 #endif
@@ -168,7 +172,8 @@ static bool found_key(const char *str, const char *key)
  * @return - zero on success, otherwise error
  *
  */
-static int set_gpt_info(struct blk_desc *dev_desc,
+static int set_gpt_info(unsigned int lba,
+   unsigned int blksz,
const char *str_part,
char **str_disk_guid,
disk_partition_t **partitions,
@@ -183,8 +188,7 @@ static int set_gpt_info(struct blk_desc *dev_desc,
uint64_t size_ll, start_ll;
lbaint_t offset = 0;
 
-   debug("%s:  lba num: 0x%x %d\n", __func__,
- (unsigned int)dev_desc->lba, (unsigned int)dev_desc->lba);
+   debug("%s:  lba num: 0x%x %d\n", __func__, lba, lba);
 
if (str_part == NULL)
return -1;
@@ -302,7 +306,7 @@ static int set_gpt_info(struct blk_desc *dev_desc,
parts[i].size = 0;
} else {
size_ll = ustrtoull(p, &p, 0);
-   parts[i].size = lldiv(size_ll, dev_desc->blksz);
+   parts[i].size = lldiv(size_ll, blksz);
}
 
free(val);
@@ -313,7 +317,7 @@ static int set_gpt_info(struct blk_desc *dev_desc,
if (extract_env(val, &p))
p = val;
start_ll = ustrtoull(p, &p, 0);
-   parts[i].start = lldiv(start_ll, dev_desc->blksz);
+   parts[i].start = lldiv(start_ll, blksz);
free(val);
}
 
@@ -337,6 +341,16 @@ err:
return errno;
 }
 
+static void print_gpt_info_err(int ret)
+{
+   if (ret == -1)
+   printf("No partition list provided\n");
+   if (ret == -2)
+   printf("Missing disk guid\n");
+   if ((ret == -3) || (ret == -4))
+   printf("Partition list incomplete\n");
+}
+
 static int gpt_default(struct blk_desc *blk_dev_desc, const char *str_part)
 {
int ret;
@@ -344,16 +358,13 @@ static int gpt_default(struct blk_desc *blk_dev_desc, 
const char *str_part)
u8 part_count = 0;
disk_partition_t *partitions = NULL;
 
+   if (!str_part)
+   return -1;
/* fill partitions */
-   ret = set_gpt_info(blk_dev_desc, str_part,
+   ret = set_gpt_info(blk_dev_desc->lba, blk_dev_desc->blksz, str_part,
&str_disk_guid, &partitions, &part_count);
if (ret) {
-   if (ret == -1)
-   printf("No partition list provided\n");
-   if (ret == -2)
-   printf("Missing disk guid\n");
-   if ((ret == -3) || (ret == -4))
-   printf("Partition list incomplete\n");
+   print_gpt_info_err(ret);
return -1;
}
 
@@ -376,7 +387,7 @@ static int gpt_verify(struct blk_desc *blk_dev_desc, const 
char *str_part)
int ret = 0;
 
/* fill partitions */
-   ret = set_gpt_info(blk_dev_desc, str_part,
+   ret = set_gpt_info(blk_dev_desc->lba, blk_dev_desc->blksz, str_part,
&str_disk_guid, &partitions, &part_count);
if (ret) {
if (ret == -1) {
@@ -402,6 +413,35 @@ static int gpt_verify(struct blk_desc *blk_dev_desc, const 
char *str_part)
return ret;
 }
 
+#ifdef CO