All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] first u-boot program
@ 2010-06-01 15:51 Maxime Boure
  2010-06-01 18:56 ` Wolfgang Denk
  0 siblings, 1 reply; 10+ messages in thread
From: Maxime Boure @ 2010-06-01 15:51 UTC (permalink / raw)
  To: u-boot

Hello,

I'm not sure this is the right mailing list so please tell me !

I am trying to develop a program that would check into some flash memory
information (set early on by a userspace application) to know on which
kernel and which partition it has to boot on.

I am trying a standalone application not sure that it is the more
appropriate because of compilation problems.

I would like to have your advise before going any further ! Thanks a lot

Maxime

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

* [U-Boot] first u-boot program
  2010-06-01 15:51 [U-Boot] first u-boot program Maxime Boure
@ 2010-06-01 18:56 ` Wolfgang Denk
  2010-06-02  8:01   ` Maxime Boure
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Denk @ 2010-06-01 18:56 UTC (permalink / raw)
  To: u-boot

Dear Maxime Boure,

In message <AANLkTim63RLGst8TM2MNkhFThz13RP7wiIqdy5MAuFc1@mail.gmail.com> you wrote:
>
> I'm not sure this is the right mailing list so please tell me !

Seems it is...

> I am trying to develop a program that would check into some flash memory
> information (set early on by a userspace application) to know on which
> kernel and which partition it has to boot on.
> 
> I am trying a standalone application not sure that it is the more
> appropriate because of compilation problems.

Oops? Why make it so complicated?

Why not simply set and read some environment variable(s)? At least
that's what every other project I've seen so far is doing.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Just about every computer on the market today runs Unix,  except  the
Mac (and nobody cares about it).                   - Bill Joy 6/21/85

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

* [U-Boot] first u-boot program
  2010-06-01 18:56 ` Wolfgang Denk
@ 2010-06-02  8:01   ` Maxime Boure
  2010-06-02  8:07     ` Wolfgang Denk
  0 siblings, 1 reply; 10+ messages in thread
From: Maxime Boure @ 2010-06-02  8:01 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang Denk,

Thanks for the answer. Do you mean using fw_printenv fw_setenv ? That is
what I am thinking about.
But I can't find a fw_env.config that wouldn't warn me about a "bad CRC".
The fw_printenv seems to work half way :

root at myboard:~# fw_printenv
Warning: Bad CRC, using default environment
bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath}
ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
bootdelay=5
baudrate=115200

It misses a lot of variables.

And the setenv :
root at myboard:~# fw_setenv test 1234
Warning: Bad CRC, using default environment
root at myboard:~# fw_printenv
bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath}
ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
bootdelay=5
baudrate=115200
test=1234

My config is this one :
# MTD device name       Device offset   Env. size       Flash sector size
/dev/mtd2               0x0000          0x80000         0x80000

My partitions are those :
root at myboard:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00040000 "X-Loader"
mtd1: 00180000 00040000 "U-Boot"
mtd2: 00080000 00040000 "Environment"
mtd3: 00300000 00040000 "Kernel"
mtd4: 1fa80000 00040000 "File System"

Is my configuration file good ? When I reboot my board it doesn't save my
changes. Where can I get the sources of a fw_saveenv program ?

Thanks a lot for your help.

Regards,

Maxime

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

* [U-Boot] first u-boot program
  2010-06-02  8:01   ` Maxime Boure
@ 2010-06-02  8:07     ` Wolfgang Denk
       [not found]       ` <AANLkTin4majod0Rc-nCxbgHrCdY4VY2OlptQyAQS4cjE@mail.gmail.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Denk @ 2010-06-02  8:07 UTC (permalink / raw)
  To: u-boot

Dear Maxime Boure,

Please stop sending HTML. This is strongly discouraged on this list.

In message <AANLkTik0nK69NfhQow6b5cbvnd7CN_9f2kJsDvbfX_Lx@mail.gmail.com> you wrote:
> 
> Thanks for the answer. Do you mean using fw_printenv fw_setenv ? That is
> what I am thinking about.

Yes, that's what I mean.

> But I can't find a fw_env.config that wouldn't warn me about a "bad CRC".

That's a problem to be solved, then.

> The fw_printenv seems to work half way :
> 
> root at myboard:~# fw_printenv
> Warning: Bad CRC, using default environment
> bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath}
> ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
> bootdelay=5
> baudrate=115200
> 
> It misses a lot of variables.

So the configuration is incorrect.

> My config is this one :
> # MTD device name       Device offset   Env. size       Flash sector size
> /dev/mtd2               0x0000          0x80000         0x80000
> 
> My partitions are those :
> root at myboard:~# cat /proc/mtd
> dev:    size   erasesize  name
> mtd0: 00080000 00040000 "X-Loader"
> mtd1: 00180000 00040000 "U-Boot"
> mtd2: 00080000 00040000 "Environment"
> mtd3: 00300000 00040000 "Kernel"
> mtd4: 1fa80000 00040000 "File System"

And what does the environment configuration in U-Boot look like? Which
board is this?

> Is my configuration file good ? When I reboot my board it doesn't save my
> changes. Where can I get the sources of a fw_saveenv program ?

Your configuration is obviously NOT good - otherwise there weren't any
such errors.

The source is part of the U-Boot code, see the tools/env/ directory.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
panic: can't find /

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

* [U-Boot] first u-boot program
       [not found]       ` <AANLkTin4majod0Rc-nCxbgHrCdY4VY2OlptQyAQS4cjE@mail.gmail.com>
