Difference between revisions of "Debian Squeeze on LS-CHLv2"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m (In chroot: Ethernet interface setup)
m (In chroot: hostname)
Line 194: Line 194:
 
Create /etc/hostname,
 
Create /etc/hostname,
  
  echo yourlinkstationname > /etc/hostname
+
  echo ''yourlinkstationname'' > /etc/hostname
  
Edit /etc/hosts: Add yourlinkstationname to the 127.0.0.1 line,
+
Edit /etc/hosts: Add ''yourlinkstationname'' to the 127.0.0.1 line,
  
  127.0.0.1 localhost yourlinkstationname
+
  127.0.0.1 localhost ''yourlinkstationname''
  
 
===In chroot: /etc/apt/sources.list setup===
 
===In chroot: /etc/apt/sources.list setup===

Revision as of 22:33, 16 January 2012

This guide will explain how to install Debian GNU/Linux "Squeeze" on the LinkStation™ LS-CHLv2 using the Debian "debootstrap" procedure. 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

WORK IN PROGRESS (16th jan 2012) PLEASE COME BACK LATER

Summary of main steps

  • get command-line [root] access to the Linkstation (telnet or ssh)
  • create a Debian system with debootstrap
  • use the data partition as a temporary root
  • replace the old filesystem with the new one

Requirements, Background info, Warnings

Note that I dismantled my Linkstation so I could connect the hard drive to my [Linux] PC - this made it a bit easier to deal with replacing filesystems etc.; re-reading the source documents mentioned above (esp. re. Lenny) it may be 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 - 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.

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 disk in case that's needed (quite likely). 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. Therefore 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. Well, not unless someone wants to give me a shiny Linkstation for keeps... instead, 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 (add uBoot site link); 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.

Hardware

Described elsewhere on the wiki in more detail, but key features are: ARM Kirkwood processor, 128 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 128MByte 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 half of the memory for a ramdisk, uBoot reserving a couple of MByte for itself that it doesn't give back, and presumably there's memory taken away for some other stuff too. It may be possible to adjust the uBoot setup to stop it taking away so much memory. Given that Debian recommends 64MByte as a minimum memory requirement, only having 50 MByte is annoying to say the least, esp. when physically there's 128MByte in the device.

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).

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.

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 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.

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,

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      /mnt/disk1    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 half-way-house setup, maybe okay once system fully converted), and /boot mounted read-write - you can change it back to read-only later.

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: Add mount point to match Buffalo's data partition mount point

Create the mount point for the data area to match existing system,

mkdir /mnt/disk1

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 [1] 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.

Network

Edit /etc/network/interfaces to match your LAN configuration. My LS gets all information from DHCP:

# 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
# DHCP for Ethernet connection 
auto eth1
iface eth1 inet dhcp

Create /etc/hosts

cat >/etc/hosts <<EOF
127.0.0.1  localhost.localdomain localhost
EOF

Create /etc/hostname:

cat >/etc/hostname <<EOF
<your hostname>
EOF

Replace <your hostname> with a sensible name.

Install SSHD

apt-get install openssh-server
passwd root

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

PermitRootLogin yes

Prepare the rootfs archive

Clean up the installation, leave the chrooted environment and tar it up:

aptitude clean
exit
tar zcvf lenny-armel-rootfs.tgz -C debian-armel-rootfs .

Now you have a complete rootfs for Debian Lenny armel.

Installation

We will reuse the existing root partition to store the debian rootfs. The data partition will be used as a temporary root so that this installation will be performed right on the LS itself. It is necessary to have a backup of the data partition if it contains important stuff.

If you want to change the RAID type for the data partition, it is better to use the web interface before switching to the full Debian setup.

Create an initrd

An initrd is necessary to boot debian using a raid partition.

We need busybox to create a minimal initrd. Note that we need to go back to the chrooted environment.

chroot debian-armel-rootfs/ /bin/bash
apt-get install busybox

Install uboot files:

apt-get install uboot-mkimage

Create and mount an ext2 image file:

cd /tmp
dd if=/dev/zero of=initrd bs=1k count=0 seek=3K
mke2fs -F -m 0 -b 1024 initrd
tune2fs -c0 -i0 initrd
mkdir INITRD
mount -o loop initrd INITRD

Might you want to create a bigger initrd, the max size of the uncompressed initrd is 8388544 bytes.

Create directory structure and the device nodes:

mkdir -p INITRD/{bin,lib,dev,etc/mdadm,proc,sbin}
cp -a /dev/{null,console,tty,sd{a,b,c,d}?,md*} INITRD/dev/

Copy busybox, mdadm and their dependencies:

cp /bin/busybox INITRD/bin/
cp /sbin/mdadm INITRD/sbin
cp /lib/{libm.so.6,libc.so.6,libgcc_s.so.1,ld-linux.so.3} INITRD/lib

The dependencies can be determined using the commands:

ldd /bin/busybox
ldd /sbin/mdadm

Create a linuxrc:

cat > INITRD/linuxrc <<EOF
#!/bin/busybox sh

# Mount the /proc and /sys filesystems.
mount -t proc none /proc
mount -t sysfs none /sys

echo 'DEVICE /dev/sd??*' > /etc/mdadm/mdadm.conf
mdadm -Eb /dev/sd??* >> /etc/mdadm/mdadm.conf
mdadm -As --force

# use /dev/md1 as root
# echo "0x901" > /proc/sys/kernel/real-root-dev
# use /dev/md2 as root
echo "0x902" > /proc/sys/kernel/real-root-dev
# use /dev/sda6 as root
# echo "0x806" > /proc/sys/kernel/real-root-dev
# use /dev/sdb6 as root
# echo "0x822" > /proc/sys/kernel/real-root-dev

