This page is a work in progress, I'm keeping notes here as I go and will tidy up when it's done...
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
- Set up your native build environment
ipkg install slugos-native
- install the kernel sources in
/usr/src/, current version is 18.104.22.168 on my openslug
- and configure the kernel for your Slug.
- 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
- wait for
then you can interrupt the kernel build (messy...)
- Next install the lirc source code,
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:
- 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
- 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.
- 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
- 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 (
ln -s /mylinuxsrcdir).
- 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.
- now, check if the modules you wanted are installed with modprobe,
modprobe -v lirc-dev
- 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!
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.
SHUTDOWN='sudo shutdown -h now'
if [ -f $POWERSTAMP ]; then
if [ $diff -gt 2 -a $diff -lt 10 ]; then
date "+%s" > $POWERSTAMP
That way you have to press the button twice with a delay between 2 and 10 seconds.