Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

How to modify the uboot environment from userspace

2,257 bytes added, 19:00, 12 October 2010
no edit summary
== Overview ==
This How-To is meant to be a starting point for people to learn how access to the uboot environment from userspace.
== Feedback and Contributing ==This is my first wiki page so please be benevolent with the formatting :-)
Creating articles in the wiki is a collaborative process, at any point, if you see a mistake you can contribute to this article.== tools needed ==
In order to modify the uboot environment variables from userspace we will need a program called fw_setenv, we can compile this program ourselves from the u-boot sources, follow the instructions in this wiki page and then proceed to compile with (don't modify the .h file as it says in the tools/env/README file):  <code>make env </code>  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 :-) In this file you have to specify: 1.- MTD device name2.- Device Offset3.- Environment Size4.- Flash sector size5.- Number of sectors (ignored in NOR) 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 namemtd0: 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> I'll continue in a couple of hours. == Feedback and Contributing == Creating articles in the wiki is a collaborative process, at any point, if you see a mistake you can contribute to this article.  Please, use the discussion tab for user comments. This is useful to separate page content and the discussion thereof and also, if you don't want to give normal users the right to edit the page but still want user contributed notes.
Editing permissions are restricted to registered users. [http://www.igep.es Register in the main IGEP site] and you will have single sign-on.
Consult the [http://www.mediawiki.org/wiki/Help:Contents User's Guide] for information on using the wiki software.
There is a set of [[Wiki contribution guidelines]].
== References ==
* http://www.igep.es/index.php?option=com_kunena&amp;Itemid=97&amp;func=view&amp;catid=13&amp;id=1666&amp;limit=6&amp;limitstart=6#2161
[[Category:How to forgeHow_to_forge]]
0
edits