You would need to..<br>1) Have mtd (memory technology device) support in your kernel<br>2) Know the blocksize of your device<br>3) Know the offset to the environmental variables block<br>4) Write a program that..<br>4.1) open() the mtd device node
<br>4.2) lseek() to the environmental block<br>4.3) read() the environmental block<br>4.4) Skip over the first 4 bytes (it's the checksum)<br>4.5) Parse through the series of \0 terminated strings until you find the env var you are interested in
<br>Stop here, if you only need to read vars. To write one....<br>4.6) Insert/update your variable's value<br>4.7) Use the checksum calculation table from the u-boot source to recalc the chksum<br>4.8) Copy the checksum to the first four bytes of your new copy of the env block
<br>4.9) erase the env block on the device (ioctl(fd, MEMERASE, &erase_info)<br>4.A) lseek() to the env block<br>4.B) write() your new copy of the env block<br><br>I wrote one of these for our NOR device. Should be the same for NAND, right? All the differences should be handled by the MTD layer.
<br><br><div><span class="gmail_quote">On 7/25/07, <b class="gmail_sendername">Raghu</b> <<a href="mailto:raghu_dk@yahoo.com">raghu_dk@yahoo.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello All,<br><br>I have a serial number and a MAC address stored as the<br>U-Boot environment variables. A block of NAND flash<br>device of size 128K is assigned for persistance.<br><br>Is there a way that I can modify or change these
<br>variables from Linux kernel, OR what would I have to<br>do to get this done.<br><br>Warm Regards,<br>Raghu<br><br><br><br>____________________________________________________________________________________<br>Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
<br><a href="http://new.toolbar.yahoo.com/toolbar/features/mail/index.php">http://new.toolbar.yahoo.com/toolbar/features/mail/index.php</a><br><br>-------------------------------------------------------------------------<br>
This SF.net email is sponsored by: Splunk Inc.<br>Still grepping through log files to find problems? Stop.<br>Now Search log events and configuration files using AJAX and a browser.<br>Download your FREE copy of Splunk now >>
<a href="http://get.splunk.com/">http://get.splunk.com/</a><br>_______________________________________________<br>U-Boot-Users mailing list<br><a href="mailto:U-Boot-Users@lists.sourceforge.net">U-Boot-Users@lists.sourceforge.net
</a><br><a href="https://lists.sourceforge.net/lists/listinfo/u-boot-users">https://lists.sourceforge.net/lists/listinfo/u-boot-users</a><br></blockquote></div><br>