Sunxi tools for flashing the eMMC

1,714 views
Skip to first unread message

Ciprian Manea

unread,
Oct 17, 2016, 6:13:37 AM10/17/16
to linux-sunxi

 I'm using the Sinlinx SinA33 dev board, I connected it to my dev pc using the OTG cable, and I was able to boot it in the FEL mode.

I used the sunxi tools (sunxi-fel more specifically ) to get BROM version and boot the board over usb. 
But is there a way to flash the onboard eMMC over the usb, using the sunxi tools ?

Thanks,
Ciprian

Andre Przywara

unread,
Oct 17, 2016, 6:49:36 AM10/17/16
to ciprian....@gmail.com, linux-sunxi
Hi Ciprian,
Not that I am aware of, and not sure if it's worth to pull in a MMC
driver via FEL (like we do with the much smaller SPI NOR flash code).

What I did last week was booting into U-Boot via FEL and using the mmc
command there to write the eMMC.
You can get data in via TFTP, USB storage (pen drive) or reading from an
SD card, for instance. Of course you can also load the image via FEL.
This works easily when the amount to flash is not overly big (read: fits
in DRAM easily).
So you do something like:
# tftpboot 0x50000000 emmc.img
# mmc write 0x50000000 0 <nr of sectors>

I think you can even automate this by some U-Boot environment magic (I
think sunxi-fel gained something for this lately).

I also enabled the md5sum command (which required some build system
changes) to make sure the transfer and flashing was sane.

Cheers,
Andre.

Bernhard Nortmann

unread,
Oct 17, 2016, 7:29:55 AM10/17/16
to andre.p...@arm.com, ciprian....@gmail.com, linux-sunxi
Am 17.10.2016 um 12:49 schrieb Andre Przywara:
> [...]
> I think you can even automate this by some U-Boot environment magic (I
> think sunxi-fel gained something for this lately).
> [...]

Environment "overrides" using uEnv.txt-style data are still work in
progress.
The sunxi-tools side of things still needs to be reviewed and merged
(https://github.com/linux-sunxi/sunxi-tools/pull/60).
Testers are much welcome, of course. ;)

Regards, B. Nortmann

Ciprian Manea

unread,
Oct 17, 2016, 9:08:38 AM10/17/16
to linux-sunxi, ciprian....@gmail.com, andre.p...@arm.com
Hi Andre, 

  Thanks for your answer!
The thing is that there are a lot of libs&apps in the image and is bigger than the available RAM. 
If there's no way to flash the eMMC through the sunxi tools, is there a way to boot over an USB storage device 
and flash an image that is store on the USB storage to the eMMC ?

  And there are the phoenix tools. Are these of any use for flashing Linux images?   

Thanks,
Ciprian

Andre Przywara

unread,
Oct 17, 2016, 9:18:38 AM10/17/16
to Ciprian Manea, linux-sunxi
Hi,

On 17/10/16 14:08, Ciprian Manea wrote:
> Hi Andre,
>
> Thanks for your answer!
> The thing is that there are a lot of libs&apps in the image and is
> bigger than the available RAM.
> If there's no way to flash the eMMC through the sunxi tools, is there a
> way to boot over an USB storage device
> and flash an image that is store on the USB storage to the eMMC ?

Yes, that's what I wanted to say in the first message.
You can either fully boot into Linux (for instance using an initrd,
root-over-NFS, root-on-SD card or root-on-USB) and do the flashing from
there. Or you do it from U-Boot as I described, with the same options,
bascially.
If your image is bigger than the DRAM, you can still load in smaller
chunks in U-Boot and do the writing accordingly, though this sound
tedious to automate. I don't think U-Boot supports direct copying from
one medium to another.
Given that I think it might be easier to boot into Linux, because it
doesn't have that restriction (dd if=image.file of=/dev/mmcblk1) and is
also easier to automate.

> And there are the phoenix tools. Are these of any use for flashing
> Linux images?

I have no idea, and frankly don't really care ;-)

But since you are the second person in two weeks asking me that, I think
there is some case for providing some GUI wrapper or at least some
wrapper script around sunxi-fel to tackle that use case.

Cheers,
Andre.

Andre Przywara

unread,
Oct 17, 2016, 9:28:00 AM10/17/16
to Ciprian Manea, linux-sunxi
Hi,

one thing I forgot ...

On 17/10/16 14:18, Andre Przywara wrote:
> Hi,
>
> On 17/10/16 14:08, Ciprian Manea wrote:
>> Hi Andre,
>>
>> Thanks for your answer!
>> The thing is that there are a lot of libs&apps in the image and is
>> bigger than the available RAM.
>> If there's no way to flash the eMMC through the sunxi tools, is there a
>> way to boot over an USB storage device
>> and flash an image that is store on the USB storage to the eMMC ?
>
> Yes, that's what I wanted to say in the first message.
> You can either fully boot into Linux (for instance using an initrd,
> root-over-NFS, root-on-SD card or root-on-USB) and do the flashing from
> there. Or you do it from U-Boot as I described, with the same options,
> bascially.

Another popular possibility seems to be to use the fastboot feature in
U-Boot: You boot into U-Boot using FEL, then switch to fastboot on your
PC (and U-Boot) and do the rest of the flashing from there. This
requires OTG functionality in U-Boot and I haven't tried this myself
yet, but apparently there are a lot of happy users of this method.

Cheers,
Andre.

Ciprian Manea

unread,
Oct 17, 2016, 10:41:09 AM10/17/16
to linux-sunxi, ciprian....@gmail.com, andre.p...@arm.com
Hi, 

  The fastboot feature sounds like an ideal approach!
I never used this u-boot feature! Can you point me to some good documentation,
possible directly related to the Allwinner SoC's ? 

Thanks,
Reply all
Reply to author
Forward
0 new messages