New IT forum
31 August 2014, 06:32:17 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: CubieBoard 2 and Cubietruck both now in stock.
 
   Home   SHOP Help Search Login Register  
Pages: [1]
  Print  
Author Topic: eSATA kernel  (Read 9759 times)
NewIT_Marcus
Hero Member
*****
Posts: 960


« on: 22 February 2010, 12:07:11 am »

If you bought a (black) eSATA Sheevaplug, the regular ex-factory version has eSATA functionality (and kernel version 2.6.22.18). However, most of the information available regarding compiling newer kernels is for the white Sheevaplug and there is no need for eSATA capability for the white plugs.

Here's one way of compiling an eSATA capable kernel for a black eSATA Sheevaplug. What you will end up with is a kernel that is the equivalent of those available at sheeva.with-linux.com, but with added eSATA capability. (and in this case, kernel version 2.6.32.8 ).

This procedure describes cross-compiling on a 32 bit intel (or compatible) processor.

The cross-compiler that was (?) available on CD version 1.2 is no longer, so we will download all the necessary components for compiling.

We follow the procedure outlined on the Plug Computer wiki

Required software

* Install the CodeSourcery cross-compiler
* Install mkimage (under Ubuntu, you can select package uboot-mkimage)

Source

Create a directory for the kernel sources:
Code:
mkdir ~/kernel/source
 cd ~/kernel/source

* Download kernel sources
Code:
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.8.tar.bz2

* Decompress:
Code:
tar xvjf linux-2.6.32.8.tar.bz2

* Change into the newly created directory:
Code:
cd linux-2.6.32.8

* Download patches from http://sheeva.with-linux.com/sheeva/ (also available at http://www.newit.co.uk/kernels/eSATA/2.6.32.7/patches/)

Code:
wget http://sheeva.with-linux.com/sheeva/2.6.32.8/patches/linux-2.6.29-usb-serial-evdo.patch
wget http://sheeva.with-linux.com/sheeva/2.6.32.8/patches/mvsdio-1-2.6.30.patch
wget http://sheeva.with-linux.com/sheeva/2.6.32.8/patches/mvsdio-2.patch
wget http://sheeva.with-linux.com/sheeva/2.6.32.8/patches/UdlFb-0.2.3-2.6.30.2.patch

* Apply patches:
Code:
patch -p0 < linux-2.6.29-usb-serial-evdo.patch

Output:
Code:
patching file ./drivers/usb/serial/usb-serial.c
Hunk #1 succeeded at 61 (offset 2 lines).
Hunk #2 succeeded at 946 (offset 102 lines).
Hunk #3 succeeded at 976 with fuzz 2 (offset 106 lines).
Hunk #4 succeeded at 1004 (offset 106 lines).
Hunk #5 succeeded at 1037 (offset 106 lines).
Hunk #6 succeeded at 1397 (offset 117 lines).

Code:
patch -p0 < mvsdio-1-2.6.30.patch

Output:
Code:
patching file ./drivers/mmc/core/core.c
patching file ./drivers/mmc/host/mvsdio.c

Code:
patch -p0 < mvsdio-2.patch


Output:
Code:
can't find file to patch at input line 19
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|From: Nicolas Pitre <nico@cam.org>
|Date: Tue, 28 Apr 2009 02:38:12 +0000 (-0400)
|Subject: [MMC] give Sandisk/Kingston SDHC cards some slack before the SWITCH command
|X-Git-Url: http://git.marvell.com/?p=orion.git;a=commitdiff_plain;h=3ea638523747f6d312f11f643a3175c1a4661eec;hp=c0c3df02efed0e5dea9aa4d8313e06e1f68f2cb4
|
|[MMC] give Sandisk/Kingston SDHC cards some slack before the SWITCH command
|
|Without this delay, those cards simply won't work in high speed mode
|as the SWITCH command does not succeeds.
|
|Signed-off-by: Nicolas Pitre <nico@marvell.com>
|Tested-by: Martin Michlmayr <tbm@cyrius.com>
|---
|
|diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
|index cd81c39..ba4c7ab 100644
|--- a/drivers/mmc/core/sd.c
|+++ b/drivers/mmc/core/sd.c
--------------------------
File to patch:
(and CTRL-C to exit, or specify the path to the target file, e.g. /mnt/shared/data/new-it/kernels/source/linux-2.6.32.8/drivers/mmc/core/sd.c)

In this case, the format of the patch file is a little different, another way to fix this is to amend the following 2 lines:

Code:
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c

Change to:

Code:
--- ./drivers/mmc/core/sd.c.original
+++ ./drivers/mmc/core/sd.c

Now try again:

Code:
patch -p0 < mvsdio-2.patch

Output:

Code:
patching file ./drivers/mmc/core/sd.c

patch -p0 < UdlFb-0.2.3-2.6.30.2.patch

