Load NAND Flash From Commandline Use FEL?

Started by ericb, December 17, 2015, 06:31:23 AM

Previous topic - Next topic

ericb

Hello,
I've got a custom build of Android working on the LIME2 and running from the on-board NAND, but, I have to use Windows and Phoenix Suite to load it. I've been unsuccessful getting LiveSuite to work under Ubuntu. Even if LiveSuite did work it seems to be a GUI only tool and I'm looking for a scriptable method of loading a new OS image on the the LIME2.

Next Thing Co. has an Allwinner based single board computer called C.H.I.P. which they flash using a few command line scripts. Is there such a thing for the A20?

Thanks,
Eric

JohnS

What happens if you use their tools (possibly with minor changes if needed)?

John

ericb

I need to study the CHIP chip-cel-flash.sh script more before I can modify it to work with the A20. If I just try to run it as is I get the following error, "libusb usb_blk_send error -1". I didn't expect the script to work without modifications. However, it looks like modifying the script will require a very deep knowledge of the memory map of the A20, which I don't have; yet.

Eric


Flashing CHIP:

vagrant@vagrant-ubuntu-trusty-32:~/CHIP-tools$ BUILDROOT_OUTPUT_DIR=../CHIP-buildroot/output/ ./chip-fel-flash.sh
BUILDROOT_OUTPUT_DIR = ../CHIP-buildroot/output/
== preparing images ==
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.00313409 s, 2.6 MB/s
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.00318154 s, 2.6 MB/s
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.00132423 s, 6.2 MB/s
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.00308398 s, 2.7 MB/s
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.00149503 s, 5.5 MB/s
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.0031482 s, 2.6 MB/s
35+1 records in
36+0 records out
589824 bytes (590 kB) copied, 0.00534591 s, 110 MB/s
12+0 records in
12+0 records out
196608 bytes (197 kB) copied, 0.0466045 s, 4.2 MB/s
Image Name:   flash CHIP
Created:      Thu Dec 17 17:02:21 2015
Image Type:   ARM Linux Script (uncompressed)
Data Size:    856 Bytes = 0.84 kB = 0.00 MB
Load Address: 00000000
Entry Point:  00000000
Contents:
   Image 0: 848 Bytes = 0.83 kB = 0.00 MB
== upload the SPL to SRAM and execute it ==
== upload images ==
== execute the main u-boot binary ==
vagrant@vagrant-ubuntu-trusty-32:~/CHIP-tools$


Flashing A20

vagrant@vagrant-ubuntu-trusty-32:~/CHIP-tools$ BUILDROOT_OUTPUT_DIR=../CHIP-buildroot/output/ ./chip-fel-flash.sh
BUILDROOT_OUTPUT_DIR = ../CHIP-buildroot/output/
== preparing images ==
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.00205837 s, 4.0 MB/s
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.0129588 s, 632 kB/s
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.000300933 s, 27.2 MB/s
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.00154912 s, 5.3 MB/s
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.000254735 s, 32.2 MB/s
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.00188822 s, 4.3 MB/s
35+1 records in
36+0 records out
589824 bytes (590 kB) copied, 0.00334475 s, 176 MB/s
12+0 records in
12+0 records out
196608 bytes (197 kB) copied, 0.0359587 s, 5.5 MB/s
Image Name:   flash CHIP
Created:      Thu Dec 17 17:14:20 2015
Image Type:   ARM Linux Script (uncompressed)
Data Size:    856 Bytes = 0.84 kB = 0.00 MB
Load Address: 00000000
Entry Point:  00000000
Contents:
   Image 0: 848 Bytes = 0.83 kB = 0.00 MB
== upload the SPL to SRAM and execute it ==
libusb usb_bulk_send error -1
== upload images ==
ERROR: Allwinner USB FEL device not found!
ERROR: Allwinner USB FEL device not found!
ERROR: Allwinner USB FEL device not found!
ERROR: Allwinner USB FEL device not found!
== execute the main u-boot binary ==
ERROR: Allwinner USB FEL device not found!
vagrant@vagrant-ubuntu-trusty-32:~/CHIP-tools$

pietrushnic

Based on CHIP and support from sunix community I was able to flash and boot U-Boot on my Cubietruck. Main procedure can be found here. Script is very messy, but it works. What it does is loading uboot to RAM over FEL, then boot to it and flash NAND with specially crafted SPL (taka a look at spl-image-builder, this is the piece that does the magic). So getting your NAND datasheet you should be able to modify spl-image-builder command to flash over FEL.

The biggest problem at this point with this approach is that I was not able to prepare UBIFS rootfs, which should also be flashed to NAND. There is also risk that NAND drivers are not yet production ready and in long run can damage NAND chip, by no applying correct wear-leveling algorithms. I think guys from sunix, CHIP and FreeElectrons works on it or even maybe they provided something on ML already.