Skip to contentSkip to conversation

bareboxenv usage

DISCUSSION Boaz Ben-David 2 participants 8 messages Sep 12, 2011 – Sep 13, 2011

lore
Share & tools
lore
#0 lore raw

Hi

I am using bareboxenv on a MLC NAND chip for reading and writing the barebox environment on my imx35 board.
Up until now I have been using it with the mtdblock devices and suddenly I noticed I get an error while reading (-l) the env(I/O error). Using bareboxenv with the same partition but in the /dev/mtd form the read works.
For some reason I assumed that I need to use the bareboxenv with mtdblock devices.
Question is, what is the CORRECT way to use it on a nand partition?

Thanks,

Boaz.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw
Quoted 14 lines · Boaz Ben-David

Hi

I am using bareboxenv on a MLC NAND chip for reading and writing the barebox environment on my imx35 board.
Up until now I have been using it with the mtdblock devices and suddenly I noticed I get an error while reading (-l) the env(I/O error). Using bareboxenv with the same partition but in the /dev/mtd form the read works.
For some reason I assumed that I need to use the bareboxenv with mtdblock devices.
Question is, what is the CORRECT way to use it on a nand partition?

Thanks,

Quoted 8 lines

Boaz.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

I see no one answered this, maybe I need to shorten my question (:

All I am asking is: do I need to use /dev/mtdblock or /dev/mtd when loading and saving envs

with bareboxenv?

Thanks,

Boaz.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw
Quoted 2 lines · Boaz Ben-David

All I am asking is: do I need to use /dev/mtdblock or /dev/mtd when loading and saving envs

neither nor - loadenv & saveenv are not bad block aware. In barebox you use the .bb devices, which are bad block are, under linux use nandwrite
+ nanddump to write or read data from the nand into a file. Then use loadenv/saveenv.

cheers, Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#3 lore raw
Quoted 10 lines · Marc Kleine-Budde
Quoted 2 lines · Boaz Ben-David

All I am asking is: do I need to use /dev/mtdblock or /dev/mtd when loading and saving envs

neither nor - loadenv& saveenv are not bad block aware. In barebox you use the .bb devices, which are bad block are, under linux use nandwrite
+ nanddump to write or read data from the nand into a file. Then use loadenv/saveenv.

cheers, Marc

Hi,

Thanks for the reply.

First question, please tell me if these sequences are correct:

In Linux:

- Read:

1.nanddump from the mtd device to a file.

2.bareboxenv -l the file dumped.

-Write:

1.bareboxenv -s from source directory to a file

2.nandwrite that file to the mtd device.

Second question is: what would be the same sequences under barebox?

Thanks,

Boaz.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#4 lore raw
Quoted 39 lines · Boaz Ben-David
Quoted 10 lines · Marc Kleine-Budde
Quoted 2 lines · Boaz Ben-David

All I am asking is: do I need to use /dev/mtdblock or /dev/mtd when loading and saving envs

neither nor - loadenv& saveenv are not bad block aware. In barebox you
use the .bb devices, which are bad block are, under linux use nandwrite
+ nanddump to write or read data from the nand into a file. Then use loadenv/saveenv.

cheers, Marc

Hi,

Thanks for the reply.

First question, please tell me if these sequences are correct:

In Linux:

- Read:

1.nanddump from the mtd device to a file.

2.bareboxenv -l the file dumped.

-Write:

1.bareboxenv -s from source directory to a file

2.nandwrite that file to the mtd device.

Second question is: what would be the same sequences under barebox?

Thanks,

Quoted 7 lines

Boaz.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

There's something I don't get.

If loadenv/saveenv are not bad-block aware, why are they used in barebox by default?

When the system boots envfs_load is used to load the environment from /dev/env0 or whatever.

If /dev/env0 is not bad-block aware device (like the bb devices) this means this could fail because of

a bad block in the env partition. Am I right?

Thanks,

Boaz.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw
Quoted 4 lines · Boaz Ben-David

There's something I don't get.

If loadenv/saveenv are not bad-block aware, why are they used in barebox by default?

They operate on bad block aware devices (in barebox) by default.

Quoted 6 lines

When the system boots envfs_load is used to load the environment from /dev/env0 or whatever.

If /dev/env0 is not bad-block aware device (like the bb devices) this means this could fail because of
a bad block in the env partition. Am I right?

Nope - the raw NAND is usually attached as "/dev/env0_raw" and the bad block aware device as "/dev/env0".

cheers, Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#6 lore raw
In reply to Boaz Ben-David
Quoted 12 lines · Boaz Ben-David
Quoted 10 lines · Marc Kleine-Budde
Quoted 2 lines · Boaz Ben-David

All I am asking is: do I need to use /dev/mtdblock or /dev/mtd when loading and saving envs

neither nor - loadenv& saveenv are not bad block aware. In barebox you use the .bb devices, which are bad block are, under linux use nandwrite
+ nanddump to write or read data from the nand into a file. Then use loadenv/saveenv.

cheers, Marc

Quoted 6 lines

Hi,

Thanks for the reply.

First question, please tell me if these sequences are correct:

basically yes....but

Quoted 5 lines

In Linux:

- Read:

1.nanddump from the mtd device to a file.

read the nanddump help text, you need to skip bad blocks

Quoted 7 lines

2.bareboxenv -l the file dumped.

-Write:

1.bareboxenv -s from source directory to a file

2.nandwrite that file to the mtd device.

use padding

cheers, Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#7 lore raw
Quoted 29 lines · Marc Kleine-Budde
Quoted 9 lines · Boaz Ben-David
Quoted 8 lines · Marc Kleine-Budde
Quoted 2 lines · Boaz Ben-David

All I am asking is: do I need to use /dev/mtdblock or /dev/mtd when loading and saving envs

neither nor - loadenv& saveenv are not bad block aware. In barebox you
use the .bb devices, which are bad block are, under linux use nandwrite
+ nanddump to write or read data from the nand into a file. Then use loadenv/saveenv.

Quoted 8 lines
Quoted 2 lines

cheers, Marc

Hi,

Thanks for the reply.

First question, please tell me if these sequences are correct:

basically yes....but

Quoted 5 lines

In Linux:

- Read:

1.nanddump from the mtd device to a file.

read the nanddump help text, you need to skip bad blocks

Quoted 2 lines

2.bareboxenv -l the file dumped.

Quoted 9 lines
Quoted 5 lines

-Write:

1.bareboxenv -s from source directory to a file

2.nandwrite that file to the mtd device.

use padding

cheers, Marc

Hi,

This was psuedo command line (:

Of course I will use padding and skip bb...

Thanks,

Boaz.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox