Enabling temperature sensor in CentOS on ALIX.2D2

July 10th, 2009 bk 3 comments

Now let’s make use of this temperature sensor on ALIX board. First we need lm_sensors package, so let’s install it:
# yum install lm_sensors

Now if you’ll run sensors-detect it won’t detect anything. We need the module called scx200_acb:
# grep -i scx200_acb /boot/config-`uname -r`
# CONFIG_SCx200_ACB is not set

Ok, it exists in kernel sources, but just not compiled in CentOS/RHEL kernel. Let’s compile it ourselves. It can be done on ALIX ifself (but will be slow and take time and space) or on any other CentOS machine.

Install  devepment packages:
# yum install rpm-build 
(will also install patch elfutils elfutils-libs)

# yum install gnupg redhat-rpm-config gcc
(will also install cpp glibc-devel glibc-headers kernel-headers libgomp libusb)

# yum install kernel-devel

Now we are ready to install kernel sources:
# rpm -ivh http://mirror.centos.org/centos/5/updates/SRPMS/kernel-`uname -r`.src.rpm

Prepare kernel tree:
# rpmbuild -bp –target i686 /usr/src/redhat/SPECS/kernel-2.6.spec

And then:
# cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/drivers/i2c/busses
# make CONFIG_SCx200_ACB=m -C /lib/modules/`uname -r`/build M=`pwd` modules

It will also compile few other modules, but we need only scx200_acb.ko:
# cp scx200_acb.ko /lib/modules/`uname -r`/extra/
# depmod -A

And now:
# modprobe scx200_acb
# sensor-detect
# echo MODULE_1=scx200_acb >> /etc/sysconfig/lm_sensors
# /etc/init.d/lm_sensors start

Now run it:
# sensors

lm86-i2c-0-4c
Adapter: CS5536 ACB0
M/B Temp: +43 C (low = +0 C, high = +70 C)
CPU Temp: +49.5 C (low = +0.0 C, high = +70.0 C)
M/B Crit: +85 C (hyst = +75 C)
CPU Crit: +85 C (hyst = +75 C)

Voila! It works.
(Don’t mind the temperature, summers are hot here, about 30 C in the room).

And when you’ll update the kernel you won’t need to recompile the module again, it will be linked via weak-updates directory.

Categories: linux Tags: , , , ,

Installing CentOS on ALIX.2D2

July 10th, 2009 bk 4 comments

First step for successful installation of CentOS (or RHEL/Fedora) on ALIX board is to use Microdrive instead of CompactFlash card, so you won’t have to worry about CF write cycles. Microdrives go now for $10-20 on eBay. Definitely worth it. I used 2.5GB Seagate ST625211CF Microdrive, but I believe any other will do too. 

Then you will need regular PC and IDE to CF adapder. Connect the adapter as first hard disk and install on it Linux distribution of your choice. And yes, you can create swap partition since it’s Microdrive and not CompactFlash.

Another option is to use USB card reader instead of IDE to CF adapter or VMware instead of real PC. Or connect Microdrive to another Linux machine and use yum –installroot same way it done with Xen domU images.

Any way, after Linux is installed don’t forget to enable serial console.

1. Edit /etc/grub.conf:

serial –speed=38400
terminal serial

default=2
timeout=5

title CentOS (2.6.18-128.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/hda3 console=ttyS0,38400n8
        initrd /initrd-2.6.18-128.el5.img

2. Add to /etc/inittab:

T0:23:respawn:/sbin/agetty 38400 ttyS0

3. Add to /etc/securetty:

ttyS0

Now Microdrive is ready to be plugged into ALIX and happily booted.

Despite Geode LX800 is i586 compatible CPU and CentOS/RHEL comes with i686 kernel it will boot. The only problem I’ve noticed so far is when you try to install kernel update it will complain “package kernel-2.6.18-128.1.16.el5.i686 is intended for a i686 architecture”. Fix it by:

# echo i686-redhat-linux > /etc/rpm/platform

By the way, we can also use Voyage Linux kernel. Just copy /boot/vmlinuz-2.6.26-486-voyage and /lib/modules/2.6.26-486-voyage and create initrd image:

# mkinitrd -v –without-dmraid /boot/vmlinuz-2.6.26-486-voyage 2.6.26-486-voyage

Voyage Linux kernel provides some support for such ALIX board features as temperature sensor and leds, but some of it can be also enabled in CentOS/RHEL kernel. About it later on.

Categories: linux Tags: , , , , ,

Installing Linux on ALIX.2D2

June 17th, 2009 bk 1 comment

Recently I got myself ALIX.2D2 board from PC Engines as a replacement to old, bulky and loud midi tower serving as ADSL router/firewall/general purpose server. ALIX boards are small (15×15 cm), fan-less and relatively cheap – whole package including case, wireless card, shipping and taxes came to about $200.

CPU: 500 MHz AMD Geode LX800
DRAM: 256 MB DDR DRAM
Storage: CompactFlash socket
Expansion: 2 miniPCI slots
Connectivity: 2 Ethernet channels (10/100)
I/O: DB9 serial port, dual USB port
Board size: 6 x 6″ (152.4 x 152.4 mm)

AMD Geoge CPU shows about 1000 BogoMIPS, comparing to Pentium III 677 MHz which has 1300 BogoMIPS. And of course 256MB RAM is more that enough for small Linux box.

Since boards are meant for embedded devices they come without VGA port, so OS installation isn’t straight forward, but not too complex either. One of Linux distribution designed especially for such devices is Voyage Linux. It’s Debian based and fits into 128MB Compact Flash card.

I used 256MB CF from old camera. Plugged it into USB reader connected to my old Linux server, ran setup script and in few minutes ALIX was ready to boot.

Voyage Linux is definitely nice distribution for small systems, comes with wireless card drivers an preconfigured for ALIX’s LEDs and temperature sensors. But since I never was Debian fan I decided to install something more Red Hat based, like CentOS or Fedora. About it in the next post.

Categories: linux Tags: , , ,