Welcome, Guest

Author Topic: How to install Debian on NAND in A20-MICRO?  (Read 67334 times)

iso9660

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +2/-0
How to install Debian on NAND in A20-MICRO?
« on: October 17, 2013, 06:58:28 PM »
Please, can anybody tell how to install Debian in the A20-MICRO nand?

Tom

  • Newbie
  • *
  • Posts: 36
  • Karma: +0/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #1 on: October 18, 2013, 12:43:48 AM »
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

  • Full Member
  • ***
  • Posts: 122
  • Karma: +2/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #2 on: October 18, 2013, 02:03:23 AM »
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

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #3 on: October 21, 2013, 10:37:37 AM »
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

  • Newbie
  • *
  • Posts: 9
  • Karma: +6/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #4 on: October 22, 2013, 12:47:16 PM »
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
Code: [Select]
tar -xzOf nand_part.gz | dd of=/dev/nand
sync

# reboot to make new partitions available
Code: [Select]
reboot
# after reboot: create filesystems
Code: [Select]
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
Code: [Select]
mkdir /mnt/nanda
mkdir /mnt/nandc
mount /dev/nanda /mnt/nanda
mount /dev/nandc /mnt/nandc

# install bootloader to /dev/nanda
Code: [Select]
rm -rf /mnt/nanda/*
rsync -avc bootloader/* /mnt/nanda

# copy script.bin and uImage into new root device under /boot
Code: [Select]
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:
Quote
extraargs=<your extra kernel args here>

# copy rootfs
Code: [Select]
rsync -avc --exclude-from=exclude.txt / /mnt/nandc
sync

# shutdown and remove SD card
Code: [Select]
shutdown -h now
# now power on the device and it should boot from NAND!

Enjoy!
« Last Edit: October 22, 2013, 12:50:12 PM by Mad Demus »

iso9660

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +2/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #5 on: October 23, 2013, 01:29:50 PM »
Hi Mad Demus.

Many thanks for your help!

miloose

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #6 on: October 23, 2013, 05:26:30 PM »
Waaw. Thanks a lot. Very clear how-to with every steps. I will give it a try.

Thanks again.

jacquesdirac

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #7 on: October 25, 2013, 03:54:12 PM »
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

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #8 on: November 18, 2013, 07:26:17 PM »
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

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #9 on: November 20, 2013, 08:17:56 PM »
 Hi, thanks for the great tutorial. How is the speed compared to sdcard? Did you run any benchmarks?

Mad Demus

  • Newbie
  • *
  • Posts: 9
  • Karma: +6/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #10 on: November 29, 2013, 09:56:44 AM »
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

  • Newbie
  • *
  • Posts: 9
  • Karma: +6/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #11 on: November 29, 2013, 10:34:04 AM »
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):

Code: [Select]
/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

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #12 on: November 29, 2013, 10:01:38 PM »
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

  • Newbie
  • *
  • Posts: 9
  • Karma: +6/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #13 on: December 01, 2013, 07:39:33 PM »
will check this tomorrow...

Mad Demus

  • Newbie
  • *
  • Posts: 9
  • Karma: +6/-0
Re: How to install Debian on NAND in A20-MICRO?
« Reply #14 on: December 02, 2013, 12:24:10 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:

Code: [Select]
CONFIG_SUNXI_NAND=y
CONFIG_SUNXI_NAND_COMPAT_DEV=y

And for PWM, try to add the following line:

Code: [Select]
CONFIG_SUNXI_PWM=y