Updated New Zealand edition
Latest
Dev Notes · Archive

Compiling the Telemann SM200D drivers on Debian

From the archive
Linux note
Network interface card positioned on a textured surface while illuminated by red and blue lights, showcasing its ports and structure in a visually…
Photo: Shixart1985 / Wikimedia Commons, CC BY 2.0
From the carcino.gen.nz archive. This Linux note was written for the original site and is kept as published; newer systems and toolchains may behave differently.

Introduction

If you're lucky, the drivers from the Telemann web site (try here or here for other models) will work straight out of the box - try them first, they will probably work fine. If they do, you don't need this page.

If they don't, as they don't on my flat's Debian 2.2 box, read on.

(See also: Craig Falconer's page which seems to have been the definitive source of info, but a lot of it refers to older drivers, and doesn't discuss the problem below (which I think is Debian-specific).)


Compiling the drivers on Debian 2.2

This is how I do it (cf is our satellite gateway box):
  1. Download and unpack the drivers from the Telemann website:
    cf:~# cd /usr/src
    cf:/usr/src# wget http://www.telemann.com/datadown/sm200d/sm200d_linux_text_v2.01.tar.gz
    cf:/usr/src# tar xvzf sm200d_linux_text_v2.01.tar.gz
    
  2. Change to the directory you unpacked them into, and run ./INSTALL
    cf:/usr/src# cd sm200d_linux_text_v2.01
    cf:/usr/src# ./INSTALL
    

    It will barf - mine does this:

    ====================================
    making directory ./Release
    ====================================
    ====================================
    Uncompressing file sky_app.tar.gz
    ====================================
    ====================================
    Uncompressing file sky_drv.tar.gz
    ====================================
    gcc -DMODULE -D__KERNEL__ -Wall -c -DSM200D -O sm2_drv.c
    In file included from /usr/include/linux/sched.h:13,
                     from sm2_drv.c:18:
    /usr/include/linux/times.h:5: parse error before `clock_t'
    /usr/include/linux/times.h:5: warning: no semicolon at end of struct or union
    /usr/include/linux/times.h:6: warning: data definition has no type or storage class
    [pages and pages of compilation errors and warnings]
    sm2_drv.c:575: warning: `sm200_ether_get_stats' defined but not used
    sm2_drv.c:586: warning: `sm200_set_ether_multicast_list' defined but not used
    make: *** [sm2_drv.o] Error 1
    ====================================
    Uncompressing file sky_lib.tar.gz
    ====================================
    gcc -Wall -c -DSM200D sm2_sys.c
    ld -r sm2_sys.o sm2_lib_obj.o -o sm2_lib.o
    cp sm2_lib.o ../app/text
    cp sm2_lib.o ../Release
    cp sm2_lib.h ../Release
    ====================================
    Uncompressing file sky_app.tar.gz
    ====================================
    gcc -g -Wall --static -DSM200D -c SkyData.c
    gcc -g -Wall --static -DSM200D -o SkyData SkyData.o sm2_lib.o
    gcc -g -Wall --static -DSM200D -c SkyUpgrade.c
    gcc -g -Wall --static -DSM200D -o SkyUpgrade SkyUpgrade.o sm2_lib.o
    cp SkyData ../../Release
    cp SkyUpgrade ../../Release
    cp SkyData.ini ../../Release
    cp sm200dload.sh ../../Release
    ====================================
    Installation complete
    
  3. The build process is divided into three sections, lib first, then drv, then app. As you can see above, the lib and app stages go ok, it's just drv (the kernel module) which is having problems. I think the issue is with the include files in /usr/include/linux (Debian doesn't keep them in sync with the current kernel). So, this is what I do. (In these instructions, replace 2.2.19 with whatever version of kernel you are using (yes, you do have to rebuild drv when you upgrade kernel).)
    cf:/usr/src/sm200d_linux_text_v2.01# apt-get install kernel-headers-2.2.19
    

    You should now have a directory /usr/src/kernel-headers-2.2.19.

  4. Now that the new kernel headers are installed, we change the makefile so that it uses them.
    cf:/usr/src/sm200d_linux_text_v2.01# cd drv
    

    Edit the makefile, drv.mak, and change the CFLAGS line near the top, adding -I /usr/src/kernel-headers-/include, so it looks like this:

    CFLAGS = -DMODULE -D__KERNEL__ -Wall -c -DSM200D -O -I /usr/src/kernel-headers-2.2.19/include
    
  5. Then you should be able to:
    cf:/usr/src/sm200d_linux_text_v2.01/drv# make -f drv.mak
    cf:/usr/src/sm200d_linux_text_v2.01/drv# make -f drv.mak install
    

    And you should then have a full set of files in /usr/src/sm200d_linux_text_v2.01/Release:

    cf:/usr/src/sm200d_linux_text_v2.01/drv# cd ../Release/
    cf:/usr/src/sm200d_linux_text_v2.01/Release# ls 
    
    SkyData  SkyData.ini  SkyUpgrade  sm200dload.sh  sm2_lib.h  sm2_lib.o
    
  6. Follow the rest of the instructions in the README file (/usr/src/sm200d_linux_text_v2.01/README).

Settings for SkyData.ini

Read the Ultra support page for your settings (if you don't already know them). For example, our feed comes from Sugarloaf, so we have to change the following two lines in SkyData.ini to these values:
SymbolRate      = 29126
LocalOscillator = 11000


How to load things nicely on startup

Once you've got it compiled, you can initialise it however and whereever you like, but the following script is what we use. I started with the sm200dload.sh that came in the archive, but I've added quite a bit. I copied the files in Release into a new directory, /usr/local/sbin/sm200d.

I put the following script in /etc/init.d/sm200dload.sh, and used update-rc.d to make it run at startup (as you can see, this isn't a "proper" debian init.d script, it doesn't handle shutting down or restarting - feel free to improve it :-).

#!/bin/sh
module="sm200d_lnx.o"
INSTALL_DIR=/usr/local/sbin/sm200d
# added by will: kill SkyData, if it's already running
killall SkyData >/dev/null
# invoke insmod with all arguments we got
/sbin/insmod $INSTALL_DIR/$module 2>/dev/null
# added by will: configure a dummy address for the pseudo-network interface
ifconfig sm200d 192.168.1.252
# added by will: set up interface shit - I'm not sure on the details :)
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
echo 1 > /proc/sys/net/ipv4/ip_forward
# added by will: run the actual SkyMedia interface program
$INSTALL_DIR/SkyData >/tmp/sm200output &

The satellite link comes up when the box comes up, and stays up permanently (though of course we can't use it when the ppp link is down); having set up ppp, when we want the link up, we just run pon, and to disconnect, poff.

Then you get to muck around configuring your network interfaces & gatewaying - hours of fun. Craig Falconer's page has a few useful comments. (We actually just run a socks server and connect through that, because my flat also has an ADSL connection and so that is set to be our default gateway. So, I haven't tried configuring our satellite box to be a gateway, but it shouldn't any harder than doing it for a modem.)

Newer on Dev Notes