[SCRIPT] for creating intel 536 EP module

Post tutorials, HOWTO's and other useful resources here.
Post Reply
Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

[SCRIPT] for creating intel 536 EP module

Post#1 by Tonio » 31 Dec 2010, 20:01

http://linmodems.technion.ac.il/packag ... adme.html
or

http://vouters.dyndns.org/Intel/Intel-Readme.html

Source package
http://vouters.dyndns.org/Intel/intel-5 ... 19.tar.bz2

cut + paste code below and save as

Code: Select all

intel536.slaxbuild
Make it executable

Code: Select all

chmod +x intel536.slaxbuild
then run

Code: Select all

# ./intel536.slaxbuild 

Code: Select all

#!/bin/sh

# slax build script for intel-536EP
# uncooment if you have source file
# wget http://vouters.dyndns.org/Intel/intel-536EP-537EP_2010_07_19.tar.bz2

CWD=$PWD

ARCH=$(uname -m)
ARCH=${ARCH:-i486}

TMP=/tmp/packages
PKG=$TMP/_pkg_

##get ready when module extension is going to be changed
pkgext=lzm
#SLAXMAJOR=$(awk '{print $2}' /etc/slax-version | cut -d'.' -f1)
##don't know yet what it's gonna be
#if [ $SLAXMAJOR -ge 7 ]; then
#       pkgext=lzm
#fi

#archive expected in format intel-536EP-*.tar.bz2
if [ $(ls intel-536EP-*.tar.bz2 2>/dev/null | wc -l) -ne 1 ]; then
        echo "couldn't find the source archive"
        exit 1
fi
archive=$(ls intel-536EP-*.tar.bz2)

src=$(tar tf $archive | head -n1 | awk -F '/' '{print $1}')
VERSION=$(echo ${archive%.tar.bz2} | sed 's?^intel-536EP-??')
#if package name is something like foo-somedigits-src.tar.bz2, etc. try
#VERSION=$(echo ${archive%.tar.bz2} | sed 's?^intel-536EP-??' | \
#       sed 's?-[a-z]\{3,\}$??' | sed 's?-?_?g')

LIB=""
case "$ARCH" in
        i386) CFLAGS="-O3 -march=i386 -mcpu=i686";;
        i486) CFLAGS="-O3 -march=i486 -mtune=i686";;
        i686) CFLAGS="-O3 -march=i686 -mtune=i686";;
        athlon-xp) CFLAGS="-O3 -march=athlon-xp -pipe -fomit-frame-pointer";;
        x86_64) CFLAGS="-O3 -fPIC"; LIB=64;;
esac

#should we include the architecture in the name?
#MODNAME=intel-536ep-${VERSION}-$ARCH.$pkgext
MODNAME=intel-536ep-$VERSION.sq4.$pkgext

#$echo "        check that the following variables are set correctly"
#echo "archive=$archive"
#echo "    src=$src"
#echo "VERSION=$VERSION"
#echo "MODNAME=$MODNAME"
#echo " if this is correct, remove these lines from this script"
#exit 0

description()
{
cat < /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
        xargs strip --strip-unneeded 2> /dev/null
)
}

generatelist()
{
mkdir -p $PKG/usr/src/slaxbuilds/intel-536ep
(cd $PKG
LIST=$PKG/usr/src/slaxbuilds/intel-536ep/pkglist.txt
find * | while read f
do
        if [ -d "$f" ]; then
                echo "${f}/" >> $LIST
        fi
        if [ -L "$f" ]; then
                echo "$f -> $(readlink -n $f)" >> $LIST
        elif [ ! -d "$f" ]; then
                echo "$f" >> $LIST
        fi
done
cp $LIST $CWD
)
}

