[U-Boot] [U-BOOT] error: end address not on sector boundary when I use saveenv cmd

Hi All
When I set all the environment variable and try to save on flash , I am getting Error: end address not on sector boundary. But still my kernel boots with the env setting I made, but on restart these enviroment settings are lost. Can someone let me know where it could have gone wrong?
Regards Naveen

When I set all the environment variable and try to save on flash , I am getting Error: end address not on sector boundary.
Check the settings in your config file. The environment must live in an integer number of sectors, and sector size depends on the flash chip (usually 64k or 128k).
But still my kernel boots with the env setting I made,
saveenv failed, but in-memory env has been modified.
but on restart these enviroment settings are lost.
That's because saveenv failed, next time you read environment from flash (or, most likely, compile defaults).
hope this helps /alessandro

Hi Rubini
I already looked at my config file, but couldn't root cause the problem Here are some of the definitions from my configs, incase anything wrong Can you please help me.
NOR Flash: CONFIG_SYS_FLASH_BASE 0x10000000 CONFIG_ENV_ADDR 0x10040000 CONFIG_SYS_MAX_FLASH_SECT 512 // Maximum number sectors CONFIG_SYS_MAX_FLASH_BANKS 1 CONFIG_SYS_MONITOR_LEN SZ_256K NOR_SIZE SZ_128M //128MB NOR SECTOR_SIZE SZ_256K // 256KB sector size
When I set all the environment variable and try to save on flash , I am getting Error: end address not on sector boundary.
Check the settings in your config file. The environment must live in an integer number of sectors, and sector size depends on the flash chip (usually 64k or 128k).
But still my kernel boots with the env setting I made,
saveenv failed, but in-memory env has been modified.
but on restart these enviroment settings are lost.
That's because saveenv failed, next time you read environment from flash (or, most likely, compile defaults).
Regards Naveen

I already looked at my config file, but couldn't root cause the problem Here are some of the definitions from my configs, incase anything wrong
CONFIG_SYS_FLASH_BASE 0x10000000 CONFIG_ENV_ADDR 0x10040000
Ok. But you'd better copy whole lines from config file instead of choosing words from them. Sometimes the error is in the details.
SECTOR_SIZE SZ_256K // 256KB sector size
(the comment is redundant here)
so the environment is in the second sector (it starts at the beginning of a sector). You problem is with the end, so CFG_ENV_SIZE must be wrong in your config. It should be 256k as well.
/alessandro

Alessandro, Thanks for your quick support, Now I made CFG_ENV_SIZE to proper sector size. It is working fine.
Regards Naveen
I already looked at my config file, but couldn't root
cause the problem
Here are some of the definitions from my configs, incase
anything wrong
CONFIG_SYS_FLASH_BASE 0x10000000 CONFIG_ENV_ADDR 0x10040000
Ok. But you'd better copy whole lines from config file instead of choosing words from them. Sometimes the error is in the details.
SECTOR_SIZE SZ_256K // 256KB sector size
(the comment is redundant here)
so the environment is in the second sector (it starts at the beginning of a sector). You problem is with the end, so CFG_ENV_SIZE must be wrong in your config. It should be 256k as well.
/alessandro

Dear "Penda, Naveen Kumar",
In message 5A47E75E594F054BAF48C5E4FC4B92AB0305FC60D6@dbde02.ent.ti.com you wrote:
Thanks for your quick support, Now I made CFG_ENV_SIZE to proper sector size.
You must be using really obsolte code if you still have any CFG_ settings in your code. We got rid of these a long time ago.
Best regards,
Wolfgang Denk

Hi Wolfgang Denk
Dear "Penda, Naveen Kumar",
In message 5A47E75E594F054BAF48C5E4FC4B92AB0305FC60D6@dbde02.ent.ti.com you wrote:
Thanks for your quick support, Now I made CFG_ENV_SIZE to proper sector size.
You must be using really obsolte code if you still have any CFG_ settings in your code. We got rid of these a long time ago.
Ya, I was using old uboot code, now migrating to the latest u-boot, during this course I was facing these issues.
participants (3)
-
Alessandro Rubini
-
Penda, Naveen Kumar
-
Wolfgang Denk