All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Stile <john@stilen.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] mtdparts not agreeing wiht fw_printenv
Date: Thu, 07 Mar 2013 18:00:29 -0800	[thread overview]
Message-ID: <1362708029.30287.143.camel@genx> (raw)
In-Reply-To: <20130307065257.7B3D8200520@gemini.denx.de>

Dear Wolfgang Denk ,
On Thu, 2013-03-07 at 07:52 +0100, Wolfgang Denk wrote:
> Dear John Stile,
> 
> In message <1362532855.20183.135.camel@genx> you wrote:
> > I am quite confused about partitions in my NAND flash.
> > 
> > Linux can mount my rootfs, so partitions make sense to the kernel, but
> > from the shell fw_printenv can't read the uboot environment, not matter
> > what I use in /etc/fw_env.config.
> 
> That means that all settings were incorrect.

All settings where not incorrect.

> 
> > dev:    size   erasesize  name
> > mtd0: 00020000 00020000 "bootstrap1"
> > mtd1: 00040000 00020000 "uboot1"
> > mtd2: 001a0000 00020000 "env1"
> ^^^^^^ mtd2
> > mtd3: 00200000 00020000 "linux1"
> > mtd4: 07c00000 00020000 "rootfs1"
> > mtd5: 00020000 00020000 "bootstrap2"
> > mtd6: 00040000 00020000 "uboot2"
> > mtd7: 001a0000 00020000 "env2"
> ^^^^^^ mtd7
> > mtd8: 00200000 00020000 "linux2"
> > mtd9: 07c00000 00020000 "rootfs2"
> > mtd10: 00004200 00000420 "bootstrap3"
> > mtd11: 00004200 00000420 "env3"
> ^^^^^^ mtd11
> > mtd12: 00039c00 00000420 "uboot3"
> > mtd13: 00252000 00000420 "linux3"
> > mtd14: 005ac000 00000420 "rootfs3"
> > 
> What's that? This makes no sense to me - either you have a single copy
> of the environment, or two (in case of redudant env).  Three copies is
> not a supported configuration.
> 
> > I purposefully created more /dev/mtd devices than mtdparts would
> > require, in order to find which partitions actually contain the uboot
> > env.
> 
> mtdparts does not "require" anything.  You configure your systems as
> needed, and then set mtdparts to match that setting.  SO the setting
> comes first (starting in your head or - probably better - on a sheet
> of paper), and then you set mtdparts as needed.
> 

Right.  Even without the /dev/mtd character device files, the system
boots.
This post comes way after a lot of work on paper.

> > /dev/mtd4 and /dev/mtd5 create binary equivalent dumps of env1
> > /dev/mtd14 and /dev/mtd15 create binary equivalent dumps of env2.
> 
> The names and use of your partitions is in serious mismatch.  Fix this
> first!

The problem turned out to be due to my /dev/mtd character device files
had sequential minor numbers.

> > /etc/fw_env.config does not like either of those, saying the crc does
> > not checkout.
> > 
> > /etc/fw_env.config:
> > /dev/mtd2              0x0          0x20000          0x20000
> > /dev/mtd2              0x20000      0x20000          0x20000
> 
> Well, if you find the environment in /dev/mtd4 and /dev/mtd5, then you
> should use these in the fw_env.config
> 
> Best regards,
> 
> Wolfgang Denk
> 
Like I said, I think, even those did not work.
When I created my /dev/mtd character device files to use even minor
numbers, I was able to see my env in /dev/mtd2 /dev/mtd7  using od:
od -t xz /dev/mtd2
od -t xz /dev/mtd7
And fw_printenv also worked.

One site said read-write device will have even minor numbers.

Since I am using a 2.6.30 kernel, without tmpdevfs, I rely on
buildroot's target/generic/device_table_dev.txt to generate my devices,
and it was there I had not set the proper values:
# MTD stuff
# <name>	<type>	<mode>	<uid>	<gid>	<major>	<minor>	<start>	<inc>	<count>
/dev/mtd	    c	640	0	0	90	0	0	2	20

Thank you for your help.

      reply	other threads:[~2013-03-08  2:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06  1:20 [U-Boot] mtdparts not agreeing wiht fw_printenv John Stile
2013-03-07  6:52 ` Wolfgang Denk
2013-03-08  2:00   ` John Stile [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362708029.30287.143.camel@genx \
    --to=john@stilen.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.