[U-Boot] u-boot USB question

Lance Beck
2013-05-17T02:20:30Z

Thanks Bo!

My thinking with fw_printev (setenv) was that I would use it to set the environment variables from our user space app. This way, we can control when the USB stick will be used for a kernel or rootfs upgrade. Any thoughts on show this could be scripted and run? We would like to be able to have a customer in the field do this without having to do anything but send a command from the user app, insert the USB drive and reboot.

Lance

-----Original Message-----
From: Bo Shen [mailto:voice.shen at atmel.com]
Sent: Thursday, May 16, 2013 7:22 PM
To: Lance Beck
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] u-boot USB question

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 <uImage_size>

If all steps are successfully, then you have updated linux kernel uImage.

BTW, the fw_printenv is used with Linux file system to access u-boot environment.

> Not sure where to go from here...
>
> Thanks,
>
> Lance

Best Regards,
Bo Shen