From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Andreas_Bie=DFmann?= Date: Fri, 17 May 2013 07:45:17 +0200 Subject: [U-Boot] u-boot USB question In-Reply-To: <51958652.7030501@atmel.com> References: <51958652.7030501@atmel.com> Message-ID: <5195C3ED.2030004@googlemail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Lance, Bo, On 17.05.13 03:22, Bo Shen wrote: > Hi Lance, > > On 5/17/2013 06:32, Lance Beck wrote: >> We are using u-boot on an AT91SAM9G20 platform with NAND Flash and >> running Linux. Is there a means to update the kernel and root fs >> image by reading them from a USB memory device and writing the new >> images to flash? I have built the fw_printenv tool thinking I might >> be able to use this to somehow trigger that action. > > Yes. Please take the following example (using the mainline > u-boot-2013.04) for updating related image from USB disk. > > 1. connect usb to board and power up > U-boot> usb start > (Re)start USB... > USB: scanning bus for devices... 2 USB Device(s) found > scanning bus for storage devices... 1 Storage Device(s) found > U-boot> fatls usb 0 > ... > 2396352 uImage > ... > U-boot> fatload usb 0 0x20000000 uImage > U-boot> nand erase 0x200000 0x600000 > U-boot> nand write 0x20000000 0x200000 just a pointer ... All these load commands (fat, ubi, ...) set an env named filesize. Just write U-boot> nand write 0x20000000 0x200000 $filesize There is another magic env that can be used here. One can define CONFIG_LOADADDR (or was it CONFIG_SYS_LOADADDR ... there was a discussion to consolidate this) to have env 'loadaddr' set. With that you can use $loadaddr instead of 0x20000000 in the example above. Best regards Andreas Bie?mann