Welcome, Guest

Author Topic: HOWTO OlinuXino A20 + SATA + ownCloud  (Read 9779 times)

fromcologne

  • Newbie
  • *
  • Posts: 7
  • Karma: +1/-0
HOWTO OlinuXino A20 + SATA + ownCloud
« on: February 13, 2014, 07:04:43 AM »
HOWTO setup an OlinuXino A20 with RootFS on SATA and ownCloud

- Debian 7 (wheezy)
- Kernel linux-sunxi 3.4.75+
- ownCloud 6.0

1. Step: Prepare a kernel with SATA/AHCI support
To install a rootfs on SATA you have to build your own kernel with sata/ahci drivers inside the kernel and not as a module.

Follow the steps in this excellent description:
How to make bootable SD card with Debian Linux for A20-OLinuXino-MICRO based on Kernel 3.4
http://olimex.wordpress.com/2013/09/18/7795/

During "3. Building kernel sources for Olinuxino-A20-Micro" you have to do some additional work.

The config script for the compiler needs this two parameters:
Code: [Select]
CONFIG_SATA_AHCI_PLATFORM=y
CONFIG_SW_SATA_AHCI_PLATFORM=y
You can find this parameters in the file olinuxinoa20_defconfig (edit the file) or you can use
Code: [Select]
# make ARCH=arm menuconfig
After this follow the description again and you will get a bootable microSD card.

Remarks:
--------
Because I had to develop this on a headless OlinuXino A20 [didn´t found a display working with the onboard HDMI port  :( ] I need some special editing.
I mounted the second partition of the microSD (with the rootfs) on my Debian development system
Code: [Select]
# mount /dev/mmcblk0p2 /mnt/sdand did this patches:

1. IP address
Default kernel don´t use DHCP client. You have to edit the file /etc/network/interfaces
Code: [Select]
# nano /mnt/sd/etc/network/interfacesit should look like this:
Code: [Select]
...
auto eth0
iface eth0 inet dhcp
...
   
or if you don´t have DHCP server in your network:
Code: [Select]
...
auto eth0
iface eth0 inet static
   address 192.168.1.104
   netmask 255.255.255.0
   gateway 192.168.1.1
   dns-nameservers 192.168.1.1
...
I use a static IP address and additional I had to edit the file /etc/resolv.conf
Code: [Select]
# nano /mnt/sd/etc/resolv.confit should look like this:
Code: [Select]
...
domain yourdomain.local
nameserver xxx.xxx.xxx.xxx
nameserver yyy.yyy.yyy.yyy
...
(I´m not sure if this is necessary if you use DHCP. Try it.)

2. (optional for headless server)
I connect with SSH to the OlinuXino A20 I get an error by xfce. The reason is that my SSH login tries a second start of xfce triggered by a command in /.bashrc
Code: [Select]
# nano /mnt/sd/root/.bashrcinsert a comment character. It should look like this:
Code: [Select]
...
#startxfce4&
...
   
If you are ready, unmount the microSD from your development system:
Code: [Select]
# sync
# umount /dev/mmcblk0p2
   
2. Step: First boot and test
Boot your OlinuXino A20 with the new microSD card and do testing.

3. Step: Install rootfs in SATA
We need partitions on the harddisk /dev/sata.
I followed the description above "How to make bootable SD card... "
Code: [Select]
# fdisk /dev/sdaLike in the description delete any old partition and create two new partitions.
Format the two partitions:
Code: [Select]
# mkfs.vfat /dev/sda1
# mkfs.ext4 /dev/sda2
(I´m not sure but I think it makes no difference if you use ext3 instead)

Download the file debian_34_fs.tgz to /home

Mount the second partition of the harddisk and untar the rootfs
Code: [Select]
# mount /dev/sda2 /mnt/hdd
# tar xzvf /home/debian_34_fs.tgz -C /mnt/hdd

Remark: during my first try to untar I got error messages time stamps are in the future. Reason was wrong time/date of the OlinuXino A20. You can set the time/date manually with:
# date 021117562014
the syntax is MMDDhhmmYYYY



Now you have to do the same steps like in the kernel build description. First delete modules with wrong version an wrong firmware files. Then copy the right on from your microSD to /dev/sata2:
Code: [Select]
# rm -rf /mnt/hdd/lib/modules/3.4.43+/
# rm -rf /mnt/hdd/lib/firmware/
# cp -rfv /lib/modules/3.4.75+/ /mnt/hdd/lib/modules/
# cp -rfv /lib/firmware/ /mnt/hdd/lib/

Copy your patched config files from microSD to /dev/sda2:
Code: [Select]
# cp -fv /etc/network/interfaces /mnt/hdd/etc/network/interfaces
# cp -fv /etc/resolv.conf /mnt/hdd/etc/resolv.conf
# cp -fv /root/.bashrc /mnt/hdd/root/.bashrc

Umnount harddisk:
Code: [Select]
# sync
# unmount /dev/sda2

Now you have to change the boot process to use rootfs on /dev/sda2. The boot information is in the first partition of the microSD.
Code: [Select]
# mount /dev/mmcblk0p1 /mnt/sd
Create a file uEnv.txt with only one line content (with the nano editor):
Code: [Select]
root=/dev/sda2In other descriptions about uEnv.txt you find a lot of other parameters, but I only need this one.

Unmount:
Code: [Select]
# sync
# umount /dev/mmcblk0p1

Reboot:
Code: [Select]
# shutdown -r now
After the reboot the df command should looks like this:
Code: [Select]
# dfFilesystem     1K-blocks    Used Available Use% Mounted on
rootfs         307648976 2685100 289336188   1% /
/dev/root      307648976 2685100 289336188   1% /
devtmpfs          446572       0    446572   0% /dev
tmpfs              89348     228     89120   1% /run
tmpfs               5120       0      5120   0% /run/lock
tmpfs             178680       0    178680   0% /run/shm


Congratulations. Your rootfs is on the harddisk and microSD is only used during boot process.

4. Step: preparations for owncloud installation
The next steps are intellectual property of owncloud.org  :) and you can find more informationes here:
http://software.opensuse.org/download/package?project=isv:ownCloud:community&package=owncloud

More and detailled information you can find here:
http://doc.owncloud.org/server/4.5/admin_manual/installation.html

Installation:
Code: [Select]
# echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_7.0/ /' >> /etc/apt/sources.list.d/owncloud.list
# wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key
# apt-key add - < Release.key 
# apt-get update
# apt-get install owncloud

I prefere MySQL database
Code: [Select]
# apt-get install mysql-serverDuring installation you are asked for a mysql root password. You will need it for the first start of owncloud later.

The first start of your new ownCloud server (be patient !)
Code: [Select]
http://[yourIPaddress]/owncloud
Click on the Advanced options to show the database configuration options.
Enter MySQL admin password, any DB name you want, MySQL instance is localhost.

Ready !!!

Now you have an excelllent system to sync calender, contacts and files of all your gadgets like PC, tablets, smartphones etc. Read the desription on their homepage www.owncloud.org and you will be impressed. Forget all the "big brother" cloud solutions.
« Last Edit: February 14, 2014, 11:22:57 AM by fromcologne »

sanzoghenzo

  • Newbie
  • *
  • Posts: 35
  • Karma: +0/-0
Re: HOWTO OlinuXino A20 + SATA + ownCloud
« Reply #1 on: February 16, 2014, 10:27:02 PM »
thanks fromcologne for this great tutorial! Only one thing: is it necessary to make the fat partition on the data disk? I think it should suffice to have it on the SD.
Now I have to manage how to convert my hfs+ 2TB seagate goflex in ext4 without losing all the data :P

fromcologne

  • Newbie
  • *
  • Posts: 7
  • Karma: +1/-0
Re: HOWTO OlinuXino A20 + SATA + ownCloud
« Reply #2 on: February 18, 2014, 08:55:10 PM »
is it necessary to make the fat partition on the data disk?

You are right. It´s not necessary because the A20 can´t boot from sata.
But it is easier to describe if these steps are analogous to the preparation of the SD card ;-)