Output:
Code:
patching file ./drivers/video/Kconfig
Hunk #1 succeeded at 2082 (offset 8 lines).
patching file ./drivers/video/Makefile
Hunk #1 succeeded at 126 with fuzz 2 (offset 2 lines).
patching file ./drivers/video/udlfb/Makefile
patching file ./drivers/video/udlfb/udlfb.c
patching file ./drivers/video/udlfb/udlfb.h

The final patch is to enable eSATA and we have a new file for this, to replace linux-2.6.32.8/arch/arm/mach-kirkwood/sheevaplug-setup.c The new version was uploaded on the plugcomputer forum and we provide it here for you also: http://www.newit.co.uk/kernels/eSATA/2.6.32.7/patches/sheevaplug-setup.c.modified. We should probably create a .patch file that can be used per the above .patch files ...

Compilation:

In the following commands, -j2 specifies 2 processors in the host PC. Change this to -j4 if appropriate (or omit the parameter if your host processor is single-core).

Code:
Kversion=2.6.32.8
make clean
make ARCH=arm kirkwood_defconfig
make ARCH=arm menuconfig

(At this point you could choose the sheeva-2.6.32.8.config configuration file, downloaded from sheeva.with-linux.com). Alternatively, choose your own compilation settings. You may also be prompted to install a package for libncurses or similar.

Code:
make -j2 ARCH=arm CROSS_COMPILE=~/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi- uImage

uImage may be found in linux-${Kversion}/arch/arm/boot

Code:
make -j2 ARCH=arm CROSS_COMPILE=~/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi- modules

Install the modules to a temporary directory (in this example, ".." implies the container of the current directory):

Code:
make -j2 ARCH=arm CROSS_COMPILE=~/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi- INSTALL_MOD_PATH=..  modules_install

Installation

The sheeva.with-linux.com installation script uses a web server, but is easily modified to copy files from a USB stick. So the next steps are to copy our compiled kernel and modules to a USB stick:

To compress the modules:
Code:
cd ..
sudo tar czf modules.tar.gz  ./lib/modules/${Kversion}/*

cp modules.tar.gz /mnt/target/${Kversion}/sheeva-${Kversion}-Modules.tar.gz
cp linux-${Kversion}/arch/arm/boot/uImage /mnt/target/${Kversion}/sheeva-${Kversion}-uImage
cd /mnt/target/${Kversion}/
md5sum sheeva-${Kversion}-uImage > sheeva-${Kversion}-uImage.md5
md5sum sheeva-${Kversion}-Modules.tar.gz > sheeva-${Kversion}-Modules.tar.gz.md5

We use a modified version of the sheeva.with-linux.com installation script, a modified version is attached to this forum post. (modified because we don't have a 2.6.32.8 version yet, only 2.6.32.7, and also to remove some code that provided a download from webserver option. There's some scrappy / unfinished code in there, but the basic functionality of the original is retained; the NandKernel and ExtractModules functions are the bits that matter.

Now mount your USB stick in your black eSATA Sheevaplug:

Code:
mount /dev/sda1 /mnt
/mnt/kernel-upgrade-to-2.6.32.8-forum-version.sh --target nand

Upon reboot, you should be running your new kernel.

See also: http://plugcomputer.org/plugforum/index.php?topic=434.30

* kernel-upgrade-to-2.6.32.8-forum-version.sh (4.51 KB - downloaded 134 times.)
Logged
NewIT_Marcus
Hero Member
*****
Posts: 960


« Reply #1 on: 26 February 2010, 11:07:05 pm »

Here's a diff file that was posted elsewhere, for the change to sheevaplug-setup.c

http://www.naobsd.org/sheeva/linux/

Code:
--- linux-2.6.32/arch/arm/mach-kirkwood/sheevaplug-setup.c.orig 2009-12-03 12:51:21.000000000 +0900
+++ linux-2.6.32/arch/arm/mach-kirkwood/sheevaplug-setup.c 2009-12-11 01:28:25.000000000 +0900
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/mtd/partitions.h>
+#include <linux/ata_platform.h>
 #include <linux/mv643xx_eth.h>
 #include <linux/gpio.h>
 #include <linux/leds.h>
@@ -42,6 +43,10 @@ static struct mv643xx_eth_platform_data
  .phy_addr = MV643XX_ETH_PHY_ADDR(0),
 };
 
+static struct mv_sata_platform_data sheevaplug_sata_data = {
+ .n_ports = 2,
+};
+
 static struct mvsdio_platform_data sheevaplug_mvsdio_data = {
  /* unfortunately the CD signal has not been connected */
 };
@@ -91,6 +96,7 @@ static void __init sheevaplug_init(void)
  kirkwood_ehci_init();
 
  kirkwood_ge00_init(&sheevaplug_ge00_data);
+ kirkwood_sata_init(&sheevaplug_sata_data);
  kirkwood_sdio_init(&sheevaplug_mvsdio_data);
 
  platform_device_register(&sheevaplug_leds);
