From: Piotr Dymacz Date: Thu, 5 Nov 2015 12:52:17 +0000 (+0100) Subject: Merge branch 'update_readme' X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=01c02758d0b6c0d7eceea92716d14a341e832b9a;p=oweals%2Fu-boot_mod.git Merge branch 'update_readme' --- 01c02758d0b6c0d7eceea92716d14a341e832b9a diff --cc README.md index b5def0b,748b811..bc4875b --- a/README.md +++ b/README.md @@@ -144,11 -149,93 +153,98 @@@ Second, very useful modification is a n ![](http://www.tech-blog.pl/wordpress/wp-content/uploads/2013/04/u-boot_mod_for_tp-link_with_ar9331_netconsole.jpg) +You could also use netcat instead of Hercules utility on Mac/Linux: +``` +# nc -u -p 6666 192.168.1.1 6666 +``` + + ### Writable environment variables + + U-Boot uses special "**environment variables**" which are used for storing values of many different settings, like IP addresses of device and remote server for TFTP transaction, serial console baud rate, boot command, etc. Environment is usually stored in separate FLASH sector or its part, so all changes can be saved permanently. + + None of the popular manufacturers provides this feature and use so called "**read-only environment**" (embedded in U-Boot image), which means that all changes made during a runtime will be lost after device restart and there is no way to store them in FLASH. + + This modification uses writable environment variables in almost all supported devices, so you can do for example: + + ``` + uboot> setenv ipaddr 192.168.1.100 + uboot> saveenv + Saving environment to FLASH... + + Erase FLASH from 0x9F010000 to 0x9F01FFFF in bank #1 + Erasing: # + + Erased sectors: 1 + + Writting at address: 0x9F010000 + + uboot> reset + ``` + + Which will change device IP address and save updated environment variables in FLASH. From next power up, the device will use new value for its IP address. + + Using command **run** and writable environment variables you are able to write custom, small scripts like below example, used for firmware upgrade using TFTP method: + + ``` + uboot> printenv + [...] + firmware_addr=0x9F020000 + firmware_name=firmware.bin + firmware_upg=if ping $serverip; then tftp $loadaddr $firmware_name && erase $firmware_addr +$filesize && cp.b $loadaddr $firmware_addr $filesize && echo OK!; else echo ERROR! Server not reachable!; fi + [...] + + uboot> run firmware_upg + Ethernet mode (duplex/speed): 1/100 Mbps + Using eth0 device + + Ping OK, host 192.168.1.2 is alive! + + + TFTP from IP: 192.168.1.2 + Our IP: 192.168.1.1 + Filename: 'firmware.bin' + Load address: 0x80800000 + Using: eth0 + + Loading: ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######################################## + ######### + + TFTP transfer complete! + + Bytes transferred: 3932160 (0x3c0000) + Erase FLASH from 0x9F020000 to 0x9F3DFFFF in bank #1 + Erasing: ####################################### + ##################### + + Erased sectors: 60 + + Copying to FLASH... + Writting at address: 0x9F020000 + + Done! + + OK! + uboot> + ``` + ### Other Moreover: