How to install Debian on NAND in A20-MICRO?

Started by iso9660, October 17, 2013, 06:58:28 PM

Previous topic - Next topic

iso9660

Please, can anybody tell how to install Debian in the A20-MICRO nand?

Tom

Quote from: iso9660 on October 17, 2013, 06:58:28 PM
Please, can anybody tell how to install Debian in the A20-MICRO nand?

Afaik You can't. At the moment nand is waste of money :(.

martinayotte

Is it because "nand-part" from sunxi-tools doesn't seems to work yet on A20 as I mentionned 2 weeks ago ?

I still waiting for answer about that :

https://www.olimex.com/forum/index.php?topic=1983.0

Because as soon this will be fixed, I presume we will be able to put Debian on A20 NAND, since I've got previous success with A10s boards :

https://www.olimex.com/forum/index.php?topic=1628.0

It sure I didn't try yet this recipe on my A20 seeing that nand-part wasn't able to display current Android partitions like it should...


miloose

I too would be very interested to install Debian on NAND. If you succeed, can you please update this post with an how-to ? Thanks a lot.


Mad Demus

#4
Today I successfully installed the official Debian Image into A20-OLinuXino's flash.

First, download and uncompress this file which contains the bootloader and an image of the flash partition scheme:

http://dtmh.de/files/olinuxino-a20-flashinstall.zip

After that, change into the folder which contains the uncompressed files.

Now, here is the quick recipe:

#############################################################################
# HOWTO install a running SD-card image to A20-OLinuXino NAND flash
#
# The following steps must be executed as root and on a running SD-card image!
#
# Sunxi kernel 3.4.43 or later is required.
# Tested with official Olimex Debian Wheezy image with kernel 3.4.61+
#
# The flash partition scheme will looks like follow:
# /dev/nanda is BOOT device
# /dev/nandc is ROOT device
# /dev/nandb is MAGIC device
#
#############################################################################

# First of all, make sure that all nand devices /dev/nand* are unmounted
# (check output of mount if you are not sure)

# Copy A20 flash partition image to NAND flash
tar -xzOf nand_part.gz | dd of=/dev/nand
sync


# reboot to make new partitions available
reboot

# after reboot: create filesystems
mkfs.vfat /dev/nanda
mkfs.ext4 /dev/nandc
echo -e 'ANDROID!\0\0\0\0\0\0\0\0\c' > /dev/nandb


# mount new filesystems
mkdir /mnt/nanda
mkdir /mnt/nandc
mount /dev/nanda /mnt/nanda
mount /dev/nandc /mnt/nandc