# Clean up.
umount /proc
umount /sys
EOF
chmod +x INITRD/linuxrc

Uncomment the relevant line if you use a different temporary root partition.

Generate an initrd for temporary root partition:

umount INITRD
gzip initrd
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -n initrd -d initrd.gz initrd.buffalo

Next we need to create another initrd for the final installation:

gunzip initrd.gz
mount -o loop initrd INITRD

Edit linuxrc to use /dev/MD1 as root:

# use /dev/md1 as root
echo "0x901" > /proc/sys/kernel/real-root-dev

Or change it to whatever partition you may want later.

umount INITRD
gzip initrd
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -n initrd -d initrd.gz initrd.buffalo.final
rmdir INITRD

Copy initrd:

exit
mv /boot/initrd.buffalo /boot/initrd.buffalo.old
cp debian-armel-rootfs/tmp/initrd.buffalo* /boot/

Installing the Debian rootfs

This will be a two step process. We first boot debian using a temporary rootfs and then transfer it to it final partition.

If you are using two hard disks, /dev/md2 will be the temporary partition and /dev/md1 will be the final destination. If you are using a single drive, then /dev/sda6 or /dev/sdb6 will be the temporary partition.

Install rootfs in temporary partition

Untar the rootfs and copy the backup:

tar xvzf lenny-armel-rootfs.tgz -C /mnt/array1/
cp lenny-armel-rootfs.tgz /mnt/array1/

Use /mnt/disk1 or /mnt/disk2 instead of /mnt/array1 if you are using a single drive.

Reboot and pray that it works. :)

reboot

After rebooting, login to the new system.

Install rootfs in /dev/md1

Format /dev/md1, use whatever filesystem that you prefer:

mkfs.ext3 /dev/md1
tune2fs -c0 -i0 /dev/md1

Mount it under /mnt and extract the rootfs:

mount /dev/md1 /mnt
tar xvzf /lenny-armel-rootfs.tgz -C /mnt
cp /lenny-armel-rootfs.tgz /mnt/root           # make a copy

Edit /mnt/etc/fstab to reflect the changes:

# /etc/fstab: static file system information.
#
# file system	mount point	type	options			dump pass
/dev/md1	/		ext3	defaults,noatime	0    1
/dev/md0	/boot		ext3	ro,nosuid,nodev		0    2
/dev/md10	none		swap	sw			0    0
proc		/proc		proc	defaults		0    0

Use the correct initrd:

cd /boot
mv initrd.buffalo initrd.buffalo.initial
cp initrd.buffalo.final initrd.buffalo

Note: make sure the /boot is mounted! You may have to manually mount it to complete the above step.

Reboot and pray that it works. :)

reboot

Post-installation setup

Setup data partition

The existing data partition can be mounted on the home directory as-is without formatting but the rootfs files must be manually deleted.

The other approach is to start clean and format it. Note that the EXT3 was chosen as the filesystem for the data partition.

Replace /dev/md2 with either /dev/sda6 or /dev/sdb6 if you are using a single drive.

Format:

mkfs.ext3 -m0 /dev/md2
tune2fs -c0 -i0 /dev/md2

Update /etc/fstab:

# /etc/fstab: static file system information.
#
# file system	mount point	type	options			dump pass
/dev/md1	/		ext3	defaults,noatime	0    1
/dev/md2	/home		ext3	defaults,noatime	0    2
/dev/md0	/boot		ext3	ro,nosuid,nodev		0    2
/dev/md10	none		swap	sw			0    0
proc		/proc		proc	defaults		0    0

Mount /home

mount /home

Add user

Issue the following command

 adduser <username>

Configuring timezone

dpkg-reconfigure tzdata

Useful packages

Anyone would need these:

apt-get install sudo less usbutils bzip2 mc linuxlogo psmisc

NTP

Ntpd ensures that your Linkstation clock stays in sync with global time servers.

apt-get install ntp

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.

In order to install the latest blstools, smartmontools is required:

apt-get install smartmontools

Download the package from the blstools project page

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

Building the Debian kernel

Caution: Make sure that you have physical access to the drives and a linux box just in case you messed 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.

The kernel can be natively compiled or cross compiled using an external Debian PC.

Requisites

Install the following packages under root:

apt-get install build-essential fakeroot uboot-mkimage debhelper python libncurses5-dev

Update /etc/apt/sources.list to be able to download the Squeeze kernel sources:

echo deb-src http://ftp.us.debian.org/debian squeeze main >> /etc/apt/sources.list
apt-get update

Install the kernel sources (this command can be run as a normal user)

apt-get -t squeeze source linux-2.6

Download the patch and sample config file (for linux-2.6-2.6.32-30):

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

Native 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

On my LS, the compilation took around 1.5 hrs.

Cross compilation

cd linux-2.6-2.6.32
make -f debian/rules.gen 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
cd debian/build/source_armel_none/
patch -Np1 -i ../../../../patch.lswxl
cp ../../../../config.lswxl .config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage modules
mv arch/arm/boot/uImage uImage.buffalo.debian
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=./modules

Installation

Get yourself root access, and get write access to the boot fs

su
mount -o remount,rw /boot

If blstools is installed, this program must first be disabled or removed. Otherwise, the system will just automatically reboot.

chmod a-x /etc/init.d/lsmonitor

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

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

Copy the modules:

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

make the correct realtime clock device, with this kernel settings it is:

mknod /dev/rtc c 254 0


Reboot and enjoy your new kernel.

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