diff mbox

[4/5] external/pflash: Catch incompatible combination of flags

Message ID 20161021085246.17116-4-cyril.bur@au1.ibm.com
State Superseded
Headers show

Commit Message

Cyril Bur Oct. 21, 2016, 8:52 a.m. UTC
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
---
 external/pflash/pflash.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Joel Stanley Oct. 21, 2016, 9:25 a.m. UTC | #1
On Fri, Oct 21, 2016 at 7:22 PM, Cyril Bur <cyril.bur@au1.ibm.com> wrote:
> Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
> ---
>  external/pflash/pflash.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
> index 002d0dc..608220f 100644
> --- a/external/pflash/pflash.c
> +++ b/external/pflash/pflash.c
> @@ -743,6 +743,16 @@ int main(int argc, char *argv[])
>                 exit(1);
>         }
>
> +       if (flashfilename && bmc_flash) {
> +               fprintf(stderr, "Filename or bmc flash but not both\n");
> +               exit(1);
> +       }
> +
> +       if (flashfilename && mtd) {
> +               fprintf(stderr, "Filename or mtd access but not both\n");

How do I specify a given mtd path?
Cyril Bur Oct. 21, 2016, 9:29 a.m. UTC | #2
On Fri, 2016-10-21 at 19:55 +1030, Joel Stanley wrote:
> On Fri, Oct 21, 2016 at 7:22 PM, Cyril Bur <cyril.bur@au1.ibm.com>
> wrote:
> > Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
> > ---
> >  external/pflash/pflash.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
> > index 002d0dc..608220f 100644
> > --- a/external/pflash/pflash.c
> > +++ b/external/pflash/pflash.c
> > @@ -743,6 +743,16 @@ int main(int argc, char *argv[])
> >                 exit(1);
> >         }
> > 
> > +       if (flashfilename && bmc_flash) {
> > +               fprintf(stderr, "Filename or bmc flash but not
> > both\n");
> > +               exit(1);
> > +       }
> > +
> > +       if (flashfilename && mtd) {
> > +               fprintf(stderr, "Filename or mtd access but not
> > both\n");
> 
> How do I specify a given mtd path?

Either do nothing and pflash will find it for you. 'Should just work'
for both AMI and OpenBMC systems and of course the host. Or use '-F, --
flash-filename' and specify /dev/mtdx which should be a full PNOR,
/dev/mtd7 on OpenBMC systems

Cyril


>
Joel Stanley Oct. 21, 2016, 9:35 a.m. UTC | #3
On Fri, Oct 21, 2016 at 7:59 PM, Cyril Bur <cyril.bur@au1.ibm.com> wrote:
> On Fri, 2016-10-21 at 19:55 +1030, Joel Stanley wrote:
>> On Fri, Oct 21, 2016 at 7:22 PM, Cyril Bur <cyril.bur@au1.ibm.com>
>> wrote:
>> > Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
>> > ---
>> >  external/pflash/pflash.c | 10 ++++++++++
>> >  1 file changed, 10 insertions(+)
>> >
>> > diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
>> > index 002d0dc..608220f 100644
>> > --- a/external/pflash/pflash.c
>> > +++ b/external/pflash/pflash.c
>> > @@ -743,6 +743,16 @@ int main(int argc, char *argv[])
>> >                 exit(1);
>> >         }
>> >
>> > +       if (flashfilename && bmc_flash) {
>> > +               fprintf(stderr, "Filename or bmc flash but not
>> > both\n");
>> > +               exit(1);
>> > +       }
>> > +
>> > +       if (flashfilename && mtd) {
>> > +               fprintf(stderr, "Filename or mtd access but not
>> > both\n");
>>
>> How do I specify a given mtd path?
>
> Either do nothing and pflash will find it for you. 'Should just work'
> for both AMI and OpenBMC systems and of course the host. Or use '-F, --
> flash-filename' and specify /dev/mtdx which should be a full PNOR,
> /dev/mtd7 on OpenBMC systems

If I use -F does it know that it's a mtd path and it needs to use the
erase ioctl?

Cheers,

Joel
Cyril Bur Oct. 21, 2016, 9:36 a.m. UTC | #4
On Fri, 2016-10-21 at 20:05 +1030, Joel Stanley wrote:
> On Fri, Oct 21, 2016 at 7:59 PM, Cyril Bur <cyril.bur@au1.ibm.com>
> wrote:
> > On Fri, 2016-10-21 at 19:55 +1030, Joel Stanley wrote:
> > > On Fri, Oct 21, 2016 at 7:22 PM, Cyril Bur <cyril.bur@au1.ibm.com
> > > >
> > > wrote:
> > > > Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
> > > > ---
> > > >  external/pflash/pflash.c | 10 ++++++++++
> > > >  1 file changed, 10 insertions(+)
> > > > 
> > > > diff --git a/external/pflash/pflash.c
> > > > b/external/pflash/pflash.c
> > > > index 002d0dc..608220f 100644
> > > > --- a/external/pflash/pflash.c
> > > > +++ b/external/pflash/pflash.c
> > > > @@ -743,6 +743,16 @@ int main(int argc, char *argv[])
> > > >                 exit(1);
> > > >         }
> > > > 
> > > > +       if (flashfilename && bmc_flash) {
> > > > +               fprintf(stderr, "Filename or bmc flash but not
> > > > both\n");
> > > > +               exit(1);
> > > > +       }
> > > > +
> > > > +       if (flashfilename && mtd) {
> > > > +               fprintf(stderr, "Filename or mtd access but not
> > > > both\n");
> > > 
> > > How do I specify a given mtd path?
> > 
> > Either do nothing and pflash will find it for you. 'Should just
> > work'
> > for both AMI and OpenBMC systems and of course the host. Or use '-
> > F, --
> > flash-filename' and specify /dev/mtdx which should be a full PNOR,
> > /dev/mtd7 on OpenBMC systems
> 
> If I use -F does it know that it's a mtd path and it needs to use the
> erase ioctl?
> 

It does.

Cyril

> Cheers,
> 
> Joel
>
diff mbox

Patch

diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
index 002d0dc..608220f 100644
--- a/external/pflash/pflash.c
+++ b/external/pflash/pflash.c
@@ -743,6 +743,16 @@  int main(int argc, char *argv[])
 		exit(1);
 	}
 
+	if (flashfilename && bmc_flash) {
+		fprintf(stderr, "Filename or bmc flash but not both\n");
+		exit(1);
+	}
+
+	if (flashfilename && mtd) {
+		fprintf(stderr, "Filename or mtd access but not both\n");
+		exit(1);
+	}
+
 	/* If file specified but not size, get size from file
 	 */
 	if (write_file && !write_size) {