# install bootloader to /dev/nanda
rm -rf /mnt/nanda/*
rsync -avc bootloader/* /mnt/nanda


# copy script.bin and uImage into new root device under /boot
mount /dev/mmcblk0p1 /boot
rsync -avc /boot/script.bin /boot/uImage /mnt/nandc/boot/


# if you need additional kernel arguments, you can create a uEnv.txt file under
# /mnt/nandc/boot/ wich contains the following line:
Quoteextraargs=<your extra kernel args here>

# copy rootfs
rsync -avc --exclude-from=exclude.txt / /mnt/nandc
sync


# shutdown and remove SD card
shutdown -h now

# now power on the device and it should boot from NAND!

Enjoy!

iso9660


miloose

Waaw. Thanks a lot. Very clear how-to with every steps. I will give it a try.

Thanks again.

jacquesdirac

Thanks Mad Demus, for this great tutorial!
Followed the steps and it runs fine.

Only one remark:
When I make changes to the rootfs they are still available after a reboot, so it looks like the rootfs is loaded and running from NAND (and not running from RAM). Could this not do any harm if the NAND flash is written all the time by the rootfs (wearing out)?

How can the rootfs be mounted readonly to be sure?

Jox

First, thanks for the tutorial, but it seems it is not working anymore....  :(

/dev/nand does not appear in /dev, so I haven't been able to install the latest Debian image (release 5), as you can't copy anything there.

Any workaround for this ??

kalkov

 Hi, thanks for the great tutorial. How is the speed compared to sdcard? Did you run any benchmarks?

Mad Demus

Here are the results of a quick I/O benchmark, done by fio tool under different situations:

============================================================== 
== random workload, sequential read/write, 1 process
==============================================================

==========================
== Class 10 MicroSD
==========================
# fio --name=test --rw=readwrite --size=100M --direct=1 --bs=1024k --filename=file1
test: (g=0): rw=rw, bs=1M-1M/1M-1M/1M-1M, ioengine=sync, iodepth=1
fio-2.1.4-6-ge171
...
Run status group 0 (all jobs):
   READ: io=48128KB, aggrb=3856KB/s, minb=3856KB/s, maxb=3856KB/s, mint=12480msec, maxt=12480msec
  WRITE: io=54272KB, aggrb=4348KB/s, minb=4348KB/s, maxb=4348KB/s, mint=12480msec, maxt=12480msec

Disk stats (read/write):
  mmcblk0: ios=94/105, merge=0/2, ticks=3940/16810, in_queue=20900, util=97.47%

 
==========================
== NAND
==========================
# fio --name=test --rw=readwrite --size=100M --direct=1 --bs=1024k --filename=/mnt/benchfile
test: (g=0): rw=rw, bs=1M-1M/1M-1M/1M-1M, ioengine=sync, iodepth=1
fio-2.1.4-6-ge171
Starting 1 process
...
Run status group 0 (all jobs):
   READ: io=48128KB, aggrb=1346KB/s, minb=1346KB/s, maxb=1346KB/s, mint=35753msec, maxt=35753msec
  WRITE: io=54272KB, aggrb=1517KB/s, minb=1517KB/s, maxb=1517KB/s, mint=35753msec, maxt=35753msec

Disk stats (read/write):
  nand: ios=423/477, merge=0/6, ticks=24480/167780, in_queue=194920, util=97.92%
 

==========================
== RESULT
==========================
=> MicroSD is about 2.86 times faster in single-task, sequential R/W operations than NAND.
 
 
============================================================== 
== random workload, random read/write, 2 processes
==============================================================

==========================
== Class 10 MicroSD
==========================
# fio --name=test --rw=randrw --size=10M --numjobs=2 --direct=1 --filename=file1
test: (g=0): rw=randrw, bs=4K-4K/4K-4K/4K-4K, ioengine=sync, iodepth=1
test: (g=0): rw=randrw, bs=4K-4K/4K-4K/4K-4K, ioengine=sync, iodepth=1
fio-2.1.4-6-ge171
Starting 2 processes
Jobs: 2 (f=2): [mm] [96.4% done] [75KB/63KB/0KB /s] [18/15/0 iops] [eta 00m:01s]
...
Run status group 0 (all jobs):
   READ: io=10640KB, aggrb=401KB/s, minb=200KB/s, maxb=201KB/s, mint=26447msec, maxt=26475msec
  WRITE: io=9840KB, aggrb=371KB/s, minb=185KB/s, maxb=186KB/s, mint=26447msec, maxt=26475msec

Disk stats (read/write):
  mmcblk0: ios=2622/2437, merge=0/5, ticks=3890/26600, in_queue=30410, util=98.11%
 
==========================
== NAND
==========================
# fio --name=test --rw=randrw --size=10M --numjobs=2 --direct=1 --filename=/mnt/benchfile
test: (g=0): rw=randrw, bs=4K-4K/4K-4K/4K-4K, ioengine=sync, iodepth=1
test: (g=0): rw=randrw, bs=4K-4K/4K-4K/4K-4K, ioengine=sync, iodepth=1
fio-2.1.4-6-ge171
Starting 2 processes
Jobs: 2 (f=2): [mm] [100.0% done] [1089KB/1009KB/0KB /s] [272/252/0 iops] [eta 00m:00s]
...
Run status group 0 (all jobs):
   READ: io=10640KB, aggrb=620KB/s, minb=310KB/s, maxb=311KB/s, mint=17084msec, maxt=17144msec
  WRITE: io=9840KB, aggrb=573KB/s, minb=286KB/s, maxb=287KB/s, mint=17084msec, maxt=17144msec

Disk stats (read/write):
  nand: ios=2583/2399, merge=1/3, ticks=6470/14200, in_queue=20630, util=97.39%

==========================
== RESULT
==========================
=> NAND is about 1.5 times faster in random workload + random R/W operations than MicroSD.

Mad Demus

Quote from: jacquesdirac on October 25, 2013, 03:54:12 PM
How can the rootfs be mounted readonly to be sure?

Hi jacquesdirac,

as usual, you can use /etc/fstab to mount root as "read only" (ro):

/dev/nandc   /      ext4    ro,relatime,data=ordered 0 0

But you have to ensure, that there are places to store some things like logfiles or temp files, so you'll need additional mount points (e.g. mounting /var as tmpfs)

miloose

Does someone knows how to access to the nand with the release 5? the command fdisk -l doesn't show the nand, so I'm a little confused...

Thanks a lot

Mad Demus


Mad Demus

Quote from: Jox on November 18, 2013, 07:26:17 PM
/dev/nand does not appear in /dev, so I haven't been able to install the latest Debian image (release 5), as you can't copy anything there.

Any workaround for this ??

The problem seems to be in kernel configuration: CONFIG_SUNXI_NAND isn't set anymore (but was set in previous release, also CONFIG_SUNXI_PWM is missing and therefore PWM doesn't work anymore!)

You could try to build Release 5 again with a modified version of a20_defconfig, where you add the following 2 lines:

CONFIG_SUNXI_NAND=y
CONFIG_SUNXI_NAND_COMPAT_DEV=y


And for PWM, try to add the following line:

CONFIG_SUNXI_PWM=y