Difference between revisions of "Buffalo ARM9 Kernel Port"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m (How to Get GPL Build Kernel Run Under Linkstation Live Stock Environment)
(Newer sources are located at a differend site; added Link to 3.3.4 sources.)
(36 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
{{Template:Articles|LSPro|LSLive|LS-WSGL/R1|Kernel|Development}}
 
{{Template:Articles|LSPro|LSLive|LS-WSGL/R1|Kernel|Development}}
 +
 +
== 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 [http://en.wikipedia.org/wiki/Cross_compiler "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.
 +
 +
There are several cross compiler for ARM available:
 +
* [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].
 +
* Gentoo users may [http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml?part=1 use ''sys-devel/crossdev''].
 +
 +
=== mkimage ===
 +
* Download [http://downloads.nas-central.org/LSPro_ARM9/DevelopmentTools/CrossToolchains/mkimage mkimage] to somewhere in your path.
 +
* Gentoo users may get it by emerging ''dev-embedded/u-boot-tools''
 +
* Debian has a package named uboot-mkimage.
 +
 +
=== devio ===
 +
* Ensure you have the devio command installed (''sys-block/devio'' in Gentoo and ''devio'' in Debian).
  
 
==Stock GPL Release Kernel==
 
==Stock GPL Release Kernel==
Line 5: Line 30:
 
  (CodeSourcery ARM 2005q3-2)) #69 Wed Oct 1 10:59:37 JST 2008
 
  (CodeSourcery ARM 2005q3-2)) #69 Wed Oct 1 10:59:37 JST 2008
  
Kernel ONLY Source available at [http://buffalo.jp/php/los.php?to=gpl/storage/ls-gl/110/linux-2.6.16_lsp.1.7.8.tar.gz linux-2.6.16_lsp.1.7.8.tar.gz]
+
Kernel ONLY Source available at [http://opensource.buffalo.jp/gpl_storage_link.html Buffalo's GPL Storage], e.g.[http://buffalo.jp/php/los.php?to=gpl/storage/ls-gl/110/linux-2.6.16_lsp.1.7.8.tar.gz linux-2.6.16_lsp.1.7.8.tar.gz]
 +
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:  
  '''You don't need the below patch if you don't use your custom'''
+
  '''You don't need the below patch if you don't use your custom build kernel with the Stock environment'''
'''build kernel with the Stock environment - especially together'''
+
  ''' - especially ture while need to use together with the Stock initrd.buffalo. Product ID below only applicable'''
  '''with the Stock initrd.buffalo. Product ID below only applicable'''
+
 
  '''to Linkstation Live, no need to modify if your box is Linkstation Pro.'''
 
  '''to 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 Makefile came with GPL release soruce. Without the correct Product ID, Linkstation will enter EM Mode upon reboot with the new build kernel. We have to patch one of the source file directly in order to get the kernel work with the Stock initrd and root filesystem.  
+
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====
 
====Code Modification - buffalocore.c====
 
Change directory to top of the source tree and modify buffalo/drivers/buffalocore.c like below:
 
Change directory to top of the source tree and modify buffalo/drivers/buffalocore.c like below:
Line 28: 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 36: Line 61:
 
Replace the above grep output line with the same line in /etc/linkstation_release and reboot.  Your Linkstation should now resume to normal mode.
 
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 Kernel ==
+
== Mainline and Debian Kernel ==
  
 
=== About ===
 
=== About ===
 
 
jonli447 and lb_worm were trying to create a patch for the vanilla kernel [http://buffalo.nas-central.org/index.php?title=Buffalo_ARM9_Kernel_Port&oldid=14667] 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.
 
jonli447 and lb_worm were trying to create a patch for the vanilla kernel [http://buffalo.nas-central.org/index.php?title=Buffalo_ARM9_Kernel_Port&oldid=14667] 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.
  
Line 85: Line 109:
 
Note: By using the kernels from svn/git, users are still subject to the [[BetaTesters|LinkstationWiki BetaTesters ToS and Disclaimer]]  (Not trying to scare people, just warning newbies).
 
Note: By using the kernels from svn/git, users are still subject to the [[BetaTesters|LinkstationWiki BetaTesters ToS and Disclaimer]]  (Not trying to scare people, just warning newbies).
  
=== Compilation & Installation Instructions ===
+
=== Prepare Mainline kernel source ===
* Install either a native or cross toolchain. Cross-compiling with the [http://www.codesourcery.com/gnu_toolchains/arm codesourcery] toolchain (2007q3) is reccomended. If your cross compile machine runs Debian, or similar, you can use the cross compilation toolchain repository supplied by [http://www.emdebian.org/tools/crosstools.html Emdebian]. Gentoo users may [http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml?part=1 use ''sys-devel/crossdev''].
+
This describes how to prepare a vanilla kernel build.
* Download [http://downloads.nas-central.org/LSPro_ARM9/DevelopmentTools/CrossToolchains/mkimage mkimage] to somewhere in your path. Gentoo users may get it by emerging ''dev-embedded/u-boot-tools'', Debian has a package named uboot-mkimage.
+
* 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.
* Ensure you have the devio command installed (''sys-block/devio'' in Gentoo).
+
<pre>wget -N http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.8.tar.gz
* 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]:
+
tar xzpvf linux-2.6.26.8.tar.gz
git clone git://git.marvell.com/orion.git
+
cd linux-2.6.26.8</pre>
* Change to your sources directory and create the kernel config:
+
<pre>git clone git://git.marvell.com/orion.git</pre>
make ARCH=arm orion5x_defconfig
+
* Create the kernel config:
* Run the following command to make any changes to the config file (including any ReiserFS or JFS support):
+
Note that the default kernel configuration for Orion 5x may not work with the intended NAS/device and therefore has to be changed to fit.
make ARCH=arm menuconfig
+
<pre>make ARCH=arm mrproper
 +
make ARCH=arm orion5x_defconfig</pre>
 +
 
 +
=== Prepare Debian kernel source ===
 +
This describes how to prepare a Debian kernel build.
 +
If more Debian-related information is needed, please refer to the [http://kernel-handbook.alioth.debian.org/ Debian Linux Kernel Handbook], e.g. [http://kernel-handbook.alioth.debian.org/ch-common-tasks.html sections 4.1 and 4.5].
 +
* Find out what kernel version is currently used by Debian.
 +
<pre>uname -a
 +
Linux debian5 2.6.26-2-686 #1 SMP Tue Mar 9 17:35:51 UTC 2010 i686 GNU/Linux</pre>
 +
Here it is version 2.6.26 on a Debian 5.0 Lenny system.
 +
* Install the corresponding Debian kernel source package.
 +
<pre>aptitude install linux-source-2.6.26</pre>
 +
The source archive will be placed in /usr/src.
 +
* Extract the source into the build directory (normally current directory).
 +
<pre>tar xjf /usr/src/linux-source-2.6.26.tar.bz2</pre>
 +
It will be available in the sub-directory ./linux-source-2.6.26.
 +
* Just like with a mainline (or vanilla) kernel you may use the kernel default config for Orion.
 +
Note that the default mainline/vanilla configuration for Orion 5x is just a very rough base config to start with, and will probably  not work with the intended NAS/device.<br>
 +
<pre>make ARCH=arm orion5x_defconfig</pre>
 +
* At this point this is the same as for the Mainline kernel, except for the included Debian patches.
 +
* Additionally the config used by the Debian team for their official kernel is available in the kernel binary package.
 +
The kernel package for the ARM architecture can be downloaded to and extracted on any system.
 +
<pre>wget -N http://http.us.debian.org/debian/pool/main/l/linux-2.6/linux-image-2.6.26-2-orion5x_2.6.26-21_armel.deb
 +
dpkg-deb -x linux-image-2.6.26-2-orion5x_2.6.26-21_armel.deb linux-image-2.6.26-2-orion5x</pre>
 +
The config is available in the sub-directory ./linux-image-2.6.26-2-orion5x/boot.
 +
Note that this is just a base config to build on.<br>
 +
There's a list of other [http://www.debian.org/mirror/list Debian mirrors] available.
 +
* Clean the build directory and copy the Debian config.
 +
<pre>cd linux-source-2.6.26
 +
make ARCH=arm mrproper
 +
cp ../linux-image-2.6.26-2-orion5x/boot/config-2.6.26-2-orion5x .config</pre>
 +
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]).
 +
 
 +
 
 +
<u>Extra:</u>
 +
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:
 +
* Download the package list for ARM and extract it.
 +
<pre>wget -N http://http.us.debian.org/debian/dists/lenny/main/binary-armel/Packages.bz2
 +
bunzip Packages.bz2</pre>
 +
* 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])
 +
<pre>nano get_debian_package_detail.sh</pre>
 +
<pre>#!/bin/bash
 +
 
 +
sed -n '
 +
'/"Package: $1"/' {
 +
        x
 +
        d
 +
}
 +
 
 +
'/"Package: $1"/' !{
 +
        H
 +
}
 +
 
 +
'/"$2"/' {
 +
        H
 +
        x
 +
        '/"Package: $1"/' {
 +
                s/\(.*\)\('"$2"'\)\(.*\)/\3/
 +
                p
 +
                d
 +
        }
 +
}' ${3:+"$3"}</pre>
 +
<pre>chmod +x get_debian_package_detail.sh</pre>
 +
* With the help of the script search the Packages file for the package "linux-image-orion5x" and get the value from its "Depends:" line.
 +
<pre>./get_debian_package_detail.sh 'linux-image-orion5x' 'Depends: ' Packages
 +
 
 +
> linux-image-2.6.26-2-orion5x</pre>
 +
* Then search that above found package and use its "Filename:" value to download from a [http://www.debian.org/mirror/list Debian mirror].
 +
<pre>./get_debian_package_detail.sh 'linux-image-2.6.26-2-orion5x' 'Filename: ' Packages
 +
 
 +
> pool/main/l/linux-2.6/linux-image-2.6.26-2-orion5x_2.6.26-21_armel.deb</pre>
 +
 
 +
== Compilation ==
 +
 
 +
=== Compile Kernel (zImage) ===
 +
* Run the following command to make any changes to the config file (including any ReiserFS or JFS support).
 +
Setting the Local Version under General Version with a recognizable string is recommended (e.g. -freelink-<your nick>).
 +
<pre>make ARCH=arm menuconfig</pre>
 +
For more information see the [[Talk:Buffalo_ARM9_Kernel_Port | discussion page]].
 
* Run
 
* Run
 
  make ARCH=arm CROSS_COMPILE=/path/to/toolchain/bin/arm-none-linux-gnueabi- zImage
 
  make ARCH=arm CROSS_COMPILE=/path/to/toolchain/bin/arm-none-linux-gnueabi- zImage
* After kernel is finished compiling, you need to force it to use the correct mach-type for your device:
+
 
 +
=== Prepare zImage for embedded device ===
 +
* After kernel has finished compiling, you need to force it to use the correct mach-type for your device:
 
  # The version number at the end of each line is the kernel version that first
 
  # The version number at the end of each line is the kernel version that first
 
  # supported that device. Run only the line that corresponds to your device.
 
  # supported that device. Run only the line that corresponds to your device.
 
  # This will set the machine type of the kernel, which cannot be autodetected.
 
  # This will set the machine type of the kernel, which cannot be autodetected.
 
  # Last 2 characters of wl-command form the machine types. So '0631' for the Linkstation Pro.
 
  # Last 2 characters of wl-command form the machine types. So '0631' for the Linkstation Pro.
 +
# Hex 0631 = decimal 1585, the decimal value of the machine number as listed at http://www.arm.linux.org.uk/developer/machines/
 +
# Note that you can get your machine type from [http://www.arm.linux.org.uk/developer/machines/ here], or register it if it isn't already there
 
  devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811031,4' # Linkstation Pro/Live (2.6.26)
 
  devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811031,4' # Linkstation Pro/Live (2.6.26)
 
  devio > foo 'wl 0xe3a01c05,4' 'wl 0xe38110e5,4' # Kurobox Pro (2.6.25)
 
  devio > foo 'wl 0xe3a01c05,4' 'wl 0xe38110e5,4' # Kurobox Pro (2.6.25)
Line 111: Line 219:
 
  devio > foo 'wl 0xe3a01c06,4' 'wl 0xe38110e6,4' # Maxtor Shared Storage II (2.6.27)
 
  devio > foo 'wl 0xe3a01c06,4' 'wl 0xe38110e6,4' # Maxtor Shared Storage II (2.6.27)
 
  devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811061,4' # Linksys WRT350N v2 (2.6.27?)
 
  devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811061,4' # Linksys WRT350N v2 (2.6.27?)
  devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811027,4' # [http://www.arm.linux.org.uk/developer/machines/?action=list&id=1831 Buffalo Linkstation Pro Duo] (Is this right?)
+
  devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811027,4' # [http://www.arm.linux.org.uk/developer/machines/?action=list&id=1831 Buffalo Linkstation Pro Duo]
 
  devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811042,4' # [http://www.arm.linux.org.uk/developer/machines/?action=list&id=1858 Buffalo Linkstation Mini]
 
  devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811042,4' # [http://www.arm.linux.org.uk/developer/machines/?action=list&id=1858 Buffalo Linkstation Mini]
  devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811030,4' # Buffalo TS Pro V2 (not yet supported in Vanilla 2.6.26 as of Aug. 10th, 2008)
+
  devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811030,4' # Buffalo TS Pro V2 AND TS Live (not yet supported in Vanilla 2.6.26 as of Aug. 10th, 2008)
 
  devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811065,4' # Netronix NH-233
 
  devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811065,4' # Netronix NH-233
 +
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)
 +
devio > foo 'wl 0xe3a01c10,4' 'wl 0xe381108e,4' # Buffalo Linkstation Quad LSQL. Registered 2012.06.15. 
 +
 
   
 
   
 
  # Run all of the following:
 
  # Run all of the following:
Line 121: Line 232:
 
  rm foo zImage.new
 
  rm foo zImage.new
 
* The new uImage will be called uImage.new, copy this to its destination. For a Linkstation/Kuro this is the /boot/uImage.buffalo.
 
* The new uImage will be called uImage.new, copy this to its destination. For a Linkstation/Kuro this is the /boot/uImage.buffalo.
 +
 +
=== Modules ===
 
* If necessary, compile modules and be sure if you are cross compiling not to set the install path to the hosts root:
 
* If necessary, compile modules and be sure if you are cross compiling not to set the install path to the hosts root:
 
  make ARCH=arm CROSS_COMPILE=/path/to/toolchain/bin/arm-none-linux-gnueabi- modules
 
  make ARCH=arm CROSS_COMPILE=/path/to/toolchain/bin/arm-none-linux-gnueabi- modules
  make ARCH=arm CROSS_COMPILE=/path/to/toolchain/bin/arm-none-linux-gnueabi- modules_install INSTALL_MOD_PATH=/<absolute/dir/loc/not/root/dir>
+
  make ARCH=arm CROSS_COMPILE=/path/to/toolchain/bin/arm-none-linux-gnueabi- modules_install INSTALL_MOD_PATH=/absolute/dir/loc/not/root/dir>
 
* copy lib/ directory that is created to / of linkstation
 
* copy lib/ directory that is created to / of linkstation
 +
 +
== Links ==
 +
* [[HowTo Build Your Own Custom Kernel]]
 +
* [[How to Extract an uImage]]

Revision as of 08:12, 15 November 2013


Contents

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.

There are several cross compiler for ARM available:

mkimage

  • Download mkimage to somewhere in your path.
  • Gentoo users may get it by emerging dev-embedded/u-boot-tools
  • Debian has a package named uboot-mkimage.

devio

  • Ensure you have the devio command installed (sys-block/devio in Gentoo and devio in Debian).

Stock GPL Release Kernel

Linux version 2.6.16.16-arm1 (root@I.You) (gcc version 3.4.4 (release) 
(CodeSourcery ARM 2005q3-2)) #69 Wed Oct 1 10:59:37 JST 2008

Kernel ONLY Source available at Buffalo's GPL Storage, e.g.linux-2.6.16_lsp.1.7.8.tar.gz or linux-2.6.22_lsp.3.0.5.tgz or linux-3.3.4.tar.gz

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 applicable
to 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,"PRODUCTNAME=LS-GL(IESADA)\n");
   to:
         len += sprintf(buf+len,"PRODUCTNAME=HS-DHGL(JINMU)\n");
   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)
  • OABI rootfs & applications when using a 88F5281-D0 (other SoC are OK)

If you want to talk about this kernel, please do it here

Note: By using the kernels from svn/git, users are still subject to the LinkstationWiki BetaTesters ToS and Disclaimer (Not trying to scare people, just warning newbies).

Prepare Mainline kernel source

This describes how to prepare a vanilla kernel build.

wget -N http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.8.tar.gz
tar xzpvf linux-2.6.26.8.tar.gz
cd linux-2.6.26.8
git clone git://git.marvell.com/orion.git
  • Create the kernel config:

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

make ARCH=arm mrproper
make ARCH=arm orion5x_defconfig

Prepare Debian kernel source

This describes how to prepare a Debian kernel build. If more Debian-related information is needed, please refer to the Debian Linux Kernel Handbook, e.g. sections 4.1 and 4.5.

  • Find out what kernel version is currently used by Debian.
uname -a
 Linux debian5 2.6.26-2-686 #1 SMP Tue Mar 9 17:35:51 UTC 2010 i686 GNU/Linux

Here it is version 2.6.26 on a Debian 5.0 Lenny system.

  • Install the corresponding Debian kernel source package.
aptitude install linux-source-2.6.26

The source archive will be placed in /usr/src.

  • Extract the source into the build directory (normally current directory).
tar xjf /usr/src/linux-source-2.6.26.tar.bz2

It will be available in the sub-directory ./linux-source-2.6.26.

  • Just like with a mainline (or vanilla) kernel you may use the kernel default config for Orion.

Note that the default mainline/vanilla configuration for Orion 5x is just a very rough base config to start with, and will probably not work with the intended NAS/device.

make ARCH=arm orion5x_defconfig
  • At this point this is the same as for the Mainline kernel, except for the included Debian patches.
  • Additionally the config used by the Debian team for their official kernel is available in the kernel binary package.

The kernel package for the ARM architecture can be downloaded to and extracted on any system.

wget -N http://http.us.debian.org/debian/pool/main/l/linux-2.6/linux-image-2.6.26-2-orion5x_2.6.26-21_armel.deb
dpkg-deb -x linux-image-2.6.26-2-orion5x_2.6.26-21_armel.deb linux-image-2.6.26-2-orion5x

The config is available in the sub-directory ./linux-image-2.6.26-2-orion5x/boot. Note that this is just a base config to build on.
There's a list of other Debian mirrors available.

  • Clean the build directory and copy the Debian config.
cd linux-source-2.6.26
make ARCH=arm mrproper
cp ../linux-image-2.6.26-2-orion5x/boot/config-2.6.26-2-orion5x .config

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.
On Linkstation Live v2 the debian config for kernel 2.6.26-2 does not work, resulting in reboot loop.
A debian config for kernel 2.6.26-2 that works at least on Linkstation Live v2 is Davy Gravy's defconfig-2.6.26-debian-full-653modules (alternative link: config-2.6.26-2-orion5x.freelink.davy_gravy).


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:

  • Download the package list for ARM and extract it.
wget -N http://http.us.debian.org/debian/dists/lenny/main/binary-armel/Packages.bz2
bunzip Packages.bz2
  • 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)
nano get_debian_package_detail.sh
#!/bin/bash

sed -n '
'/"Package: $1"/' {
        x
        d
}

'/"Package: $1"/' !{
        H
}

'/"$2"/' {
        H
        x
        '/"Package: $1"/' {
                s/\(.*\)\('"$2"'\)\(.*\)/\3/
                p
                d
        }
}' ${3:+"$3"}
chmod +x get_debian_package_detail.sh
  • With the help of the script search the Packages file for the package "linux-image-orion5x" and get the value from its "Depends:" line.
./get_debian_package_detail.sh 'linux-image-orion5x' 'Depends: ' Packages

> linux-image-2.6.26-2-orion5x
  • Then search that above found package and use its "Filename:" value to download from a Debian mirror.
./get_debian_package_detail.sh 'linux-image-2.6.26-2-orion5x' 'Filename: ' Packages

> pool/main/l/linux-2.6/linux-image-2.6.26-2-orion5x_2.6.26-21_armel.deb

Compilation

Compile Kernel (zImage)

  • Run the following command to make any changes to the config file (including any ReiserFS or JFS support).

Setting the Local Version under General Version with a recognizable string is recommended (e.g. -freelink-<your nick>).

make ARCH=arm menuconfig

For more information see the discussion page.

  • Run
make ARCH=arm CROSS_COMPILE=/path/to/toolchain/bin/arm-none-linux-gnueabi- zImage

Prepare zImage for embedded device

  • After kernel has finished compiling, you need to force it to use the correct mach-type for your device:
# The version number at the end of each line is the kernel version that first
# supported that device. Run only the line that corresponds to your device.
# This will set the machine type of the kernel, which cannot be autodetected.
# Last 2 characters of wl-command form the machine types. So '0631' for the Linkstation Pro.
# Hex 0631 = decimal 1585, the decimal value of the machine number as listed at http://www.arm.linux.org.uk/developer/machines/
# Note that you can get your machine type from here, or register it if it isn't already there
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811031,4' # Linkstation Pro/Live (2.6.26)
devio > foo 'wl 0xe3a01c05,4' 'wl 0xe38110e5,4' # Kurobox Pro (2.6.25)
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe381101d,4' # QNAP TS-109/TS-209 (2.6.25)
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811041,4' # QNAP TS-409 (2.6.27?)
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811006,4' # D-Link DNS-323 (2.6.25)
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe381109d,4' # HP Media Vault MV2120 (2.6.27?)
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811074,4' # Technologic Systems TS-78xx SBC (2.6.27?)
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe38110e6,4' # Maxtor Shared Storage II (2.6.27)
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811061,4' # Linksys WRT350N v2 (2.6.27?)
devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811027,4' # Buffalo Linkstation Pro Duo
devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811042,4' # Buffalo Linkstation Mini
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811030,4' # Buffalo TS Pro V2 AND TS Live (not yet supported in Vanilla 2.6.26 as of Aug. 10th, 2008)
devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811065,4' # Netronix NH-233
devio > foo 'wl 0xe3a01c0c,4' 'wl 0xe381108a,4' # Buffalo Terastation Duo (According to the forum, this is the code to use, although it is defined as 0a80 at the site in the comments above)
devio > foo 'wl 0xe3a01c10,4' 'wl 0xe381108e,4' # Buffalo Linkstation Quad LSQL. Registered 2012.06.15.  


# Run all of the following:
cat foo arch/arm/boot/zImage > zImage.new
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n 'linux' -d zImage.new uImage.new
rm foo zImage.new
  • The new uImage will be called uImage.new, copy this to its destination. For a Linkstation/Kuro this is the /boot/uImage.buffalo.

Modules

  • If necessary, compile modules and be sure if you are cross compiling not to set the install path to the hosts root:
make ARCH=arm CROSS_COMPILE=/path/to/toolchain/bin/arm-none-linux-gnueabi- modules
make ARCH=arm CROSS_COMPILE=/path/to/toolchain/bin/arm-none-linux-gnueabi- modules_install INSTALL_MOD_PATH=/absolute/dir/loc/not/root/dir>
  • copy lib/ directory that is created to / of linkstation

Links