Debian Squeeze on LS-CHLv2

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 12:30, 19 January 2012 by Threecoloursred (Talk | contribs)

Jump to: navigation, search

This guide will explain how to install Debian GNU/Linux "Squeeze" on the LinkStation™ LS-CHLv2 using the Debian "debootstrap" procedure to generate a hybrid system still using the original Buffalo kernel, then complete the process by generating a true Debian Squeeze kernel to replace the Buffalo one. The original kernel will be preserved, as well as the original bootloader (U-Boot).

This document is largely based on material from Debian Lenny on LS-WXL with a sprinkling of stuff from elsewhere including Debian_Squeeze_on_'V'_and_'X'_Series_(LS-WXL_and_others); you may find these other pages help clarify steps here if you get stuck. These other Linkstation models are close relatives of the LS-CHLv2, so their instructions are very similar.

After my success in getting Squeeze on the LS-CHLv2 I found Debian Squeeze on LS-WXL which looks to be based on the above Lenny document; I don't know which is more complete, nor whether Debian Squeeze on LS-WXL makes this document rather redundant - you may wish to use the forums to tell others which guide(s) you use and how successful they are.

Contents

Summary of main steps

  • get command-line [root] access to the Linkstation (telnet or ssh)
  • create a Debian system with debootstrap
  • replace the initrd on the boot partition with a dummy one
  • replace the old filesystem with a new Debian system.
  • boot into this new system which will have a Debian system but still using the Buffalo kernel+modules
  • build a new kernel+ modules
  • replace the Buffalo kernel & modules

Requirements, Background info, Warnings

Note that I dismantled my Linkstation so I could connect the hard drive to my [Linux] PC - this made it easier to deal with replacing filesystems etc. - in particular I didn't need to bother creating custom initrd files (tricky); re-reading the source documents mentioned above (esp. re. Lenny) it is possible to achieve a Squeeze installation without dismantling the device, but I wouldn't count on it: This guide is relatively complex and even if you try to avoid it, there's a fair chance you'll need to dismantle the Linkstation to access the drive like this anyway - perhaps to complete a step described here, perhaps to recover from a step that went wrong. Dismantling the device does of course void your warranty and could break your device, lose your data etc. If dismantling the device worries you, I recommend not following this guide.

I strongly suggest that you should be comfortable with Linux and working at its command-line before attempting to use this guide - including being able to create or edit a file with vi or nano. You should also be comfortable with taking apart your Linkstation to access the hard disk and connect it directly to your PC. If you're not comfortable with using Linux like this then there's a fair chance you'll brick (destroy) your Linkstation, and you'll also end up with a device that lacks most of the functionality you started with - so please only try this if you know why you'd want to install Debian in the first place, and if you know how to install packages etc to achieve your goals on it once you've finished.

This guide will ask you to reformat partitions, delete existing data, etc. All of these actions may void your warranty, destroy your data and risk other bad consequences etc. In general you can receive help from the community or from the Buffalo forums but bear in mind that every problem you may encounter is ultimately up to you to solve. You do it at your own risk.

At present, the resulting Debian Squeeze installation results in the fan running at full speed - I've not yet tried working with blstools etc to see if I can tweak this to make it less noisy (it makes a lot of noise at full speed).

I'm not a kernel hacker, so writing this guide took me out of my comfort zone. Some of the steps here may in fact be unnecessary incantations - but I don't want to go back and start it all from scratch to check. Hopefully others (you?) will update this wiki page to remove or cross out unnecessary steps. Given that this was a learning experience for me too I've added explanations of what's going on in a number of steps which may be helpful for some, annoyingly verbose for others.

Key Linkstation LS-CHLv2 features/quirks

uBoot

Unlike PC-based Linux, the Linkstation uses a system called uBoot for startup. This has its own way of doing things; on this wiki and in the forums people have discovered some of its Linkstation-specific features & quirks. A particularly useful quirk is that an empty initrd in /boot causes the device to boot from the root partition: This is much easier to manipulate than generating an initrd for the device and this is used as a handy trick in the instructions below. The other thing to be aware of is that files for uBoot require special headers for them to be usable: The instructions below include the steps to generate these.

GPT / GUID partitioning