if [ -e $TMP ]; then
        rm -Rf $TMP/*
fi
mkdir -p $TMP

cd $TMP

tar jxvf $CWD/$archive || exit 1
cd $src || exit 1

permissions

sed -i 84d Intel536_inst
sed -i '84 a D=/etc/slackware' Intel536_inst
make clean
make 536
#make install

mkdir -p $PKG
make install DESTDIR=$PKG || exit 1

mkdir -p $PKG/lib/modules/`uname -r`/kernel/drivers/char
mkdir -p $PKG/usr/sbin
mkdir -p $PKG/etc/rc.d/
cp -ra /usr/sbin/hamregistry $PKG/usr/sbin
cp -ra /lib/modules/`uname -r`/kernel/drivers/char/Intel536.ko $PKG/lib/modules/`uname -r`/kernel/drivers/char
cp -ra /etc/rc.d/rc.intel536 $PKG/etc/rc.d/
sed -i '47 a depmod -a' $PKG/etc/rc.d/rc.intel536
sed -i '48 a sleep 3' $PKG/etc/rc.d/rc.intel536
sed -i '49 a \' $PKG/etc/rc.d/rc.intel536
chmod +x $PKG/etc/rc.d/rc.intel536
sleep 3
rm -rf /usr/sbin/hamregistry
rm -rf /lib/modules/`uname -r`/kernel/drivers/char/Intel536.ko
rm -rf /etc/rc.d/rc.intel536
sed -i 11d /etc/rc.d/rc.local
sed -i 12d /etc/rc.d/rc.local
sed -i 13d /etc/rc.d/rc.local
sed -i 14d /etc/rc.d/rc.local
sed -i 15d /etc/rc.d/rc.local


strip

#copy this script and some info to /usr/src/slaxbuilds/intel-536ep
mkdir -p $PKG/usr/src/slaxbuilds/intel-536ep

cp $CWD/intel-536ep.slaxbuild $PKG/usr/src/slaxbuilds/intel-536ep

description > $PKG/usr/src/slaxbuilds/intel-536ep/readme.txt
echo "installed version: $VERSION" >> $PKG/usr/src/slaxbuilds/intel-536ep/readme.txt

#list contents of package
generatelist

clear
echo
cd $CWD
rm -f $MODNAME

#mksquashfs $PKG $MODNAME -b 256K -lzmadic 256K || exit 33
dir2lzm  $PKG $MODNAME
chmod a-wx $MODNAME
chmod a+r $MODNAME

echo
echo "                                     intel-536EP"
echo
description
echo
echo "module $MODNAME successfully created in $CWD"
echo

rm -Rf $TMP/*

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: [SCRIPT] for creating intel 536 EP module

Post#2 by Tonio » 03 Jul 2011, 02:02

Still need to make some corrections to this code to accomodate new fixes in kernels >= 2.6.37 and Porteus uses 2.6.38.8 I need to update this to work:

I have to comment line 53 of makefile for 536 modem, since my intel 536 EP modem is no longer used, and also make some changes to some files, locks.c and softserial_io.c and have not done so yet :(, change DECLARE_MUTEX(semX) to DEFINE_SEMAPHORE(semX), as has been found in linmodems page, I just found out about this, thus I am posting here. Will try to make corrections as soon as I can, or when someone asks for it whichever comes first?

Save the following code as

Code: Select all

intel-536.slaxbuild

Code: Select all

#!/bin/bash

# http://vouters.dyndns.org:8080/Intel/
# http://vouters.dyndns.org:8080/Intel/Intel-Readme.html
#
# cheated :(  used vonbiber's slaxgenerator script & modified to make it work
# in slax/slax-remix now in Porteus
#  vonbiber's webpage http://vonbiber.byethost17.com
#  check slax page for some slaxbuilds and the tool I used
# http://vonbiber.byethost17.com/slax/generator/index.html
#
# new driver available at
# http://vouters.dyndns.org/Intel/intel-536EP-537EP_2011_07_03.tar.bz2

# download using wget, uncomment if you want to use wget
# wget http://vouters.dyndns.org/Intel/intel-536EP-537EP_2011_07_03.tar.bz2

# porteus build script for intel-536EP

CWD=$PWD

ARCH=$(uname -m)
ARCH=${ARCH:-i486}

TMP=/tmp/packages
PKG=$TMP/_pkg_

##get ready when module extension is going to be changed
pkgext=xzm
#SLAXMAJOR=$(awk '{print $2}' /etc/slax-version | cut -d'.' -f1)
##don't know yet what it's gonna be
#if [ $SLAXMAJOR -ge 7 ]; then
# pkgext=lzm
#fi

#archive expected in format intel-536EP-*.tar.bz2
if [ $(ls intel-536EP-*.tar.bz2 2>/dev/null | wc -l) -ne 1 ]; then
    echo "couldn't find the source archive"
    exit 1
fi
archive=$(ls intel-536EP-*.tar.bz2)

src=$(tar tf $archive | head -n1 | awk -F '/' '{print $1}')
VERSION=$(echo ${archive%.tar.bz2} | sed 's?^intel-536EP-??')
#if package name is something like foo-somedigits-src.tar.bz2, etc. try
#VERSION=$(echo ${archive%.tar.bz2} | sed 's?^intel-536EP-??' | \
# sed 's?-[a-z]\{3,\}$??' | sed 's?-?_?g')

LIB=""
case "$ARCH" in
    i386) CFLAGS="-O3 -march=i386 -mcpu=i686";;
    i486) CFLAGS="-O3 -march=i486 -mtune=i686";;
    i686) CFLAGS="-O3 -march=i686 -mtune=i686";;
    athlon-xp) CFLAGS="-O3 -march=athlon-xp -pipe -fomit-frame-pointer";;
    x86_64) CFLAGS="-O3 -fPIC"; LIB=64;;
esac

#should we include the architecture in the name?
#MODNAME=intel-536ep-${VERSION}-$ARCH.$pkgext
MODNAME=intel-536ep-$VERSION.$pkgext

#$echo " check that the following variables are set correctly"
#echo "archive=$archive"
#echo " src=$src"
#echo "VERSION=$VERSION"
#echo "MODNAME=$MODNAME"
#echo " if this is correct, remove these lines from this script"
#exit 0

description()
{
    cat /dev/null

}

generatelist()
{
    mkdir -p $PKG/usr/src/slaxbuilds/intel-536ep
    (cd $PKG
    LIST=$PKG/usr/src/slaxbuilds/intel-536ep/pkglist.txt
    find * | while read f
    do
    if [ -d "$f" ]; then
    echo "${f}/" >> $LIST
    fi
    if [ -L "$f" ]; then
    echo "$f -> $(readlink -n $f)" >> $LIST
    elif [ ! -d "$f" ]; then
    echo "$f" >> $LIST
    fi
    done
    cp $LIST $CWD
    )
}

if [ -e $TMP ]; then
rm -Rf $TMP/*
fi
mkdir -p $TMP

cd $TMP

tar jxvf $CWD/$archive || exit 1
cd $src || exit 1

permissions

# need to comment line 53 in makefile_536 if we don't have an Intel536 modem
# remove line if you do have one, this only to build it
sed -i '53 s/^/#/' makefile_536

# copy startup scripts using slackware hack(s)
sed -i 84d Intel536_inst
sed -i '84 a D=/etc/slackware' Intel536_inst
make clean
make 536
#make install

mkdir -p $PKG
make install DESTDIR=$PKG || exit 1

mkdir -p $PKG/lib/modules/`uname -r`/kernel/drivers/char
mkdir -p $PKG/usr/sbin
mkdir -p $PKG/etc/rc.d/
cp -ra /usr/sbin/hamregistry $PKG/usr/sbin
cp -ra /lib/modules/`uname -r`/kernel/drivers/char/Intel536.ko $PKG/lib/modules/`uname -r`/kernel/drivers/char
cp -ra /etc/rc.d/rc.intel536 $PKG/etc/rc.d/
sed -i '47 a depmod -a' $PKG/etc/rc.d/rc.intel536
sed -i '48 a sleep 3' $PKG/etc/rc.d/rc.intel536
sed -i '49 a \' $PKG/etc/rc.d/rc.intel536
chmod +x $PKG/etc/rc.d/rc.intel536
sleep 3
rm -rf /usr/sbin/hamregistry
rm -rf /lib/modules/`uname -r`/kernel/drivers/char/Intel536.ko
rm -rf /etc/rc.d/rc.intel536
sed -i 11d /etc/rc.d/rc.local
sed -i 12d /etc/rc.d/rc.local
sed -i 13d /etc/rc.d/rc.local
sed -i 14d /etc/rc.d/rc.local
sed -i 15d /etc/rc.d/rc.local


strip

#copy this script and some info to /usr/src/pbuilds/intel-536ep
mkdir -p $PKG/usr/src/pbuilds/intel-536ep

cp $CWD/intel-536ep.pbuild $PKG/usr/src/pbuilds/intel-536ep

description > $PKG/usr/src/builds/intel-536ep/readme.txt
echo "installed version: $VERSION" >> $PKG/usr/src/pbuilds/intel-536ep/readme.txt

#list contents of package
generatelist

clear
echo
cd $CWD
rm -f $MODNAME

# used this when building using slax/slax-remix
#mksquashfs $PKG $MODNAME -b 256K -lzmadic 256K || exit 33
dir2xzm $PKG $MODNAME
chmod a-wx $MODNAME
chmod a+r $MODNAME

echo
echo " intel-536EP"
echo
description
echo
echo "module $MODNAME successfully created in $CWD"
echo

rm -Rf $TMP/*

Edit:
added a hack to create module (comment line 53) if we don't have intel 536 modem on our machines.

Post Reply