NSLU2-Linux
view · edit · print · history

This page is a work in progress, I'm keeping notes here as I go and will tidy up when it's done...


Intro

I'm building a car computer based on the slug and wanted to run 'lirc' for remote control of madplay as per these instructions.

This bit of information assumes you're running OpenSlug, I don't know how much (or if any) of it would apply to other versions of the slug firmware.

Debianslug users, read below.

Even though it's mentioned somewhere else in this wiki in AddAnInfraredReceiverAndTransmitterWithLIRC the lirc package is not in the package repository for OpenSlug and my slug is configured for native compilation, bitbake won't work for me, I do not have a cross development environment set up.

So, here's how to set up for a native compilation of lirc on the slug:

Using a native build environment

  1. Set up your native build environment
    ipkg install slugos-native
  2. install the kernel sources in /usr/src/, current version is 2.6.12.2 on my openslug
  3. and configure the kernel for your Slug.
  4. Run the kernel build at least up to the point where all the symlinks in the include directory are created, this bit had me stumped for a while, I thought that the symlinks would have been created at the end of the configuration step (no reason to go through the whole build process though!), so that's
    • make
    • wait for
      CC init/main.o
      then you can interrupt the kernel build (messy...)
  5. Next install the lirc source code, configure and make install

DebianSlug

If you're running DebianSlug, installing Lirc is as easy as apt-get install lirc. However, if you want to get Lirc modules working, it's a much different story. Follow my instructions below to save yourself from ripping your hair off, as I did:

  1. first, install lirc, lirc-modules-source, module-assistant - as well as compile tools (gcc, binutils, make, autoconf...etc) using apt get:
    apt-get install lirc lirc-modules-source module-assistant
  2. next, you need to get the openslung kernel source, not the debian sources! If you have a mastermakefile/openembedded/bitbake crosscompile enviroment, there should be kernel sources somewhere in there - slugos-3.10-beta\debianslug-nslu2.tmp\work\ixp4xx-kernel-2.6.16-r6.4. If you don't, you probably should build this crosscompile as it will take hours on the nslu2. Just do a make debianslug-image. I don't know of any other way to get the kernel source, and whatever you do, don't use a generic kernel as you will get module errors.
  3. Figure out which version of gcc your kernel was compiled with using uname. If you're running slugos-3.10 this is probably gcc-3.4, so you need to get it and make sure the version in /usr/bin/gcc is 3.4, you might have to rename the old gcc and ln -s gcc-3.4 gcc. Check with gcc -v. Go to the kernel source directory and type make modules, and break (ctrl+C) when it says
    CC init/main.o.
  4. Finally, put the kernel sources in /usr/src/linux. If you don't have enough space on your slug, like me, you can always use smbfs (apt-get install smbfs) to mount a network drive (mount -t smbfs -username=x, password=x /myserver/myshare /mnt/destdir) and symlink it (cd /usr/src, ln -s /mylinuxsrcdir).
  5. Now, run module-assistant by typing m-a. You don't need to set it up or configure it, just go to the last option to select the module you want to build (lirc-modules) and hit //build//, and let it autoinstall. Press //exit// to get out of module-assist.
  6. now, check if the modules you wanted are installed with modprobe,
    depmod -a
    modprobe -v lirc-dev
  7. and hopefully it worked! otherwise use dmesg and see what went wrong, you probably compiled with the wrong kernel headers or wrong version of gcc. alternatively, you can download the lirc source, it's much easier to configure! you'll still need the kernel headers from OE/bitbake though!

Misc tips

Safe shutdown via remote

Suppose you want to be able to power off your nslu2 via a remote, but you fear that you (or your curious guests/kids) could accidentially tap on the power button while your mega important backup job runs.

Use a script snippet like the following and assign it to the power button action.

 POWERSTAMP=/var/run/CONFIGURE_ME/power.stamp
 SHUTDOWN='sudo shutdown -h now'
 if [ -f $POWERSTAMP ]; then
         last=$(cat $POWERSTAMP)
         now=$(date "+%s")
         diff=$(($now-$last))
         if [ $diff -gt 2 -a $diff -lt 10 ]; then
                 $SHUTDOWN
         fi
 fi
 date "+%s" > $POWERSTAMP

That way you have to press the button twice with a delay between 2 and 10 seconds.

view · edit · print · history · Last edited by Marco Kubon.
Based on work by hs, MichaelWei, and eFfeM.
Originally by jacquesm.
Page last modified on April 18, 2007, at 05:11 PM