The device uses the GUID / GID approach to disk partitioning. Therefore tools like Linux's fdisk won't be able to manipulate the disk. Other tools like parted can however make sense of it. You need to stick to using this partitioning method because that's what the firmware will expect. The major advantage of this approach is that it allows use of larger hard disks that wouldn't be usable with the old MBR approach. I'm reasonably happy with Buffalo's default partitioning scheme: Both ext3 (for boot and root filesystems) and xfs (for the data area) are tried and tested filesystem implementations, so I see no need to alter their types. You could potentially adjust partition sizes, but I think Buffalo's chosen good sizes already. The one thing I do change is to mount the data partition as /home, which is more intuitive from a Linux perspective than /mnt/disk1.

Hardware

Described elsewhere on the wiki in more detail, but key features are: ARM Kirkwood processor, 64 MByte RAM, 2 ethernet ports (only one installed), serial port (not enabled), indicator LED blue/red switchable; front function button, rear on/auto/off switch. Time is not stored between reboots, so ntpd is helpful to keep the time.

Memory

Although the device has 64MByte of memory, by the time Debian gets to see it, there's only 50 MByte. I think this is due to the firmware / uBoot setting aside some memory that it doesn't give back, and some will be reserved for hardware I/O stuff. It may be possible to adjust the uBoot setup to reduce the amount of memory it grabs. Given that Debian states 64MByte as a minimum memory requirement, only having 50 MByte is frustrating.

I've found that using the ramdisk memory for /tmp by mounting it as tmpfs is unreliable (at least in debootstrap-derived Debian mode; poss. not once you've completed this guide and have pure Debian), leading to memory errors for big tasks (like the step to apt-get the kernel sources). I understand tmpfs to merge the ramdisk with any available swap space and to 'do the right thing'. Given the memory errors encountered, I feel it's safer just to use swap space as needed, not merged with the ramdisk, and to have /tmp as just an ordinary directory in the root filesystem (or you may prefer to alter /tmp to live on the larger data partition instead). Also given the above limited memory to start with, it seems pointless to squander it on a ramdisk - I'd rather give it all to the kernel so it doesn't get stuck.

micro_evtd

The Lenny-on-LS-WXL document said this which probably applies to the LS-CHLv2 too:

  • Please note that the Armel Debian "micro_evtd" package will NOT work on LS-WXL because of different hardware.

This refers to the "Event Timer Daemon" [1] but that seems to be specific to PowerPC-based Linkstations, so it's not relevant to the LS-CHLv2 which is ARM-based.

blstools

This guide suggests to install blstools, a small set of utilities developed for this hardware to enable some operations which would not be possible from a plain Debian install:

  • turn the unit off from the on-off-auto switch
  • turn unit blinking LEDs to still blue when boot is complete
  • resume blinking when the unit is shutting down
  • use the USB port

Preliminary steps

Obtain root access to the linkstation

