microSD card boot vs NAND memory boot
The most important question first: should I boot Debian from the microSD card or from the NAND memory?
Generally, booting from microSD card is faster and safer. However, in specific cases booting from NAND might be the better decision. Consider the below comparison when deciding where to boot from.
Using NAND is better than using microSD card:
- if you are aiming for minimal power consumption;
- when there is no microSD card connector, no external connections are allowed, or microSD card is not a preferred storage medium;
- for academic reasons;
- Since it is harder to compromise the security of the system physically (as opposed to just stealing the microSD card).
Using NAND is worse than using microSD card because:
- it is slower than a class 10 microSD card;
- it is harder to make a backup;
- in case of a problem with the file system – the device would not boot and the recovery (of your data) would be nearly impossible.
How to install Debian to the NAND memory
It is possible to install the official Debian Jessie images to the NAND memory of your A20 board.
Note that currently only the Debian Jessie images for the A20 boards contain such a NAND installation option.
How to do it?
1. Download and extract the latest official Debian Jessie image from the wiki article for your board. Note that the procedure below is not possible with the Wheezy releases, only with the Jessie ones.
The script would not work with custom images.
2. Write the image to a micro SD card using your favorite software (like Win32 Disc Imager or dd).
3. Insert the prepared card in your board and boot the board.
4. Establish connection to the command line interface of the board.
5. Execute nandinstall script.
6. Wait until Debian installs on the NAND memory (it takes around 10 minutes).
7. Shut down the board and remove the microSD card.
8. Now you can boot from the NAND memory.
Q: I did everything like you explained above and when I boot from the NAND I receive only black screen. Nothing on the console. What did I do wrong???
A: You did nothing wrong. The script above was written and tested on board that already had Android installed on the NAND memory. The problem is related to the fact that we no longer load Android to the NAND memory of A20 boards. No Android on the NAND = script not working.
It seems that the problem is caused by boot0 and boot1 code on the device, boot0 and boot1 code is located at a special area, which only the tools released by Allwinner (PhoenixSuit) can access. The problem is that the tools are not open-source and no one knows what happens exactly.
There are two workarounds:
1) Install Android to the NAND first using PhoenixSuit or LiveSuit (depending on the board) and then perform the nandinstall script again. The wiki of each board has instructions and images for Android install via the USB.
2) If you prefer to use Linux computer:
You can use CT_NandBoot software - you need a Linux computer to set the proper boot0 and boot1 in the NAND. It is faster than using PhoenixSuit and loading Android images (it takes one command and ~20 seconds to set the NAND correct under Linux). Then you can use the nandinstall script mentioned in the beginning of the article.
How to do it:
- Get the sources of the program on your Linux computer:
# git clone https://github.com/phelum/CT_NandBoot
# sudo apt-get install libusb-1.0-0-dev
# cd CT_NandBoot
- Put the board into bootloader mode (press recovery button; apply power, apply mini USB; release button) and execute:
- Wait around 20 seconds process to finish
Now the board should be able to operate with the nandinstall script as usual.