All of lore.kernel.org
 help / color / mirror / Atom feed
* u-boot saveenv corrupted other MTD parttions
@ 2020-02-18  6:52 ` JH
  0 siblings, 0 replies; 5+ messages in thread
From: JH @ 2020-02-18  6:52 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Meta Freescale, linux-mtd

Hi,

I have three MTD partitions, the mtd2 storage installed UBIFS volumes,
first is dtb volume, second is kernel volume, third is rootfs volume.
The saveenv was configured to save environment variables to NAND
ubootenv.

gpmi-nand:1m(boot),1m(ubootenv),-(storage)

There was no issue to run NAND boot, but if I called saveenv in
u-boot, then I run bootcmd again, it could not boot from NAND any
more:

Bad Linux ARM zImage magic!

The saveenv does not take any parameters, how did it work to write to
the NAND 1m(ubootenv)?

=> saveenv
Saving Environment to NAND... Erasing NAND...
Erasing at 0x5e0000 -- 100% complete.
Writing to NAND... OK

It looks like that saveenv overwritten to the storage, is 0x5e0000 RAM
or NAND address?

Where was that address defined?

How do I know it was the NAND 1m(ubootenv) address?

Thank you.

Kind regards,

- jh

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* u-boot saveenv corrupted other MTD parttions
@ 2020-02-18  6:52 ` JH
  0 siblings, 0 replies; 5+ messages in thread
From: JH @ 2020-02-18  6:52 UTC (permalink / raw)
  To: u-boot

Hi,

I have three MTD partitions, the mtd2 storage installed UBIFS volumes,
first is dtb volume, second is kernel volume, third is rootfs volume.
The saveenv was configured to save environment variables to NAND
ubootenv.

gpmi-nand:1m(boot),1m(ubootenv),-(storage)

There was no issue to run NAND boot, but if I called saveenv in
u-boot, then I run bootcmd again, it could not boot from NAND any
more:

Bad Linux ARM zImage magic!

The saveenv does not take any parameters, how did it work to write to
the NAND 1m(ubootenv)?

=> saveenv
Saving Environment to NAND... Erasing NAND...
Erasing at 0x5e0000 -- 100% complete.
Writing to NAND... OK

It looks like that saveenv overwritten to the storage, is 0x5e0000 RAM
or NAND address?

Where was that address defined?

How do I know it was the NAND 1m(ubootenv) address?

Thank you.

Kind regards,

- jh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* u-boot saveenv corrupted other MTD parttions
@ 2020-02-18  6:52 ` JH
  0 siblings, 0 replies; 5+ messages in thread
From: JH @ 2020-02-18  6:52 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Meta Freescale, linux-mtd

Hi,

I have three MTD partitions, the mtd2 storage installed UBIFS volumes,
first is dtb volume, second is kernel volume, third is rootfs volume.
The saveenv was configured to save environment variables to NAND
ubootenv.

gpmi-nand:1m(boot),1m(ubootenv),-(storage)

There was no issue to run NAND boot, but if I called saveenv in
u-boot, then I run bootcmd again, it could not boot from NAND any
more:

Bad Linux ARM zImage magic!

The saveenv does not take any parameters, how did it work to write to
the NAND 1m(ubootenv)?

=> saveenv
Saving Environment to NAND... Erasing NAND...
Erasing at 0x5e0000 -- 100% complete.
Writing to NAND... OK

It looks like that saveenv overwritten to the storage, is 0x5e0000 RAM
or NAND address?

Where was that address defined?

How do I know it was the NAND 1m(ubootenv) address?

Thank you.

Kind regards,

- jh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: u-boot saveenv corrupted other MTD parttions
  2020-02-18  6:52 ` JH
@ 2020-02-18  9:35   ` Andy Pont
  -1 siblings, 0 replies; 5+ messages in thread
From: Andy Pont @ 2020-02-18  9:35 UTC (permalink / raw)
  To: JH; +Cc: U-Boot Mailing List, linux-mtd

JH wrote...

>gpmi-nand:1m(boot),1m(ubootenv),-(storage)
<snip>

>The saveenv does not take any parameters, how did it work to write to
>the NAND 1m(ubootenv)?
>
>=> saveenv
>Saving Environment to NAND... Erasing NAND...
>Erasing at 0x5e0000 -- 100% complete.
>Writing to NAND... OK
>
>It looks like that saveenv overwritten to the storage, is 0x5e0000 RAM
>or NAND address?
>
>Where was that address defined?
What U-Boot uses for the storage of the environment is controlled 
through configuration options.  In recent versions this is all handled 
through the options defined in env/Kconfig.  In older versions these may 
have been defined in the include/configs/myboardname.h file.

CONFIG_ENV_IS_IN_NAND tells U-Boot that the environment is to be stored 
in the NAND flash device

CONFIG_ENV_OFFSET defines how far into the NAND device the environment 
will be stored (in your case this is probably 0x5e0000)

CONFIG_ENV_SIZE defines how big it is

Your definition of the mtd partitions doesn’t match.  Your “ubootenv" partition starts at offset 0x100000 and your “storage” partition starts at offset 0x200000.  When you run the saveenv command you are writing somewhere in the middle of the “storage” partition.

-Andy.


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* u-boot saveenv corrupted other MTD parttions
@ 2020-02-18  9:35   ` Andy Pont
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Pont @ 2020-02-18  9:35 UTC (permalink / raw)
  To: u-boot

JH wrote...

>gpmi-nand:1m(boot),1m(ubootenv),-(storage)
<snip>

>The saveenv does not take any parameters, how did it work to write to
>the NAND 1m(ubootenv)?
>
>=> saveenv
>Saving Environment to NAND... Erasing NAND...
>Erasing at 0x5e0000 -- 100% complete.
>Writing to NAND... OK
>
>It looks like that saveenv overwritten to the storage, is 0x5e0000 RAM
>or NAND address?
>
>Where was that address defined?
What U-Boot uses for the storage of the environment is controlled 
through configuration options.  In recent versions this is all handled 
through the options defined in env/Kconfig.  In older versions these may 
have been defined in the include/configs/myboardname.h file.

CONFIG_ENV_IS_IN_NAND tells U-Boot that the environment is to be stored 
in the NAND flash device

CONFIG_ENV_OFFSET defines how far into the NAND device the environment 
will be stored (in your case this is probably 0x5e0000)

CONFIG_ENV_SIZE defines how big it is

Your definition of the mtd partitions doesn?t match.  Your ?ubootenv" partition starts at offset 0x100000 and your ?storage? partition starts at offset 0x200000.  When you run the saveenv command you are writing somewhere in the middle of the ?storage? partition.

-Andy.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-19 21:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18  6:52 u-boot saveenv corrupted other MTD parttions JH
2020-02-18  6:52 ` JH
2020-02-18  6:52 ` JH
2020-02-18  9:35 ` Andy Pont
2020-02-18  9:35   ` Andy Pont

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.