barish

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: HOWTO OlinuXino A20 + SATA + ownCloud
« Reply #3 on: March 10, 2015, 08:42:30 PM »
Actually, for me it was not necessary to compile the kernel. I found out by accident. I connected a prepared SATA-disk and added the setting to load Linux from this disk (by putting uEnv.txt with content "root=/dev/sda2" into the boot partition), and forgot to replace the kernel. But it worked, the A20 is now using the SATA disk as rootFS. Maybe Olimex changed the kernel to support SATA by default now?

kooth

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: HOWTO OlinuXino A20 + SATA + ownCloud
« Reply #4 on: May 10, 2015, 09:23:20 PM »
Hello everyone.  This is my first post on this forum.  I have looked for days on how to turn on the power for a SATA drive, but I have only found with pin controls it.  The schematics and data sheets say that pin 22 controls the 5-volt SATA power connector; however, I'm new to this board and I have no idea how to set this.

Is there a command, or do I need to patch the kernel?

Sorry if this has been answered.

Gerrit

  • Full Member
  • ***
  • Posts: 236
  • Karma: +7/-0
Re: HOWTO OlinuXino A20 + SATA + ownCloud
« Reply #5 on: May 11, 2015, 01:42:25 AM »
Hello everyone.  This is my first post on this forum.  I have looked for days on how to turn on the power for a SATA drive, but I have only found with pin controls it.  The schematics and data sheets say that pin 22 controls the 5-volt SATA power connector; however, I'm new to this board and I have no idea how to set this.

Is there a command, or do I need to patch the kernel?

Sorry if this has been answered.

If you use the image provided Olimux you should not have to do anything, just connect the drive with the right connectors.

Check for the next lines in script.fex if you don't have 5 volt at the power connector
Code: [Select]
[sata_para]
sata_used = 1
sata_power_en = port:PC03<1><default><default><0>

kooth

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: HOWTO OlinuXino A20 + SATA + ownCloud
« Reply #6 on: May 11, 2015, 05:12:41 AM »
Thanks Gerrit:

Well, I do have an image provided by Olimex, and it's not enabled by default.  All of the data sheets and schematics only mention that there is a way to turn it on, or to modify the jumper to permanently turn it on.  I do not want to modify the hardware, so hence my question about the kernel or a command.

You seemed to have answered my question by stating that I need to modify the kernel, so thanks for that.  I have been working on the Nitrogen6x boards from Boundary Systems and the Yocto tool chain.  Those boards in that project used Fedora for the OS -- I know nothing about Debian.  I guess it's time to hit the books.

JohnS

  • Hero Member
  • *****
  • Posts: 1584
  • Karma: +29/-41
Re: HOWTO OlinuXino A20 + SATA + ownCloud
« Reply #7 on: May 11, 2015, 09:30:29 AM »
If it's just the fex you don't need to change the kernel.

John

kooth

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: HOWTO OlinuXino A20 + SATA + ownCloud
« Reply #8 on: May 11, 2015, 01:09:39 PM »

Thanks JohnS, but what the flux is a fex? ;)  Just kidding -- I'll read up on it.

Thanks again ...

Kooth

Gerrit

  • Full Member
  • ***
  • Posts: 236
  • Karma: +7/-0
Re: HOWTO OlinuXino A20 + SATA + ownCloud
« Reply #9 on: May 11, 2015, 01:38:55 PM »
Code: [Select]
Well, I do have an image provided by Olimex, and it's not enabled by default.
I use the Image provided by them and and it just worked, so i am almost sure that something else is wrong.

Some things to check

- Does the drive need 12 Volt, if yes then it wont work, you only have 5 Volt
- Look for the Amperage on the disk, is this within the limits from your power source combined with the what the board is using.
- Check with the dmesg command for any errors on sata
« Last Edit: May 11, 2015, 09:49:22 PM by Gerrit »

kooth

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: HOWTO OlinuXino A20 + SATA + ownCloud
« Reply #10 on: May 12, 2015, 04:55:42 AM »
OK: You win.  My new drive is a 2.5" 120GB solid-state drive (my first of this type) is so quiet that I didn't think it was running.  That should prove to me that the instructions don't always say what I think I read.

Thanks to everyone for your help (even the snarky posts.)  This is an awesome board!