Logged
MatthiasM
Newbie
*
Posts: 4


« Reply #2 on: 18 August 2010, 11:51:58 am »

Hi,

first I'd like to thank you for this great forum, you are doing a great job.

Now my question, I'm running a black Sheevaplug with an own build Kernel v2.6.33.7,
I ordered an esata drive that I'd like to attach to it. For the Kernel Version I use, there are no patches available, so do I have to build a Kernel
2.6.32.8 the way you mentioned above to use the drive, or is my newer Kernel already patched so I can use it without any changes?

Best regards
Matthias 
Logged
NewIT_Marcus
Hero Member
*****
Posts: 960


« Reply #3 on: 18 August 2010, 05:31:05 pm »

Since my original post, eSATA functionality has been added to the sheeva.with-linux.com kernels. We recommend you use those kernels, unless you have a specific requirement that they don't have.

As to the way your own kernel is built, well, if you didn't save your config, then only you know what features it has. But lsmod may help
Logged
MatthiasM
Newbie
*
Posts: 4


« Reply #4 on: 18 August 2010, 08:21:45 pm »

Hi Marcus,

thanks for your anwser, so if I use the latest kernel from sheeva.with-linux.com, e.g. 2.6.35.2, I'm ready to use eSATA with the plug?

I compiled my own kernel because I needed support for jfs and xfs filesystems,
luckily I have saved the .config file, unluckily it's to big to post here, for which options do I have to look?


Logged
NewIT_Marcus
Hero Member
*****
Posts: 960


« Reply #5 on: 18 August 2010, 09:05:47 pm »

Hi Marcus,

thanks for your anwser, so if I use the latest kernel from sheeva.with-linux.com, e.g. 2.6.35.2, I'm ready to use eSATA with the plug?


Yes.


I compiled my own kernel because I needed support for jfs and xfs filesystems,
luckily I have saved the .config file, unluckily it's to big to post here, for which options do I have to look?


TBH, I can't remember.
Logged
punaniac
Newbie
*
Posts: 7


« Reply #6 on: 19 August 2010, 07:55:47 am »

thanks for your anwser, so if I use the latest kernel from sheeva.with-linux.com, e.g. 2.6.35.2, I'm ready to use eSATA with the plug?

I have an eSATA Sheevaplug as well and recompiled the sheeva-with-linux kernel for adding some DVB modules. Just apply the provided patches from sheeva.with-linux.com to the vanilla kernel. You don't need to use the sheevaplug-setup.c.modified from NewIT because recent kernels have that patch already integrated.
If you want to boot from eSATA, you have to modify the kernel config to compile Marvell SATA support into the kernel, not as a module (unless you use an initramfs).
Eventually, in the U-Boot environment you have to set arcNumber=2678 to indicate that you have an eSATA Sheevaplug. Setting arcNumber=2097 works, but disables SATA support (see kernel's sheevaplug-setup.c).

best regards,
Andreas
Logged
MatthiasM
Newbie
*
Posts: 4


« Reply #7 on: 20 August 2010, 07:06:08 am »

In the mean time the esata drives arrived.

Just using the the Kernel from sheeva.with-linux didn't  work, the esata drive was not recognized. Then I compiled the 2.6.32.8 Kernel the way described in this post, using a customized .config from
sheeva.with-linux. With this Kernel the esata drive was recognized, also the port-multiplier works, now I have 4 sata drives connected to plug  Smiley
Logged
NewIT_Marcus
Hero Member
*****
Posts: 960


« Reply #8 on: 20 August 2010, 04:53:36 pm »

In the mean time the esata drives arrived.

Just using the the Kernel from sheeva.with-linux didn't  work, the esata drive was not recognized. Then I compiled the 2.6.32.8 Kernel the way described in this post, using a customized .config from
sheeva.with-linux. With this Kernel the esata drive was recognized, also the port-multiplier works, now I have 4 sata drives connected to plug  Smiley

Do you remember which version it was at sheeva.with-linux that didn't work? When we first received these plugs (and I created the first post in this thread) eSATA capability was not available; at some time since then, it was added. I tested the most recent version a couple of days ago - 2.6.35.2 - and IIRC it worked. You've created your own 2.6.32.8 kernel; any particular reason you didn't choose a more recent one?
Logged
MatthiasM
Newbie
*
Posts: 4


« Reply #9 on: 20 August 2010, 10:26:16 pm »

I also tested the 2.6.35.2 Version and that didn't work. I created a 2.6.32.8 Kernel because it was the one you used in your description.
In the mean time I tried the 2.6.34.4 Kernel from sheeva.with-linux which didn't work out of the box, I then compiled the Kernel myself and it also didn't work. Finally I changed the sheevaplug-setup.c to sheevaplug-setup.c.modified, compiled again and this time esata worked :-)
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!