You need to get telnet and/or ssh access to your Linkstation. My preference is ssh, and I felt most comfortable taking apart the Linkstation to achieve this; my guide to this is here; it mentions other possibilities there, or you may have success with guides like these: Open_Stock_Firmware_LS-WXL, [[2]] or this guide to SSH as root to the LS (I've not checked if these work for the LS-CHLv2; there may be alternative versions of these instructions for the LS-CHLv2 elsewhere on this wiki; I've also provided some possible alternative links in my guide.

Backup the LS

If you have any important data on the LS you definitely need to make a backup.

Even if you don't, you'd better take a snapshot of the vital disk partitions (first and second partition). So you will be able to easily revert to the original stock distribution. One approach is in [forum post]; alternatively if you have got ssh access to the Linkstation you can use Clonezilla to make a space-efficient backup of it; or for a further alternative, if you dismantle your Linkstation for ssh setup you can rsync etc. the partitions then (and separately backup data not in partitions like the MBR area) - that's covered in the ssh guide mentioned above. An rsync-style backup of the boot and root partitions is particularly handy to refer back to after converting your Linkstation to Debian, particularly if you find yourself tweaking the device further; it also makes it easier to revert the Linkstation to its stock setup which could be necessary - if only temporarily - if you wish to mess around with the firmware or uBoot stuff.

Prepare a Debian root filesystem

Debootstrap

This is derived from original debootstrap docs.

Login to the Linkstation with ssh or telnet as root.

Enable the 'ar' utility, assuming it doesn't already exist: This functionality can be provided by Busybox, already installed by Buffalo:

ln -si /bin/busybox /usr/bin/ar

We'll start by setting up a basic Debian system on the Linkstation. This will give you a half-way-house Debian installation: The kernel and associated modules will still be the original Buffalo kernel & modules. We'll come back to the kernel/modules issue later, to replace them with Squeeze. First though, let's setup our half-way-house Debian with debootstrap. Find your local debootstrap download link here and download and install accordingly. We'll work in a new directory for this purpose. E.g. for the UK,

cd /root
mkdir workarea
cd workarea
wget http://ftp.uk.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.26+squeeze1_all.deb
dpkg -i debootstrap_1.0.26+squeeze1_all.deb

Now to setup our half-way-house root filesystem we use debootstrap. You'll need to give debootstrap the address of your local Debian mirror site which you can find at http://www.debian.org/mirror/list. I've used the UK mirror in the example below,

mkdir debian-squeeze
debootstrap --verbose --arch armel squeeze debian-squeeze http://ftp.uk.debian.org/debian/

Now go for a coffee / beer / siesta – this step takes about 20 minutes to complete and doesn't require user input. It finishes with,

I: Base system installed successfully.

We'll chroot into the debian-squeeze directory soon where we'll finish creating the new filesystem to replace the existing one. First though we'll need a copy of Buffalo's initrd image so we can extract needed files from it to keep the Buffalo kernel happy when it boots into the new half-way-house system. You may also like to take a look FYI at /etc/fstab & /etc/mtab which will form the basis of /etc/fstab on the new system,

cp -p /boot/initrd.buffalo debian-squeeze/tmp
cat /etc/fstab
cat /etc/mtab

Work in the new root filesystem by using chroot

We use chroot to work in the new filesystem as if it's the only thing that exists: The surrounding old Buffalo filesystem will be invisible to us whilst in the chroot; reference to "/" will in fact map to the debian-squeeze directory. Some of the steps during chroot could potentially be moved to later when we reboot the Linkstation to use the new root filesystem but I think it's better to do most of the steps now since some of them make the system easier to use later, and they need to be done at some point anyway.

chroot into the debian-squeeze directory,

LANG=C chroot debian-squeeze /bin/bash

We're now in the chroot (debian-squeeze) directory, but since we're in a chroot it will appear to be the root (/) directory.

In chroot: extract modules used by Buffalo kernel for use by the new system

Unpack initrd.buffalo. This is in uImage format, meaning that it has a 64-byte header that can be discarded. The remainder is an initrd in gzipped form,

cd /tmp
dd if=initrd.buffalo of=initrd.gz ibs=64 skip=1
gunzip initrd.gz

Now extract the modules from Buffalo's initrd image to match the Buffalo kernel; we'll put these in /lib/modules, which is where the kernel will expect to find them. Note that on my system I found 2 different modules directories: 2.6.31.8 and an older 2.6.22.7-88f5182. I think the older one is redundant - I certainly didn't bother to copy it across and the Squeeze installation was successful - so it should be sufficient to just copy across the newer modules directory - which will be 2.6.31.8 if you're using the same firmware release as me, v1.56. Also FYI I omitted the MAKEDEV step mentioned in the predecessor LS-WXL document, since I believe it's no longer necessary with Debian Squeeze:

mkdir INITRD
mount -t ext2 -o loop initrd INITRD
cp -pR INITRD/lib/modules/2.6.31.8 /lib/modules/
umount INITRD
rmdir INITRD
rm initrd*
cd /

In chroot: Setup /etc/fstab

Create /etc/fstab for the new filesystem to read as follows:

# /etc/fstab: static file system information.
#
# file system  mount point   type    options             dump pass
/dev/sda1      /boot         ext3    nosuid,nodev        0    2
/dev/sda2      /             xfs     defaults            0    1
/dev/sda5      none          swap    sw                  0    0
/dev/sda6      /home         xfs     defaults            0    2
proc           /proc         proc    defaults            0    0
devpts         /dev/pts      devpts  gid=4,mode=620      0    0
#tmpfs          /tmp          tmpfs   defaults            0    0
sysfs          /sys          sysfs   defaults            0    0

Esp. note /tmp commented out to avoid memory errors (esp. in hybrid setup, maybe okay once system fully converted), /boot mounted read-write - you can change it back to read-only later, and /dev/sda6 mounted as /home rather than /mnt/disk1. If however you prefer to stick to the Buffalo layout with the data area at /mnt/disk1 then adjust the fstab above (replace /home with /mnt/disk1) and create the mount point,

mkdir /mnt/disk1

In chroot: Localisation

Setup locales, at least the en_US.UTF-8 and your native language locale (e.g. it_IT.UTF-8, de_DE.UTF-8, etc),

apt-get install locales
dpkg-reconfigure locales

In chroot: NTP & timezone

Setup NTP & the timezone for the new system,

apt-get install ntp
dpkg-reconfigure tzdata

In chroot: Ethernet interface setup

Setup network interface (the board actually has 2 Ethernet interfaces as well as the loopback interface - one of the Ethernet interfaces eth0 is not connected / soldered on the board but is still 'seen' by Linux as a device. No point in trying to set it up though since it's not connected. Assuming you want its IP address info from DHCP, create /etc/network/interfaces as follows,

# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

# We always want the loopback interface.
auto lo
iface lo inet loopback

# On the LS-CHLv2 only eth1 has an RJ45 socket
auto eth1
iface eth1 inet dhcp

or if you prefer having a static IP address (adjust IP values for your network),

# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

# We always want the loopback interface.
auto lo
iface lo inet loopback

# On the LS-CHLv2 only eth1 has an RJ45 socket
auto eth1
iface eth1 inet static
      address 192.168.0.42
      network 192.168.0.0
      netmask 255.255.255.0
      broadcast 192.168.0.255
      gateway 192.168.0.1

In chroot: hostname

Create /etc/hostname,

echo yourlinkstationname > /etc/hostname

Edit /etc/hosts: Add yourlinkstationname to the 127.0.0.1 line,

127.0.0.1	localhost yourlinkstationname

In chroot: /etc/apt/sources.list setup

Apt will complain about packages without verification if this step is not performed.

Create /etc/apt/sources.list. Easiest is to visit [3] to generate a suitable file then cut and paste it to /etc/apt/sources.list - here's mine FYI,

#############################################################
################### OFFICIAL DEBIAN REPOS ###################
#############################################################

###### Debian Main Repos
deb http://ftp.uk.debian.org/debian/ squeeze main contrib non-free 
deb-src http://ftp.uk.debian.org/debian/ squeeze main contrib non-free 

###### Debian Update Repos
deb http://security.debian.org/ squeeze/updates main contrib non-free 
deb http://ftp.uk.debian.org/debian/ squeeze-proposed-updates main contrib non-free 
deb-src http://security.debian.org/ squeeze/updates main contrib non-free 
deb-src http://ftp.uk.debian.org/debian/ squeeze-proposed-updates main contrib non-free 

In chroot: Perform an update

apt-get update

The final upgrade step can be performed later once the installation is finished.

In chroot: Install sshd

You will need to be able to access your new system once you start it up. Do so using ssh. You'll need sshd, the SSH server for that:

apt-get install openssh-server

If you wish to use password authentication set a root password,

passwd

Edit /etc/ssh/sshd_config and make sure that the following line is present and uncommented:

PermitRootLogin yes

If you wish to use keypair authentication make sure that the following 2 lines are present and uncommented in /etc/ssh/sshd_config:

RSAAuthentication yes
PubkeyAuthentication yes

and also setup .ssh for root (your keys file will be copied in after we've left the chroot):

mkdir /root/.ssh
chmod go-rwx /root/.ssh

In chroot: Turn on bootlogging

Create/edit /etc/default/bootlogd,

BOOTLOGD_ENABLE=yes

In chroot: Cleanup

Clean up the installation

aptitude clean

Leave chroot

We've now done most of the setup of the new filesystem, although a couple of tasks still remain. We need to exit chroot to do those,

exit

Completing the new root filesystem

ssh keypair authentication

If you're using SSH keypair authentication you need to copy root's ssh public keys into the new filesystem,

cp -p /root/.ssh/authorized_keys debian-squeeze/root/.ssh

Necessary Buffalo Incantations

You're making significant changes to the device. It may not like that and decide to sulk (= not reboot successfully). I've found having the following files in /etc (poss. also in /boot, we'll do that later) are helpful to keep things sweet,

cp -p /etc/hddrootmode debian-squeeze/etc
cp -p /etc/linkstation_release debian-squeeze/etc
cp -p /etc/rootfs_ok debian-squeeze/etc

Zip it up

We're done with the new filesystem. tar & gzip it,

cd debian-squeeze
tar --numeric-owner -p -czf ../squeeze-armel-rootfs.tgz *
cd ..

which will leave squeeze-armel-rootfs.tgz in /root/workarea. It'll take a long time (about 15 minutes), so this is a good opportunity to get a cup of tea etc., and/or do the next stop on your PC

Create an empty (dummy) initrd image

This is a useful cheat from Debian_Lenny_on_LS-CHLv2#Installing_an_empty_initrd to avoid a complex process of building custom initrd images, although you will need to open up the Linkstation to access the disk (later). The stock initrd needs to be replaced with something, otherwise the Linkstation will sulk (not [re]boot etc), but the kernel (stock or the Debian kernel we'll install later) doesn't actually need an full initrd image to boot successfully (with the possible proviso of needing an fsck).

"empty initrd" means an initrd with no filesystem. It is not an empty file.

For this you need the mkimage command. I completed this step on my Linux PC; it will probably work on the Linkstation too within the chroot.

Install the uboot-mkimage package: On a Debian/Ubuntu PC or in chroot on Linkstation,

apt-get install uboot-mkimage

or on a RedHat/CentOS etc PC,

yum install uboot-mkimage

then

mkdir initrd.work.area
cd initrd.work.area
mkdir empty
cd empty
find . | cpio -o -H newc > ../empty.cpio
cd ..
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -d empty.cpio initrd.buffalo.empty
rmdir empty
rm -f empty.cpio

we'll use the file initrd.buffalo.empty later; remember where it is for now.

Installing the new root filesystem & initrd image

Before proceeding, please double-check that you have a reliable backups of the Linkstation's boot and root partitions, and know how you would use these to restore the Linkstation to its original state if something goes wrong.

You could go to the trouble of building 2 separate (but very similar) custom initrd images to shoehorn into the new system without opening the case. You'd do this by adapting the instructions on this in Debian Lenny on LS-WXL, but it would be very tricky.

Much simpler I feel is to use the null initrd image just created to force use of /dev/sda2 as the root partition. To install the new root partition however you will need to take out the disk from the Linkstation and connect it to your PC

Take out the hard disk from the Linkstation

You need to take apart the Linkstation to remove the hard disk. Instructions for this are given here [4] (it's in Japanese, but just looking at the photos you can probably work out what to do - basically remove the 2 labels on the bottom of the device to reveal plastic tabs. Depress these and you should be able to pull the 2 sides apart). There's also a YouTube video of the process if you prefer. Remember to avoid static electricity to prevent damaging the device (esp. be careful not to work on synthetic carpets like nylon, that would be asking for trouble).

Connect the hard disk to your PC

I am assuming you have a PC to connect to...! At the risk of stating the obvious, make sure your PC is fully switched off before you start connecting or disconnecting the hard disk and take suitable precautations against damage to the Linkstation or your PC by static electricity. Start it up with Linux (if you don't run Linux on your desktop you could boot Ubuntu, Knoppix etc from a CDROM or DVD instead). Once the PC has started up, take a look to see what device the Buffalo disk is. Type

parted

to list currently attached disks. Hopefully the Buffalo disk should be amongst them. The output will give you the disk device, for example /dev/sdb. I'll assume /dev/sdb for my example commands below, but proceed very carefully if yours is different since some of the commands coming up could overwrite your PCs disk partitions, destroy your PC's data and make you have a really bad day. You have been warned.

Mount points

Create 2 directories to mount the boot partition and root partition of the Linkstation:

mkdir /ls1
mkdir /ls2

Mount the Linkstation partitions (adjust /dev/sdb if your parted output showed the Linkstation disk to have a different identifier),

mount /dev/sdb1 /ls1
mount /dev/sdb2 /ls2

Check that you've got the right partitions:

ls /ls1

should show something like,

builddate.txt  initrd.buffalo  log.tgz            u-boot.buffalo
conf_save.tgz  uImage.buffalo  uImage.buffalo.org

esp. make sure you see initrd.buffalo, uImage.buffalo there.

Also check that /ls2 is the Linkstation root partition:

cat /ls2/etc/hostname

should give

yourlinkstationname

that you set above. If either of these results differs then you may well have mounted the wrong disk and are at risk of destroying data if you proceed, in which case shutdown your PC and start this section again.

Replace initrd.buffalo image on Linkstation boot partition

Backup the existing initrd.buffalo file,

mv /ls1/initrd.buffalo /ls1/initrd.original

then put the initrd.buffalo.empty file we created earlier in its place. If you created initrd.buffalo.empty while you were in the chroot,

cp -p /ls2/root/workarea/initrd.work.area/initrd.buffalo.empty /ls1/initrd.buffalo

or if you created it on your PC,

cp -p location_on_your_PC/initrd.work.area/initrd.buffalo.empty /ls1/initrd.buffalo

Buffalo Incantations

We've already put these files in the new root filesystem; now we'll put them on the Linkstation's boot partition,

cp -p /ls2/etc/hddrootmode /ls1
cp -p /ls2/etc/linkstation_release /ls1
cp -p /ls2/etc/rootfs_ok /ls1

Copy the new filesystem's image file onto your PC

cp /ls2/root/workarea/squeeze-armel-rootfs.tgz /root

Replace the Linkstation root filesystem

Remind yourself which disk/partition holds the Linkstation's root filesystem,

mount | grep /ls2

Unmount the Linkstation's current root filesystem,

umount /ls2

Destroy the existing root filesystem (adjust /sdb2 if the Linkstation disk is not /dev/sdb - use whatever you had mounted as /ls2 above). Take care to choose the correct partition to avoid destroying your PC's data,

mkfs.ext3 /dev/sdb2

Mount the now-empty Linkstation root partition (adjust sdb if it's different on your system),

mount /dev/sdb2 /ls2

Check it is indeed empty (or just has lost+found directory),

ls /ls2

Populate /ls2 with the new root partition we generated earlier,

tar xzf /root/squeeze-armel-rootfs.tgz -C /ls2

Take a look to see that /ls2 does look populated,

ls /ls2

Rebuild your Linkstation & reboot

Now rebuild your Linkstation & try starting it. It should start up with the new system, although it will still be using the old Buffalo kernel. We'll fix that next. If it you can't connect to it I suggest you try these troubleshooting tips to get the Linkstation to boot.

You'll probably find that the indicator light constantly flashes blue. I recommend moving the On/Auto/Off switch to Off. This won't turn off the device, but it will stop it restarting when you issue a shutdown command. Until the kernel is replaced (below), such a restart without a power off is likely to panic the Linkstation.

You have the option to stop at this point with this hybrid setup. You can install [blstools] to deal with the LED indicator lights & fan. Take care however when switching off the device: Keep the switch at Off (just briefly move it to Auto or On when switching it on); you should shutdown the device by using the shutdown command (shutdown -h now), and then take care to fully power off the device: Leaving it in standby will result in it being unable to reboot until after a full power off. Avoid those troubles by replacing the kernel (below).

Complete the Squeeze installation: Replace the kernel & kernel modules

Caution: Make sure that you have physical access to the drives and a linux box just in case you mess up with the the kernel configuration. At the moment, there is no known way of gaining root access when the device is in EM mode: If things go badly wrong, you may have to revert the system to the factory installed software, using the backups you made earlier so that the Buffalo can run its recovery procedures successfully. You did make them, right?

This guide describes how to compile the kernel on the Linkstation itself (slow, but more straightforward). If you prefer to cross-compile on a separate Debian PC you can find details in the Debian Squeeze on LS-WXL guide.

Currently the Linkstation is still running the Buffalo kernel, which may cause some instability including when using NFS, as well as preventing you from having a purely Debian system.

Connect to the new system

Having started it, login to the new hybrid system with ssh,

ssh root@linkstation_IP_address

You can see that the system is still a hybrid of a Debian system with the original Buffalo kernel:

uname -a

will show kernel version 2.6.31 (root@ubuntu) which is the Buffalo kernel.

Install Key Packages

Install a few packages - most are needed by later steps in this guide,

apt-get usbutils bzip2 psmisc smartmontools xfsprogs
apt-get install build-essential fakeroot uboot-mkimage debhelper python libncurses5-dev

Get the kernel source code and Linkstation patches

You can carry out this step and the kernel compilation as a normal (non-root) user if you prefer.

apt-get -t squeeze source linux-2.6

Download the patch and sample config file (for linux-2.6-2.6.32-30) (although it's for the LS-WXL I think this is still useful for the LS-CHLv2):

wget http://pastebin.com/download.php?i=vFRr3zAX -O patch.lswxl
wget http://pastebin.com/download.php?i=2R6sJ0ZX -O config.lswxl

Source code setup & compilation

cd linux-2.6-2.6.32
make -f debian/rules source
cd debian/build/source_armel_none/

apply the necesary patches, but review them before you apply them, as the kernel patches changes every week,

patch -Np1 -i ~/patch.lswxl
cp ~/config.lswxl .config
make uImage modules
cp arch/arm/boot/uImage uImage.buffalo.debian
make modules_install INSTALL_MOD_PATH=./modules

The final command above will take about 90 minutes.

Replace the Buffalo kernel

Login as root if you aren't already.

Copy the kernel to the boot directory, create a backup of the old version:

mv /boot/uImage.buffalo /boot/uImage.buffalo.old
cp -a uImage.buffalo.debian /boot/uImage.buffalo

Install matching modules for new kernel

Copy the modules:

cp -a modules/lib/modules/2.6.32 /lib/modules

Setup /dev/rtc

(rtc = Real Time Clock) add /dev/rtc: /dev/rtc0 should already exist, so:

cd /dev
ln -s rtc0 rtc

Restart

Reboot: Your system should now be fully Debianised. Check with uname once it's back up:

uname -a

which should show the kernel version as 2.6.32.

Also note that at present the indicator LED won't be lit or flashing, and that the Linkstation has become noisy by running the fan at full speed - so you'll be only too aware that the Linkstation is on, even without the indicator LED. We'll fix that (hopefully) with blstools shortly.

Housekeeping

Refresh any packages needing updating,

apt-get update
apt-get upgrade



WORK IN PROGRESS (17th Jan 2012) PLEASE COME BACK LATER

WORK IN PROGRESS (17th Jan 2012) PLEASE COME BACK LATER

WORK IN PROGRESS (17th Jan 2012) PLEASE COME BACK LATER

blstools

As told above, blstools are a set of utilities which enable LS-CHL/XHL/WXL hardware-specific features otherwise unavailable from a plain Debian Lenny installation.

Download the latest package from the blstools project page (currently v0.2.0),

wget http://downloads.sourceforge.net/project/blstools/releases/blstools-0.2.0.tar.gz
tar zxf blstools-0.2.0.tar.gz
cd blstools-0.2.0
./install.sh
/etc/init.d/lsmonitor start

The following features are installed:

lsmonitor (/etc/init.d/lsmonitor)

This is a daemon that is automatically started when the system boots. You don't need to call it directly.

lsmonitor stops the blue led from flashing and provides a reassuring, still blue light. Also, when you move the switch in "off" position lsmonitor initiates system shutdown (which is nice isn't it?)

usb (/etc/init.d/usb)

Powers on and off the USB interface.

When you want to connect a USB disk to the Linkstation you should first call:

sudo /etc/init.d/usb start

and then you will be able to mount the USB drive to the desired location (generally, the device will be /dev/sdb1). Once done, in order to save power you can unmount the mounted volume and issue:

sudo /etc/init.d/usb stop

to disable the USB device.

NFS kernel

Note: Some export problems were encountered using this kernel. Compiling a Debian kernel is the preferred approach.

The kernel provided on this page can also be used for LS-WXL.

Download and extract kernel and modules:

wget http://downloads.buffalo.nas-central.org/Users/kenatonline/NFSKernel/nfs-kernel-feroceon-kw.tgz
tar xzf nfs-kernel-feroceon-kw.tgz boot lib

Install and reboot:

mount -o remount,rw /boot
mv /boot/uImage.buffalo /boot/uImage.buffalo.old
cp boot/uImage.buffalo /boot/
cp -a lib/modules/2.6.22.18kenatonline /lib/modules/
reboot

Install nfs

apt-get install nfs-kernel-server nfs-common portmap

Check if server is running:

/etc/init.d/nfs-kernel-server status

Webmin

wget http://prdownloads.sourceforge.net/webadmin/webmin_1.510-2_all.deb
apt-get install libnet-ssleay-perl openssl libauthen-pam-perl libio-pty-perl apt-show-versions libapt-pkg-perl
dpkg -i webmin_1.510-2_all.deb

For more information, please refers to Webmin to remotely administer your LinkStation



blstools Replacement

This is the replacement lsmonitor script. This uses the sysfs GPIO interface instead of the buffalo specific proc interface. Also this script monitors the temperature of both drives.

References