@ 2010-06-02  8:36         ` Wolfgang Denk
  2010-06-02  9:24           ` Maxime Boure
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Denk @ 2010-06-02  8:36 UTC (permalink / raw)
  To: u-boot

Dear Maxime Boure,

please keep the mailing list on Cc:

In message <AANLkTin4majod0Rc-nCxbgHrCdY4VY2OlptQyAQS4cjE@mail.gmail.com> you wrote:
> Sorry to have sent my mail in HTML I forgot to take it off.

You might also want to quote the previous message so everybody knows
what you are referring to. It may be obvious foir you, but I'm
replying to _many_ messages per day, and a bit of context would be
welcome. Please see http://www.netmeister.org/news/learn2quote.html

> This is my uboot env :

This is not what I asked for. What I menat was: how are the
envrionemnt sectors configured in your flash, i. e. what are the
CONFIG.*ENV settings?

> I am currently using a IGEP board based on an omap3530 with a onenand
> of 512mo (don't realy know what kind of information you need :))

It tells me that it's an out of tree port, so we cannot help you.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Certainly there are things in life that money  can't  buy,  but  it's
very funny - Did you ever try buying them without money? - Ogden Nash

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

* [U-Boot] first u-boot program
  2010-06-02  8:36         ` Wolfgang Denk
@ 2010-06-02  9:24           ` Maxime Boure
  2010-06-02 10:16             ` Wolfgang Denk
  0 siblings, 1 reply; 10+ messages in thread
From: Maxime Boure @ 2010-06-02  9:24 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang Denk

> Dear Maxime Boure,
>
> please keep the mailing list on Cc:
>
> In message <AANLkTin4majod0Rc-nCxbgHrCdY4VY2OlptQyAQS4cjE@mail.gmail.com> you wrote:
>> Sorry to have sent my mail in HTML I forgot to take it off.
>
> You might also want to quote the previous message so everybody knows
> what you are referring to. It may be obvious foir you, but I'm
> replying to _many_ messages per day, and a bit of context would be
> welcome. Please see http://www.netmeister.org/news/learn2quote.html

Sorry again not my daily routine...

>
>> This is my uboot env :
>
> This is not what I asked for. What I menat was: how are the
> envrionemnt sectors configured in your flash, i. e. what are the
> CONFIG.*ENV settings?

Is this it ?

#define PISMO1_ONEN_SIZE		GPMC_SIZE_128M /* Configure the PISMO */

#define CONFIG_SYS_FLASH_BASE		boot_flash_base

#define CONFIG_SYS_ONENAND_BASE		ONENAND_MAP

#define CONFIG_ENV_IS_IN_ONENAND	1

#define CONFIG_ENV_SIZE			SZ_512K	/* Total Size Environment */

#define CONFIG_SYS_ENV_SECT_SIZE	boot_flash_sec
#define CONFIG_ENV_OFFSET		boot_flash_off
#define ONENAND_ENV_OFFSET		0x200000 /* environment starts here */

#define CONFIG_ENV_ADDR			ONENAND_ENV_OFFSET

#define CONFIG_MTD_ONENAND_2X_PROGRAM

/* Monitor at start of flash */
#define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */


>
>> I am currently using a IGEP board based on an omap3530 with a onenand
>> of 512mo (don't realy know what kind of information you need :))
>
> It tells me that it's an out of tree port, so we cannot help you.

Well thank you for your time !

>
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> Certainly there are things in life that money ?can't ?buy, ?but ?it's
> very funny - Did you ever try buying them without money? - Ogden Nash
>

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

* [U-Boot] first u-boot program
  2010-06-02  9:24           ` Maxime Boure
@ 2010-06-02 10:16             ` Wolfgang Denk
  2010-06-02 11:13               ` Maxime Boure
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Denk @ 2010-06-02 10:16 UTC (permalink / raw)
  To: u-boot

Dear Maxime Boure,

In message <AANLkTikp1Id70dTzpOwc1KrcpkQxjYAPzTYvB_lbCFJM@mail.gmail.com> you wrote:
>
> > This is not what I asked for. What I menat was: how are the
> > envrionemnt sectors configured in your flash, i. e. what are the
> > CONFIG.*ENV settings?
> 
> Is this it ?

Nearly...

> #define CONFIG_ENV_IS_IN_ONENAND	1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Your environment is in OneNAND?

> #define CONFIG_SYS_ENV_SECT_SIZE	boot_flash_sec
> #define CONFIG_ENV_OFFSET		boot_flash_off
> #define ONENAND_ENV_OFFSET		0x200000 /* environment starts here */
> #define CONFIG_ENV_ADDR			ONENAND_ENV_OFFSET

Well, and what are the seffings for boot_flash_sec, boot_flash_off ?

Eventually you want to check the tools/env/ code if it really supports
OneNAND as well, and try to debug it. I don't think this has ever been
tested with OneNAND yet.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Many aligators will be slain, but the swamp will remain.

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

* [U-Boot] first u-boot program
  2010-06-02 10:16             ` Wolfgang Denk
@ 2010-06-02 11:13               ` Maxime Boure
  2010-06-02 12:07                 ` Wolfgang Denk
  0 siblings, 1 reply; 10+ messages in thread
From: Maxime Boure @ 2010-06-02 11:13 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang Denk

> Dear Maxime Boure,
>
> In message <AANLkTikp1Id70dTzpOwc1KrcpkQxjYAPzTYvB_lbCFJM@mail.gmail.com> you wrote:
>>
>> > This is not what I asked for. What I menat was: how are the
>> > envrionemnt sectors configured in your flash, i. e. what are the
>> > CONFIG.*ENV settings?
>>
>> Is this it ?
>
> Nearly...
>
>> #define CONFIG_ENV_IS_IN_ONENAND ? ? ?1
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Your environment is in OneNAND?
>
>> #define CONFIG_SYS_ENV_SECT_SIZE ? ? ?boot_flash_sec
>> #define CONFIG_ENV_OFFSET ? ? ? ? ? ? boot_flash_off
>> #define ONENAND_ENV_OFFSET ? ? ? ? ? ?0x200000 /* environment starts here */
>> #define CONFIG_ENV_ADDR ? ? ? ? ? ? ? ? ? ? ? ONENAND_ENV_OFFSET
>
> Well, and what are the seffings for boot_flash_sec, boot_flash_off ?
My settings :
boot_flash_base 0x20000000 boot_flash_off 0x200000 boot_flash_sec
0x20000 boot_flash_env_addr 0x200000


>
> Eventually you want to check the tools/env/ code if it really supports
> OneNAND as well, and try to debug it. I don't think this has ever been
> tested with OneNAND yet.
>

I don't want to bother you to much I will look into that. But can you
enlighten me on the fields of the fw_env.config.

Device offset --> if I set /dev/mtd2 and this mtd is the one with the
environment it has to be set to 0x0000
Env. size --> the size is 0x80000
Flash sector size --> is the erase block size so in my case 0x40000
Number of sectors ---> well ... I don't really know :)

I am wrong ?

> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> Many aligators will be slain, but the swamp will remain.
>

Best regards,

Maxime

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

* [U-Boot] first u-boot program
  2010-06-02 11:13               ` Maxime Boure
@ 2010-06-02 12:07                 ` Wolfgang Denk
  2010-06-02 12:31                   ` Maxime Boure
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Denk @ 2010-06-02 12:07 UTC (permalink / raw)
  To: u-boot

Dear Maxime Boure,

In message <AANLkTin86aE1ZzqYZI0UvyarrUex_0-gD5TAvPNtrsB3@mail.gmail.com> you wrote:
>
> >> #define CONFIG_SYS_ENV_SECT_SIZE      boot_flash_sec
> >> #define CONFIG_ENV_OFFSET             boot_flash_off
> >> #define ONENAND_ENV_OFFSET            0x200000 /* environment starts here */
> >> #define CONFIG_ENV_ADDR                       ONENAND_ENV_OFFSET
> >
> > Well, and what are the seffings for boot_flash_sec, boot_flash_off ?
> My settings :
> boot_flash_base 0x20000000 boot_flash_off 0x200000 boot_flash_sec
> 0x20000 boot_flash_env_addr 0x200000

CONFIG_ENV_SIZE is still missing...

> Device offset --> if I set /dev/mtd2 and this mtd is the one with the
> environment it has to be set to 0x0000

Right, this matches your MTD settings (partition mtd2 starts at the
same offset 0x200000.

However, in your board configuration above I see that CONFIG_ENV_ADDR
(which is supposed to be an *address* is defined with an *offset*
value. This looks wrong to me. I would be surprised if this works, but
then - I haven't worked with OneNAND yet.

> Env. size --> the size is 0x80000

I cannot comment on this - I haven't seen the CONFIG_ENV_SIZE settings
from your board config. It could be as well that you have two
redundant copies (of smaller size, obviously) in your partition.

> Flash sector size --> is the erase block size so in my case 0x40000

Above you write that CONFIG_SYS_ENV_SECT_SIZE = boot_flash_sec =
0x20000. This is inconsistent, then.

> Number of sectors ---> well ... I don't really know :)

This depends on the sizes, and on how many redundant copies you
maintain. We don't know your board config file...

> I am wrong ?

Yes - otherwise there would be no problems ;-)

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Landing: a controlled mid-air collision with a planet.

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

* [U-Boot] first u-boot program
  2010-06-02 12:07                 ` Wolfgang Denk
@ 2010-06-02 12:31                   ` Maxime Boure
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Boure @ 2010-06-02 12:31 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang Denk

On Wed, Jun 2, 2010 at 2:07 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Maxime Boure,
>
> In message <AANLkTin86aE1ZzqYZI0UvyarrUex_0-gD5TAvPNtrsB3@mail.gmail.com> you wrote:
>>
>> >> #define CONFIG_SYS_ENV_SECT_SIZE ? ? ?boot_flash_sec
>> >> #define CONFIG_ENV_OFFSET ? ? ? ? ? ? boot_flash_off
>> >> #define ONENAND_ENV_OFFSET ? ? ? ? ? ?0x200000 /* environment starts here */
>> >> #define CONFIG_ENV_ADDR ? ? ? ? ? ? ? ? ? ? ? ONENAND_ENV_OFFSET
>> >
>> > Well, and what are the seffings for boot_flash_sec, boot_flash_off ?
>> My settings :
>> boot_flash_base 0x20000000 boot_flash_off 0x200000 boot_flash_sec
>> 0x20000 boot_flash_env_addr 0x200000
>
> CONFIG_ENV_SIZE is still missing...

#define CONFIG_ENV_SIZE			SZ_512K	/* Total Size Environment *
and
#define SZ_512K           0x00080000

>
>> Device offset --> if I set /dev/mtd2 and this mtd is the one with the
>> environment it has to be set to 0x0000
>
> Right, this matches your MTD settings (partition mtd2 starts at the
> same offset 0x200000.
>
> However, in your board configuration above I see that CONFIG_ENV_ADDR
> (which is supposed to be an *address* is defined with an *offset*
> value. This looks wrong to me. I would be surprised if this works, but
> then - I haven't worked with OneNAND yet.
>
>> Env. size --> the size is 0x80000
>
> I cannot comment on this - I haven't seen the CONFIG_ENV_SIZE settings
> from your board config. It could be as well that you have two
> redundant copies (of smaller size, obviously) in your partition.
>
>> Flash sector size --> is the erase block size so in my case 0x40000
>
> Above you write that CONFIG_SYS_ENV_SECT_SIZE = boot_flash_sec =
> 0x20000. This is inconsistent, then.
>

I tried with this configuration in fw_env.config :
/dev/mtd2 		0x0000 		0x80000 	0x20000

I had this error with the command fw_printenv :
Too few good blocks within range

>> Number of sectors ---> well ... I don't really know :)
>
> This depends on the sizes, and on how many redundant copies you
> maintain. We don't know your board config file...
>
>> I am wrong ?
>
> Yes - otherwise there would be no problems ;-)

Indeed...

>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> Landing: a controlled mid-air collision with a planet.
>

Best regards,

Maxime

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

end of thread, other threads:[~2010-06-02 12:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-01 15:51 [U-Boot] first u-boot program Maxime Boure
2010-06-01 18:56 ` Wolfgang Denk
2010-06-02  8:01   ` Maxime Boure
2010-06-02  8:07     ` Wolfgang Denk
     [not found]       ` <AANLkTin4majod0Rc-nCxbgHrCdY4VY2OlptQyAQS4cjE@mail.gmail.com>
2010-06-02  8:36         ` Wolfgang Denk
2010-06-02  9:24           ` Maxime Boure
2010-06-02 10:16             ` Wolfgang Denk
2010-06-02 11:13               ` Maxime Boure
2010-06-02 12:07                 ` Wolfgang Denk
2010-06-02 12:31                   ` Maxime Boure

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.