* [http://www.codesourcery.com/sgpp/lite/arm Codesourcery's ARM toolchain] is recommended as it is also used by Buffalo (see [http://nas-spares.nas-central.org/index.php?title=Setting_up_the_codesourcery_toolchain_for_X86_to_ARM9_cross_compiling NAS-Central Wiki Page] for more info).

+

* [http://www.codesourcery.com/sgpp/lite/arm Codesourcery's ARM toolchain] is recommended as it is also used by Buffalo (see [http://general.nas-central.org/wiki/Setting_up_the_codesourcery_toolchain_for_X86_to_ARM9_cross_compiling NAS-Central Wiki Page] for more info).

* If the cross compile machine runs Debian, Ubuntu, or similar, you can also use the cross compilation toolchain repository supplied by [http://www.emdebian.org/tools/crosstools.html Emdebian].

* If the cross compile machine runs Debian, Ubuntu, or similar, you can also use the cross compilation toolchain repository supplied by [http://www.emdebian.org/tools/crosstools.html Emdebian].

or [http://buffalo.jp/php/los.php?to=gpl/storage/ts-igl/101/linux-2.6.22_lsp.3.0.5.tgz linux-2.6.22_lsp.3.0.5.tgz] or [http://buffalo.jp/php/los.php?to=gpl/storage/ls-x/165/linux-3.3.4.tar.gz linux-3.3.4.tar.gz]

===How to Get GPL Build Kernel Run Under Linkstation Live Stock Environment===

===How to Get GPL Build Kernel Run Under Linkstation Live Stock Environment===

'''Before You Begin:

'''Before You Begin:

Line 52:

Line 53:

len += sprintf(buf+len,"PRODUCTID=0x0000000A\n");

len += sprintf(buf+len,"PRODUCTID=0x0000000A\n");

−

After that you can 'make menuconfig' to add/remove kernel options as usual and build the kernel.

+

After that you can 'make ARCH=arm menuconfig' to add/remove kernel options as usual and build the kernel.

====Stock File System Modification====

====Stock File System Modification====

Line 110:

Line 111:

=== Prepare Mainline kernel source ===

=== Prepare Mainline kernel source ===

This describes how to prepare a vanilla kernel build.

This describes how to prepare a vanilla kernel build.

−

* Obtain the kernel sources, this can either be 2.6.25 or greater from [http://www.kernel.org kernel.org] or you can use the [http://git.marvell.com/?p=orion.git;a=summary Orion development repository]:

+

* Obtain the kernel sources, this can either be 2.6.25 or greater from [http://www.kernel.org kernel.org] or you can use the [http://git.marvell.com/?p=orion.git;a=summary Orion development repository]. Then change to your sources directory.

Note that the default Debian configuration for Orion 5x may not work with the intended NAS/device and therefore has to be changed to fit.<br>

+

On Linkstation Live v2 the debian config for kernel 2.6.26-2 does not work, resulting in reboot loop.<br>

+

A debian config for kernel 2.6.26-2 that works at least on Linkstation Live v2 is [http://buffalo.nas-central.org/download/Users/davy_gravy/ Davy Gravy]'s [http://downloads.buffalo.nas-central.org/Users/davy_gravy/kernelpackages/defconfig-2.6.26-debian-full-653modules defconfig-2.6.26-debian-full-653modules] (alternative link: [http://ftp.maddes.net/hardware/Linkstation/Debian_Lenny/ config-2.6.26-2-orion5x.freelink.davy_gravy]).

* Search the Packages file for the package "linux-image-orion5x", get the value from its "Depends" line, search that package and use its "Filename" value to download from a [http://www.debian.org/mirror/list Debian mirror].

+

* Searching the required information can be done manually. But to make this task less error-prone and easier, especially if done several times (e.g. new kernel), create the following script and make it executable: (Thanks to [http://www.linuxquestions.org/questions/linux-software-2/find-url-debian-package-index-via-awk-sed-%3Dfind-line-then-search-there-798146/ LinuxQuestions.org])

devio > foo 'wl 0xe3a01c0c,4' 'wl 0xe381108a,4' # Buffalo Terastation Duo (According to [http://forum.buffalo.nas-central.org/viewtopic.php?p=135747#p135747 the forum], this is the code to use, although it is defined as 0a80 at the site in the comments above)

Preparation

Toolchain (Compiler)

If compilation is done on the embedded device itself (or another device with the same architecture), then a native toolchain is sufficient.
But as embedded devices are not very powerful, this is normally not the case.

Compilation for the embedded device is normally done on a fast PC.
This is called "Cross Compiling".

When cross-compiling the architecture to build for and the prefix of the cross-compiler have to be stated when calling commands.
Typing can be reduced by exporting the environment variables ARCH and CROSS_COMPILE with the correct values.
All commands listed in this article will explicitly state these parameters.

How to Get GPL Build Kernel Run Under Linkstation Live Stock Environment

Before You Begin: You don't need the below patch if you don't use your custom build kernel with the Stock environment - especially ture while need to use together with the Stock initrd.buffalo. Product ID below only applicableto Linkstation Live, no need to modify if your box is Linkstation Pro.

In the current release GPL Kernel Soruce above, Buffalo did not provide any means to setup correct Product ID for Linkstation Live in the Makefile. Without the correct Product ID in kernel, Linkstation will enter EM Mode upon reboot. We have to patch one of the source file directly in order to get the kernel work with the Stock initrd and root filesystem.

Code Modification - buffalocore.c

Change directory to top of the source tree and modify buffalo/drivers/buffalocore.c like below:

Search and change the line
from:
len += sprintf(buf+len,"PRODUCTID=0x00000009\n");
to
len += sprintf(buf+len,"PRODUCTID=0x0000000A\n");

After that you can 'make ARCH=arm menuconfig' to add/remove kernel options as usual and build the kernel.

Stock File System Modification

When you reboot the Linkstation with the new build kernel it will enter EM Mode, use acp_commander to reset root password and enable telnet access. Logon to the Linkstation and enter:

grep BUILDDATE /proc/buffalo/firmware

Replace the above grep output line with the same line in /etc/linkstation_release and reboot. Your Linkstation should now resume to normal mode.

Mainline and Debian Kernel

About

jonli447 and lb_worm were trying to create a patch for the vanilla kernel [1] so we could use the kernel.org sources for the arm9-buffalo-boxes easily. But the guys from Marvell have done a great job in doing that so the nas-central community have stopped efforts in doing that to focus on helping with the Marvell's git. Marvell's code was merged into 2.6.25 with the latest development going into the Orion repository which has been merged into mainline.

At this time (12/21/2008) the kernel (2.6.28-rc9) supports:

Buffalo Terastation Pro II/Live

Buffalo Linkstation Pro/Live

Buffalo Linkstation Mini

Linksys WRT350N v2

Technologic Systems TS-78xx

LaCie Ethernet Disk mini V2

Maxtor Shared Storage II

Netgear WNR854T

Marvell Orion-VoIP GE Reference Design

Marvell Orion-VoIP FXO Reference Design

Marvell Orion-1-90 AP GE Reference Design

The Buffalo Linkstation Pro/Revogear Kurobox Pro support (MV88F5182)

The Marvell Orion-2 (MV88F5281) Development Board

The OrionNAS Reference Design board (MV88F5182)

The D-Link DNS-323 board (MV88F5181)

The QNAP TS109/209/409 boards (MV88F5182 & MV88F5281)

The HP Media Vault mv2120

Containing support for devices:

The NAND Flash controller

The SATA controller

The Ethernet controller

The USB controller

The PCI controller

The GPIO controller

The Serial Port controller

The I2C controller

XFS has had problems on arm for a long time. Two patches [2][3] have improved the situation but there is still one problem remaining [4].

The things that are not yet supported :

The CESA hardware engine is not yet supported (usefull for cryptographic and security operations)

The XOR hardware engine is not yet supported (usefull for iSCSI or RAID5 operations)

Extra:
To find out the 100% correct kernel binary package and version, and not just by browsing the download directory and using uname on another Debian system, a little more investigation has to be done:

Searching the required information can be done manually. But to make this task less error-prone and easier, especially if done several times (e.g. new kernel), create the following script and make it executable: (Thanks to LinuxQuestions.org)