Changes

How to modify the uboot environment from userspace

139 bytes added, 19:18, 12 October 2010
no edit summary
This will give us fw_printenv, in order to get fw_setenv we just have to change the name of the file. Magic!!
<code> cp fw_printenv fw_setenv</code>
The next thing we will need is the fw_env.config file with the appropiate settings for our board. Here comes the confusion :-)
Ok, so in order to get all this information the easyest thing is to read it from dmesg or from /proc/mtd
<code> cat /proc/mtd</code>
All my initial confusion comes from using an incorrect kernel, my first tries where with 2.6.28.10 and the driver used to read mtd was NAND, in the kernel configuration file I only had :
<code> CONFIG_MTD_NAND=y</code>
being the output of /proc/mtd:
<code> dev: size erasesize name mtd0: 00080000 00040000 "X-Loader" mtd1: 001e0000 00040000 "U-Boot" mtd2: 00020000 00040000 "U-Boot Env" mtd3: 00500000 00040000 "Kernel" mtd4: 1f880000 00040000 "File System"</code>
through "dmesg" I could see this line indicating something was wrong:
<code> [ 1174.517120] Creating 5 MTD partitions on "omap2-onenand": [ 1174.522552] 0x00000000-0x00080000 : "X-Loader" [ 1174.528381] 0x00080000-0x00260000 : "U-Boot" [ 1174.533508] 0x00260000-0x00280000 : "U-Boot Env" [ 1174.538177] mtd: partition "U-Boot Env" doesn't start on an erase block boundary -- force read-only [ 1174.548126] 0x00280000-0x00780000 : "Kernel" [ 1174.553192] 0x00780000-0x20000000 : "File System"</code>
But if we use the aproppiate kernel, in my case 2.6.33.7-0 with the onenand driver instead of the nand driver:
<code> CONFIG_MTD_ONENAND=y</code>
The output of /proc/mtd is different:
<code>
</code> 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" 
I'll continue in a couple of hours.
0
edits