I would like to use my embedded linmodem of my laptop CQ armada E500 to
send some fax but the modem is non recognized with my kernels.
I am needing help for you in order to try to compile linmodem modules
(ltserial) for my kernel: 2.6.21-3-686 with Debian SID, and modules for
kernel 2.6.21-4-mdv for Mandriva cooker 2008.0.
FIRST way
If I use ltmodem-2.6-alk-8.tar.bz2 pakage I have an error during make:
lt_modem.c:123: error: expected ')' before string constant
I am non able to change the line as the error says
I attached lt_modem.c file
SECOND way
If I use ltmodem-8.31b1.tar.gz pakage I have an error during ./build_module
make: *** No targets specified and no makefile found.
Stop. Checking for driver products:
Compilation of ltmodem.ko failed,
I attached build_module file
I think there is a problem during make command:
e.g.
make | grep -v echo 2>&1 | tee -a $RECORD
I think I am using make version too new but I don't know how to modify
the line ( make | grep -v echo 2>&1 | tee -a $RECORD) according new
requirements
Do you send me any information about my research?
Best Regards and Many Thank you.
Giorgio
--
Linux Powered
DEBIAN SID
kernel-2.6.21-2-686 ;-)
--
Using free-licensed opensource software: GNU/Linux
powered by Mandriva Linux release 2008.0 (Cooker)
kernel 2.6.21-4mdv on i686
/*
* UNOFFICIAL BUT WORKING LTMODEM DRIVER for 2.6.x Linux kernels
* based on original code released by Agere Systems Inc.
*/
/****************************************************************
* File : ltmodem.c
*
* Copyright (C) 1999, 2000, 2001 Lucent Technologies Inc.
* Copyright (C) 2001, 2002, 2003 Agere Systems Inc. All rights reserved.
*
*
* Description :
* Contains the interface functions for Linux
*
****************************************************************/
/****************************************************************
MRS changes
- support for 2.2 and 2.4 kernels in same file
- support for override vendor and device id's
- fixups to remove warnings from compile
some return valuse not supplied. various statics removed
in NOEEPROM ifdef to be consistent with other part
- PCI support for kernel 2.5 (c) Jason Hall
- minor 2.6 simplification by Aleksey Kondratenko.
Now it supports 2.6 only.
****************************************************************/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h> // in order to get jiffies
#include <linux/param.h> // in order to get HZ
#include <linux/pci.h> // pci functions
#include <linux/time.h>
#include <asm/io.h>
#include "linuxif.h"
#ifndef MODULE
#error this code cannot be the part of Linux kernel
#endif
#ifndef PCI_DEVICE_ID_ATT_L56XMF
#define PCI_DEVICE_ID_ATT_L56XMF 0x0440
#endif
static char *modem_name = "Lucent Modem Controller driver";
static char *modem_version = "8.26-alk-8";
extern int eeprom_flag;
struct timer_list timerList;
asmlinkage int (*lt_rs_interrupt)(void);
spinlock_t modem_driver_lock = SPIN_LOCK_UNLOCKED;
#ifdef MEMSET_HACK
#undef memset
asmlinkage
void *memset(void *p, int val, size_t cnt)
{
printk(KERN_INFO "ltmodem_memset called\n");
return __memset(p,val,cnt);
}
#endif
/* define pci config access function */
LT_DEFINE_PCI_OP(read, byte, char *)
LT_DEFINE_PCI_OP(read, word, short *)
LT_DEFINE_PCI_OP(read, dword, int *)
LT_DEFINE_PCI_OP(write, byte, char)
LT_DEFINE_PCI_OP(write, word, short)
LT_DEFINE_PCI_OP(write, dword, int)
asmlinkage
byte Get_PCI_INTERRUPT_LINE(void)
{
return PCI_INTERRUPT_LINE;
}
asmlinkage
byte Get_PCI_BASE_ADDRESS_1(void)
{
return PCI_BASE_ADDRESS_1;
}
asmlinkage
byte Get_PCI_BASE_ADDRESS_2(void)
{
return PCI_BASE_ADDRESS_2;
}
asmlinkage
dword Get_PCI_BASE_ADDRESS_IO_MASK(void)
{
return PCI_BASE_ADDRESS_IO_MASK;
}
asmlinkage
byte Get_PCI_BASE_ADDRESS_SPACE_IO(void)
{
return PCI_BASE_ADDRESS_SPACE_IO;
}
asmlinkage
BOOL lt_pci_present(void)
{
return 1;
}
static
struct PCI_IDs {
int vendor_id;
int device_id_start;
int device_id_last;
} pci_ids[] = {
{0x115d, 0x0010, 0x03ff}
};
static int vendor_id = 0;
static int device_id = 0;
MODULE_PARM(vendor_id, "i");
MODULE_PARM_DESC(vendor_id, "Vendor ID of the Lucent Modem e.g. vendor_id=0x11c1");
MODULE_PARM(device_id, "i");
MODULE_PARM_DESC(device_id, "Device ID of the Lucent Modem e.g. device_id=0x0440");
static int Forced[4] = {-1,-1,-1,0};
MODULE_PARM(Forced, "4i");
MODULE_PARM_DESC(Forced, "Forced Irq,BaseAddress,ComAddress[,NoDetect] of the Lucent Modem e.g. Forced=3,0x130,0x2f8");
static
struct pci_dev *__find_device(struct lt_pci_dev_info *lt_dev, unsigned int id, unsigned int num)
{
int i;
struct pci_dev *dev = pci_get_device(id,num,0);
if (!dev || pci_enable_device(dev) < 0 || !dev->irq)
return 0;
lt_dev->irq = dev->irq;
lt_dev->vendor = dev->vendor;
lt_dev->device = dev->device;
lt_dev->devfn = dev->devfn;
lt_dev->bus_num = dev->bus->number;
lt_dev->subsystem_vendor = dev->subsystem_vendor;
lt_dev->subsystem_device = dev->subsystem_device;
for (i=0;i<6;i++) {
lt_dev->Base_Address[i] = dev->resource[i].start;
if (dev->resource[i].start)
lt_dev->Base_Address[i] |= dev->resource[i].flags & 1;
}
return dev;
}
static
struct pci_dev *detected_pci_dev;
asmlinkage
BOOL lt_pci_find_device(struct lt_pci_dev_info *lt_dev, unsigned int id, unsigned int num)
{
if (detected_pci_dev)
pci_dev_put(detected_pci_dev);
if ((detected_pci_dev = __find_device(lt_dev,id,num)))
return TRUE;
if (id == PCI_VENDOR_ID_ATT && num == PCI_DEVICE_ID_ATT_L56XMF) {
int i;
for (i=0;i<sizeof(pci_ids)/sizeof(pci_ids[0]);i++) {
int devid;
for (devid=pci_ids[i].device_id_start;devid <= pci_ids[i].device_id_last; devid++)
if ((detected_pci_dev = __find_device(lt_dev, pci_ids[i].vendor_id, devid)))
return TRUE;
}
if (vendor_id && device_id && (detected_pci_dev == __find_device(lt_dev, vendor_id, device_id)))
return TRUE;
}
return FALSE;
}
static
void lt_put_pci_dev(void)
{
if (detected_pci_dev)
pci_dev_put(detected_pci_dev);
detected_pci_dev = 0;
}
static
void __timer_wrapper(unsigned long data)
{
((void (asmlinkage *)(unsigned long))data)(0);
}
asmlinkage
void lt_add_timer(void (asmlinkage *timerfunction)(unsigned long))
{
timerList.expires = jiffies+HZ/100; // 10ms delay
timerList.function = __timer_wrapper;
timerList.data = (unsigned long)timerfunction;
add_timer(&timerList);
}
asmlinkage
dword VMODEM_Get_System_Time(void)
{
struct timeval time;
// TODO: investigate if it is safe to call gettimeofday from bh context
do_gettimeofday(&time);
return time.tv_usec/1000 + time.tv_sec*1000;
}
asmlinkage
void lt_init_timer(void)
{
init_timer(&timerList);
}
asmlinkage
byte inp(word addr)
{
return inb(addr);
}
asmlinkage
void outp(word addr, byte value)
{
outb(value, addr);
}
asmlinkage
word inpw(word addr)
{
return inw(addr);
}
asmlinkage
void outpw(word addr, word value)
{
return outw(value, addr);
}
asmlinkage
dword inpd(word addr)
{
return inl(addr);
}
asmlinkage
void outpd(word addr, dword value)
{
return outl(value, addr);
}
asmlinkage
byte dp_regread(byte reg)
{
unsigned long flags;
byte ret;
spin_lock_irqsave(&modem_driver_lock, flags);
ret = dp_regread_nonint (reg);
spin_unlock_irqrestore(&modem_driver_lock, flags);
return ret;
}
asmlinkage
void dp_regwrite(byte reg, byte value)
{
unsigned long flags = 0;
spin_lock_irqsave(&modem_driver_lock, flags);
dp_regwrite_nonint(reg, value);
spin_unlock_irqrestore(&modem_driver_lock, flags);
}
static
byte modemPortOpen(void)
{
return vxdPortOpen();
}
static
byte modemPortClose(void)
{
vxdPortClose();
return 0;
}
int lt_lucent_detect_modem(struct ltmodem_res *pltmodem_res)
{
int val = 0;
if (!Forced[3]) {
val = lucent_detect_modem(pltmodem_res);
if (val)
lt_put_pci_dev();
else
printk(KERN_INFO "Detected Parameters Irq=%d BaseAddress=0x%x ComAddress=0x%x\n",
Irq,BaseAddress,ComAddress);
}
if (Forced[0]>0 && Forced[1]>0 && Forced[2]>0) {
Irq = pltmodem_res->Irq = Forced[0];
BaseAddress = pltmodem_res->BaseAddress = Forced[1];
ComAddress = Forced[2];
printk(KERN_INFO "Forced Parameters Irq=%d BaseAddress=0x%x ComAddress=0x%x\n",
Irq,BaseAddress,ComAddress);
// fake it
val = 0;
}
return val;
}
int lt_get_modem_interface(struct ltmodem_ops *ops)
{
ops->detect_modem = lt_lucent_detect_modem;
ops->init_modem = lucent_init_modem;
ops->PortOpen = modemPortOpen;
ops->PortClose = modemPortClose;
ops->read_vuart_register = read_vuart_port;
ops->write_vuart_register = write_vuart_port;
ops->app_ioctl_handler = app_ioctl_handler;
ops->dsp_isr = dp_dsp_isr;
ops->put_pci_dev = lt_put_pci_dev;
ops->io_lock = &modem_driver_lock;
ops->virtual_isr_ptr = <_rs_interrupt;
return 0;
}
EXPORT_SYMBOL(lt_get_modem_interface);
/* broken, unused */
/*
* struct pci_dev *lt_get_dev(void)
* {
* static struct pci_dev *correct_dev;
* if (unlikely(!correct_dev))
* correct_dev = dev;
* return correct_dev;
* }
* EXPORT_SYMBOL(lt_get_dev);
*/
int __init lm_init_module(void)
{
extern byte eeprom[];
printk(KERN_INFO "Loading %s version %s\n", modem_name, modem_version);
eeprom_flag = 0;
eeprom[0] = LT_COUNTRY_ID; // set the country ID for the Lucent modem
return 0;
}
void __exit lm_cleanup_module(void)
{
printk(KERN_INFO "Unloading %s: version %s\n", modem_name, modem_version);
}
module_init(lm_init_module);
module_exit(lm_cleanup_module);
MODULE_DESCRIPTION("Lucent/Agere linmodem controller driver");
MODULE_LICENSE("Proprietary");
void lin_kill(void) {}
void lin_wake_up(void) {}
void lin_interruptible_sleep_on(void) {}
int lin_signal_pending(void) {return 0;}
int function_1(int (*fn)(void *), char *a) {return 0;}
int function_2(char *p) {return 0;}
#!/bin/bash
# Basically, configures needed files and compiles the drivers by:
# scanning for Lucent DSP PCI card modem
# accommodates non-version matched compiles
# configure engine, from Chris Hebeisen
# make the drivers, Mark Spieth
# pop-up messages when User flaws are anticipated, Marv Stodolsky
# Feel entirely free to hack out sections.
# 2002Jan24, MarvS
# Define version
VER=8.31b1
case $VER in
*RELEASE* )
;;
* )
;;
esac
RECORD=BLDrecord.txt
# BaseName way be inherited from build_rpm or build_deb
if test -z "$BN" ; then
BN=`basename $0`
fi
if [ "$BN" = "build_module" ] ; then
export BN=$BN
export RECORD=$RECORD
# for use by called executables
FV="$1"
# alternatively FV may be inherited from build_deb or build_rpm
else
# inheritance from ./build_rpm
FV=$FV
fi
# FV == Forced Version
SYS=`uname -r`
export SYS
if test -n "$FV" ; then
TARGET_VERSION=$FV
else
TARGET_VERSION=$SYS
fi
MAJOR=`echo $TARGET_VERSION | cut -d. -f1-2`
export MAJOR
KVER=`echo $TARGET_VERSION | cut -d- -f1`
export KVER
KEXT=`echo $TARGET_VERSION | cut -d- -f2`
export KEXT
# for rpm Distro -CPU.rpm with CPU exported from build_rpm
if test -z "$CPU" ; then
CPU=`uname -m`
fi
if [ "$MAJOR" = "2.2" ] ; then
cat<<END
The core DSP code represented by the versions 8.nn ltmdmobj.o is not compatible with 2.2.nn source code.
Please use the ltmodem-6.00c.tar.gz to build drivers and installers for 2.2.nn kernels.
Exiting
END
exit
fi
TMPM=./tmpfile
export TMPM=$TMPM
GCC_INPUT=`cat /proc/version`
GCC_PC=`for i in $GCC_INPUT ; do echo $i ; done | grep -A2 gcc | grep -A1 ersion | grep -v ersion`
GCC_TEST=`echo $GCC_PC | cut -d. -f1`
echo $GCC_TEST > $TMPM
if grep "-" $TMPM >/dev/null ; then
GCCKNL=`echo $GCC_TEST | cut -d- -f2`
else
GCCKNL=$GCC_TEST
fi
cat<<EOF>>/dev/null
# MarkS - this prohibition no longer necessary
if [ "$GCCKNL" = "2" ] ; then
cat<<END
For Linux kernels assembled with a version 2.9n compiler,
the ltmodem-8.26a.tar.gz at http://ltmodem.heby.de must be used.
This kernel was assembled with a compiler of version:
$GCC_PC
Exiting
END
exit
fi
EOF
# FAST is usually exported from build_rpm or build_deb.
# When is exists, FAST=anything as contrasted to FAST=
# pauses and "read -p" sections are bypassed.
# FAST=anything
if [ -z "$FAST" ]; then
cat<<END
Lucent/Agere_Systems(AS) DSP chip modems (but Not the AMR or soft PCI chipsets)
are supported by the the resources of this kit.
AS maintainer S. Sarkar develops the code on a Red Hat Linux test bed.
The lt_serial.o Serial Interface module comes under GPL and is Open Source.
The lt_modem.o code is entirely proprietary, though partially Open Source.
Adaptation to ongoing changes in Linux source code is enabled by the Open Source components.
Critical AS proprietary information is pre-complied in ltmdmobj.o,
whose constituents are functionally not affected by minor Linux source code changes.
Volunteer maintainers periodically receive code updates from AS.
Through the contributions of Many described in CREDITS, there are
enhancements in utility, ease of installation and documentation.
Mark Spieth initiated this ltmodem compiler kit series.
Chris Hebeisen introduced the Configure implementation, bringing Newbie friendliness.
Marv Stodolsky is culpable for the verbose messaging.
Within DOCs/, Ltmodem.html has URLs to many particular usage cases.
Volunteers assemble the ltmodem-version.deb and
ltmodem-version.rpm Installers for the User Community as Linux source code evolves
utiliizing the resources of this compiler kit series.
If new to compiling, read the ModemCompiling.txt which is being output, to guide
proper set up your kernel-sources. The kernel-source package as installed does
NOT in general match an installed kernel, but one of several alternative kernels.
Thus with a niave usage, all could be completed well technically.
BUT the installed drivers might not be compatible with your kernel,
of even reside in the needed /lib/modules/Kernel_Version/ tree.
END
read -p "To continue, Enter"
cat<<END
This compilation process is likely Not necessary to work through,
if the only need is modem drivers matching the standard kernel of the
following Linux distributions: Debian, Red Hat, Mandrake, SuSE and Connectiva
Volunteers have already compiled most standard drivers. For more current releases,
those available compatible with your System requirements will be later listed.
They are available for download as ltmodem-version.rpm and
ltmodem-version.deb Installers from a repository, http://ltmodem.heby.de
If your System can use one of these Installers, you will be informed below.
Many installers for older kernels are available at:
http://linmodems.technion.ac.il/packages.html
The compiling process is a learning experience for Newbies.
We strongly recommend that you DO learn it sometime.
But getting on the Internet under Linux should have first priority.
This kit provides several diagnostics aids and good documentation.
Continuing will do no harm. Useful diagnostic information
on your system will be written to BLDrecord.txt,
with direction to documentation if a failure occurs.
At a minimum, Do keep the DOCs/ and utils/ folders and become familiar
with the resources therein.
END
read -p "To continue: Enter"
echo "================================================================="
AGERE=`echo $VER | cut -c 1-4`
VEREND=`echo $VER | cut -c 5-9`
cat<<END
This is the version $VER of the compiler + installer kit
$AGERE corresponds to the version of the core Agere Systems DSP code.
$VEREND designation that follows reflects NO improvement in DSP code.
Rather peripheral driver, added diagnostics and installer improvements
are reflected. They are progressively implemented as Users report problems
or the Linux kernel evolves.
The modem drivers will serve with Linux kernels beginning with 2.2.2, the current
2.4.nn series, and the 2.5.nn development kernels.
However support was broken in the early 2.4.n-test series.
When there is a Red Hat 2.6.nn release, AS will then update the code
If your PC is being well served with this $VER,
there is NO Benefit in using a more recent version
until there is an update in the Agere driver code, say 8.26 to 9.00.
But if the driver installation for a new kernel should in some way fail,
please do download the most recent ltmodem-VER.tar.gz
before sending a query to discuss@xxxxxxxxxxxxx,
because the problem may already be solved.
This $BN script only compiles drivers,
with their installation managed by subsequent commands.
Thus $0 can be rerun for education or amusement,
without as yet committing changes to your System.
END
read -p "For general instructions: Enter"
cat<<END
=================================================================
All should work automatically for most Linux installations/distributions,
IF a complete kernel-headers/ folder is available:
through a symbolic link: /lib/modules/KernelVersion/build --> PATH_to/kernel-headers/
at the classical /usr/src/ position.
Otherwise a symbolic link will be necessary:
ln -s PATH_to/kernel-headers/ /usr/src/linux
Read ModemDriverCompiling.txt if an explanation is needed about kernel-headers.
To compile modules for a kernel other version than $SYS, such as version 2.2.17-3test, use syntax:
$0 2.2.17-3test
where the version.h in the kernel-headers/ folder has 2.2.17-3test
END
### Restore this section to display the instruction section for:
# echo "To compile multiple driver pairs to support multiple Lucent modems"
# echo " in the same PC, Enter: $0 -n N "
# echo " when N is the number of desired driver pairs."
# echo "This option is only supported when drivers to be compiled"
# echo " and the running kernel are version matched."
# echo
### End multi-driver instruction section.
echo If desirable to make a record for trouble shooting purposes,
echo Abort with Ctrl-C. Then the process can be recorded to ltrecord.txt :
echo
echo " $0 $1 $2 $3 $4 | tee ltrecord.txt"
echo
read -p "To continue: Enter"
echo
echo "===================================================================="
echo Diagnostic information is progressively being written to $RECORD .
echo "Often, contents of $RECORD will aid in solving a problem."
echo
fi # end 1st FAST section
# Acquire distribution data
DISTRO_FILES="redhat-release SuSE-release mandrake-release conectiva-release \
bluepoint-release slackware-version gentoo-release debian_version knoppix_version fedora-release"
# redhat MUST proceed mandrake in this listing as Mandrake has an /etc/redhat-release
for i in $DISTRO_FILES
do
if [ -a /etc/$i ] ; then
DISTRO=$i
# generating short name
if [ -n "$DISTR" ] && [ "$DISTRO" = "fedora-release" ] ; then
FEDORA=1
else
DISTR=`ls /etc/$i | cut -d/ -f3 | cut -d"-" -f1`
fi
if [ "$DISTR" = "debian_version" ] ; then
DISTR=debian
fi
if [ "$DISTR" = "knoppix_version" ] ; then
DISTR=knoppix
fi
DVERSION=`cat /etc/$i`
fi
done
if [ -z $DISTRO ] ; then
DISTR="Not_identified"
echo "The distribution is $DISTR"
echo " Please report the identifying /etc/FileName to discuss@xxxxxxxxxxxxx"
else
echo "The Linux distribution is: $DISTR, $DVERSION "
fi
export DISTR=$DISTR
# Starting $RECORD
cat<<END>$RECORD
Together with information included in DOCs/
this report may enable you to solve problems.
But if further help is needed, send $RECORD to discuss@xxxxxxxxxxxxx
Please use the following in the email Subject Line:
SUBJECT=Lucent modem, $DISTR $DVERSION $SYS
Issue=`cat /etc/issue | cut -d'\' -f1`
$SUBJECT
DISTRO=$DISTRO
DISTR=$DISTR
DVERSION=$DVERSION
ACTION="$0 $1 $2 $3 $4 $5
WHOAMI=`whoami`
TARGET_CPU=$CPU
`date`
`uname -a`
END
if [ "$TARGET_VERSION" != "$SYS" ] ; then
echo TARGET_VERSION=$TARGET_VERSION
fi
MSG="If you cannot solve the problem, send $RECORD to: discuss@xxxxxxxxxxxxx"
export MSG=$MSG
echo >> $RECORD
echo " End of distribution check."
echo
# starting 2nd FAST section
if [ -z "$FAST" ]; then
# Calling scanPCI utility
utils/scanmodem
echo
read -p "To continue: Enter"
echo ==================================================
echo
echo Checking for any preliminary complications.
if [ -L /usr/src/linux ] ; then
HEADERS_INCLUDE=`ls -l /usr/src/linux | cut -d'>' -f2`
if [ "$HEADERS_INCLUDE" = "/usr/include" ] ; then
echo HEADERS_INCLUDE=$HEADERS_INCLUDE >> $RECORD
echo " WARNING!!!"
echo On your system. the symbolic link /usr/src/linux is currently set to /usr/include/
echo While /usr/include/ does have system headers, BUT only a partial set of All kernel-headers.
echo This subset is NOT adequate for compiling drivers!!
echo A complete kernel-header package must either be installed or compiled.
echo
echo For some Linux distributions, the package NAMED kernel-headers-SomeVersion
echo installs to /usr/include/. These are the incomplete set suitable as System headers.
echo
echo If a complete kernel-header package is provided by your Linux distribution,
echo "these headers will be installed as: /usr/src/kernel-headers-$SYS"
echo Read DOCs/Compile-properly.txt for details.
echo Read DOCs/Compile-properly.txt >> $RECORD
echo While it will do no harm to continue, $0 will fail later.
echo
read -p "Abort with Ctrl-C, but to continue: Enter"
echo =============================================================
else
echo Bad links to /usr/include not evident.
fi
else
echo " No false /usr/include/ symbolic link">>$RECORD
fi
if [ "$TARGET_VERSION" = "2.6.5-1.358" ] ; then
cat<<END | tee -a $RECORD
Fedora 2 with kernel version-2.6.5-1.358, is not supported by this ltmodem resource.
It has an undersirable feature for compiling, which is improved in later kernel updates.
There are two options Lucent/Agere DSP chipset support:
1) The easiest is to update the System with any more recent fedora 2 kernel-image package.
Kernel-headers needed for compiling will be co-installed into
/lib/modules/KernelVersion/build/
Then build_module from the ltmodem-8.31aN.tar.gz at http://ltmodem.heby.de will succeed.
2) To get online under kernel 2.6.5-1.358,
Install and configure a kernel-source-2.6.5 package through "make bzImage", including:
cd /usr/src/linux
make mrproper
cp /boot/config-2.6.5-1.358 .config
and do NOT forget the "." before config
cp Makefile Makefile.orig
Edit the 4th line ONLY of the Makefile to:
EXTRAVERSION = -2.6.5-1.358
make oldconfig
make bzImage
which will include assembly of needed kernel-headers
Then use the 2.6.5-1.358 proficient ltmodem-2.6-alk-6.tar.bz2 served from:
http://linmodems.technion.ac.il/packages/ltmodem/kernel-2.6/
Read its documentation carefully as manually port creation and some line editing is needed.
END
echo
echo Read BLDrecord.txt, now aborting.
echo
exit
fi
## Modem drivers will work with SMP kernels beginning with now.
if [ -r /boot/config-$TARGET_VERSION ] && [ -z "$FV" ] ; then
CONFIG=/boot/config-`uname -r`
SMP0=`grep CONFIG_SMP $CONFIG | grep =`
if test -n "$SMP0" ; then
echo SMP=$SMP >> $RECORD
echo Your current kernel has Symmetric Multi Processors enabled.
echo Beginning with ltmodem version 8.30a, the modem drivers should be SMP competent.
echo
else
echo The kernel supports only single processor motherboards.
fi
echo
read -p "To continue: Enter"
echo ==================================================
else
echo Kernel config file not recognized within the /boot folder.
fi
echo
if [ "$DISTRO" = "SuSE-release" ] && [ $UID -ne 0 ] ; then
echo For the SuSE Linux distribution,
echo access to kernel-headers requires Root permission.
echo "So start $0 again, log into a console with: su - root"
echo
exit 2
fi
if [ "$DISTRO" = "redhat-release" ] ; then
echo For the Red hat Linux distribution,
echo there are four alternative kernel config files
echo within the folder /usr/src/linux/configs/
echo The kernel-header set to be used in this driver compile
echo MUST flavor match of your current kernel as displayed by:
echo " uname -r"
echo Otherwise ./build_module will succeed and ./ltinst2 also.
echo But there will be a failure during the system update
echo " depmod -a included within ./autoload"
echo To check this issue if desirable, abort with Ctrl-C
read -p "or to continue: Enter"
echo =================================================
fi
echo OK thus far.
read -p "To begin acquisition of compiling information: Enter"
echo
fi
# end 2nd FAST section
# defines code folder
BASE=source
echo BASE=$BASE >> $RECORD
if [ -f $BASE.tar.gz ]; then
if [ -d $BASE ] ; then
echo "Removing old makings and expanding a clean source.tar.gz "
fi
rm -rf $BASE
tar zxf $BASE.tar.gz
echo CPU='"'$CPU'"' >> $BASE/SETTINGS
# Accomodating SuSE nomenclature in ltmodem.spec
if [ "$DISTR" = "SuSE" ] && [ "$CPU" = "athalon" ] ; then
echo KPKG='"'k_deflt'"' >> $BASE/SETTINGS
else
echo KPKG='"'kernel'"' >> $BASE/SETTINGS
fi
# passed to ltmodem.spec
if test -n "$FV" ; then
export FV=$FV
fi
source $BASE/SETTINGS
echo "# ===SETTINGS===" >> $RECORD
cat $BASE/SETTINGS >> $RECORD
echo >> $RECORD
# copy DOCs/ stuff to the source dir to support later
# packaging by build_rpm and build_deb
cp -a DOCs utils $BASE
# move to work space
cd $BASE
ln -s ../$RECORD $RECORD
echo Setting $RECORD link within $BASE/ folder.
ls -l $RECORD
TEST=0
ln -s ../$TMPM $TMPM
echo Setting $TMPM link within $BASE/ folder.
ls -l $TMPM
else
TEST=1
fi
## Support for multiple driver pairs
[ -z "$MAKECOUNT" ] && MAKECOUNT=1
# check for number of drivers to make
if [ "$1" = "-n" ]; then
shift
MAKECOUNT=$1
echo MAKECOUNT=$MAKECOUNT >> $RECORD
shift
[ -z "$MAKECOUNT" ] && MAKECOUNT=1
fi
## Getting driver names from source/SETTINGS
source SETTINGS
## Starting Forced version
if test -n "$FV" ; then
shift
FVNAME=$FV
echo "Checking for kernel-headers needed for compiling.">>$RECORD
SRCS=`ls -d /lib/modules/*/build /usr/src/k* /usr/src/l* 2>/dev/null | grep -v .gz | grep -v .bz`
if test -n "$SRCS" ; then
for dir in $SRCS
do
if test -r $dir/include/linux/version.h ; then
echo " ... in $dir: "
# check for right version
if grep "$FV" $dir/include/linux/version.h >/dev/null ; then
echo "The kernel-headers have base folder: ">>$RECORD
FVDIR=$dir
echo "Kernel headers found in $FVDIR"
SRCS=
fi
fi
done
fi
if test -z "$FVDIR"
then
echo
echo "ERROR: No kernel headers found."
echo "If a kernel-headers folder is installed, please set a symbolic link:"
echo " ln -s PATH_TO/kernel-headers-SomeVersion/ /usr/src/linux"
echo "Then restart with command:"
echo " /"$BN" SomeVersion "
echo "If more instruction is needed, within DOCs/ read ForNewbies and Compile_fail.txt"
echo
exit 1
else
echo " using $FVDIR"
fi
if test -f $FVDIR/include/linux/version.h ; then
cat - > utsrelease.c <<END
#include "$FVDIR/include/linux/autoconf.h"
#include "$FVDIR/include/linux/config.h"
#include "$FVDIR/include/linux/version.h"
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main(int argc ,char** argv){
printf("%s",UTS_RELEASE);
return(0);
}
END
gcc -I$FVDIR/include -o utsrelease utsrelease.c
VH=`./utsrelease`
rm -f utsrelease*
fi
if [ "$FVNAME" = "$VH" ] ; then
echo "Found kernel-headers-$FV for compiling drivers."
echo
else
echo "Folder for kernel-headers-$FV not found through $FVDIR. Name was $VH"
echo
echo $MSG
echo
exit 2
fi
## configure force/enable options
# --with-force= force build even if kernel sources don't match
# running kernel yes:[no]
# --with-kernel=dir provide the directory with kernel headers
#
FORCED="--with-force=yes --with-kernel=$FVDIR"
echo FORCED=$FORCED >> $RECORD
echo "Your running kernel is version-$SYS,"
echo " but the modem drivers will be compiled for a $FV kernel."
else
echo "Following a successful check for matching kernel-headers,"
echo "the modem drivers will be compiled for the current kernel version: $SYS"
fi
echo FV=$FV >> $RECORD
if [ -z "$FAST" ]; then
read -p "To start resource tests: Enter"
fi
echo
## Check for configure prerequisites, 1st capture output and parse
CONF_OUT=../conf-report.txt
echo Performing a configure trial and capturing the report to $CONF_OUT.
./configure $FORCED &> $CONF_OUT
# The below grep -v db3 eliminates an irrelevant rpm related error message
# which would cause an abort, when parsed subsequently.
if [ "$BN" = "build_module" ] || [ "$BN" = "build_deb" ] ; then
cat $CONF_OUT | grep -v db3 > ../conf-report.txt
fi
echo "Parsing the report:"
# Cutting either error or ERROR from $CONF_OUT
CONF_FAIL=`cat $CONF_OUT | grep -i error | cut -d: -f2`
# Alternative actions following parse outcomes
if test -z "$CONF_FAIL" ; then
# This is the tentative SUCCESS case, contingent upon modversions.h
# Display filtered CONF_OUT
echo " No evident problems."
echo
HEADERSIN=`grep "KERNEL_DIR :=" Makefile | cut -d' ' -f3`
HEADERS_IN=$HEADERSIN/include/linux/
# echo HEADERS_IN=$HEADERS_IN
sleep 3
# to exclude debian related messages during build_module.
if [ "$BN" = "build_module" ] ; then
cat $CONF_OUT | grep -v deb | grep -v package
else
# to exclude debian related messages from during build_rpm.
cat $CONF_OUT | grep -v deb | grep -v fakeroot
fi
grep using $CONF_OUT >> $RECORD
grep "are version" $CONF_OUT >> $RECORD
if grep "using /usr/src/linux" $CONF_OUT > /dev/null ; then
echo "ls -l /usr/src/linux" >> $RECORD
ls -l /usr/src/linux >> $RECORD
fi
cat $CONF_OUT >> $RECORD
echo >> $RECORD
if grep $TARGET_VERSION/build $CONF_OUT > /dev/null ; then
echo "BUILD_LINK=/`ls -l /lib/modules/$TARGET_VERSION/build | cut -d'/' -f2-`" >> $RECORD
fi
rm $CONF_OUT
if [ "$BN" = "build_rpm" ] ; then
echo >> $RECORD
echo ------ Requires: within ltmodem.spec ---------- >> $RECORD
grep Requires: ltmodem.spec >> $RECORD
echo >> $RECORD
fi
# if [ "$BN" = "build_deb" ] ; then
# cp debian/control ../
# fi
echo
echo "The check for compilation tools and general resources was successful."
echo Within DOCs/ there is an annotated conf-report.txt
echo "The Makefile and down steam installation scripts have been created."
echo
if test -z "$FAST" ; then
echo To continue:
read -p " Enter"
else
sleep 3
fi
if [ "$MAJOR" = "2.4" ] ; then
echo "Next checking for the the needed header file: modversions.h"
echo HEADERS_IN=$HEADERS_IN >> $RECORD
if [ -f "$HEADERS_IN"modversions.h ] ; then
MODVERH=yes
echo Found: "$HEADERS_IN"modversions.h
else
cat<<END | tee -a $RECORD
Sorry, assembly of the needed header file: modversions.h"
was not specified during configuration of the kernel sources.
Withing the section LOADABLE MODULE SUPPORT:
[*] Set version information on all module symbols
which is necessary to specify the assembly of modeversions.h
Consequently compiling of the drivers will fail at the next step.
Properly configuring your sources may be aided by for RPM using Distros"
by: utils/srcprep"
for RPM using Distros
and for Debian style Distros, the resources of kernel-package.deb
END
echo MODVERH=$MODVERH >> $RECORD
fi # MODversiohns
fi # 2.4
echo >> $RECORD
echo
echo Next checking utilty versions,
if [ -f /usr/src/linux/Documentation/Changes ] ; then
# This block is just a trivia service
CHANGES=/usr/src/linux/Documentation/Changes
if [ "$MAJOR" = "2.2" ] ; then
FILTER="; "
else
FILTER="# "
fi
WRITE="../Utility_version_tests.txt"
echo > $WRITE
echo From $CHANGES for sources version $MAJOR >> $WRITE
echo "Utility Version_min Version test" >> $WRITE
echo ---------------------------------------------------------------- >> $WRITE
grep $FILTER $CHANGES >> $WRITE
echo >> $WRITE
MAKE=`make -v | grep version | cut -d, -f1 | cut -d' ' -f4`
if test -z "$MAKE" ; then
MAKE=`make -v | grep Make | cut -d' ' -f3`
if test -z "$MAKE" ; then
MAKE="missing, please install: make"
fi
fi
fi
echo " Version_min "
echo " Utility or range for kernels "
echo " name 2.2.16 2.4.18 Actual_version "
echo -------------------------------------------------------------------
echo "Gnu C 2.7.2.3 2.95.3-2.9.99 `gcc -dumpversion`"
echo "Gnu make 3.77 3.79.1 $MAKE"
echo "binutils 2.8.1.0.23 2.9.1.0.25 `ld -v | grep version | cut -d' ' -f4`"
echo
echo Next checking utilty versions, with ranges >> $RECORD
echo " Version_min " >> $RECORD
echo " Utility or range for kernels " >> $RECORD
echo " name 2.2.16 2.4.18 Actual_version " >> $RECORD
echo -------------------------------------------------------------------
echo "Gnu C 2.7.2.3 2.95.3-3.2.1 `gcc -dumpversion`" >> $RECORD
echo "Gnu make 3.79.1 3.77 $MAKE" >> $RECORD
echo "binutils 2.8.1.0.23 2.9.1.0.25 `ld -v | grep version | cut -d' ' -f4`" >> $RECORD
echo >> $RECORD
cat <<END > $TMPM
The gcc compiler resources available are:
----------------------------
`ls -l /usr/bin/gcc* | grep -v gccbug`
----------------------------
with your System currently using version `gcc -dumpversion`
Do NOT mix the Major.Minor versions of compilers for the kernel and modem drivers!
Drivers may fail to load with warning:
Invalid module format!!"
See http://linmodems.technion.ac.il/archive-fifth/msg04252.html
END
cat $TMPM
cat $TMPM >> $RECORD
if test -z "$FAST" ; then
echo To continue:
read -p " Enter"
else
sleep 3
fi
else
# These are the various configure failure cases
if test -n "$CONF_FAIL" ; then
grep ERROR $CONF_OUT >> $RECORD
fi
echo >> $CONF_OUT
echo $CONF_FAIL
echo A sample successfull conf_out.txt is in the folder DOCs/
ERRORMSG="Read in DOCs/ ForNewbies, Compile-Properly.txt and Flavor.txt"
if grep error $CONF_OUT | grep cc > /dev/null ; then
echo Basic utilities required for compiling have not been installed on your System.
echo $ERRORMSG
echo $ERRORMSG >> $RECORD
echo
fi
if grep "ERROR: No kernel headers found." $CONF_OUT > /dev/null ; then
echo $ERRORMSG
echo $ERRORMSG >> $RECORD
echo
fi
if [ "$DISTRO" = "redhat-release" ] ; then
echo >> $RECORD
echo "For Red Hat Linux, config files corresponding to the running kernel $SYS" >> $RECORD
echo " are contained in: /usr/src/linux/configs/" >> $RECORD
echo " The appropriate one must be used to specify matching kernel-headers" >> $RECORD
fi
if [ "$DISTRO" = "SuSE-release" ] || [ $UID -ne 0 ]; then
echo "For the Linux distribution SuSe and perhaps Others,"
echo " the resource test failure may merely be"
echo " because Root permission is needed to access kernel-headers/ folders."
echo "Login in as Root and re-run $0"
echo "For the Linux distribution SuSe and perhaps Others," >> $RECORD
echo " the resource test failure may merely be" >> $RECORD
echo " because Root permission is needed to access kernel-headers/ folders." >> $RECORD
echo "Login in as Root and re-run $0" >> $RECORD
echo >> $RECORD
fi
ls -l /usr/src/linux > header.txt
if grep include header.txt > /dev/null ; then
grep include header.txt >> $RECORD
echo
echo "While there is a kernel-headers Sub_Set in /usr/include/"
echo "it is NOT adequate for compiing drivers!!!"
echo "If the COMPLETE kernel-headers set is NOT in the standard /usr/src/ position,"
echo "a symbolic link will be necessary:"
echo " ln -s PATH_TO/kernel-headers/ /usr/src/linux"
echo "Within DOCs/, ForNewbies, Compile-fail.txt and Flavor provide relevant details."
echo
rm header.txt
fi
echo Here is the report from $CONF_OUT
echo ------------------
cat $CONF_OUT
echo ------------------
echo
echo Read instructions at the end of $RECORD
echo
exit 2
fi
if [ "$MAJOR" = "2.4" ] ; then
SUF=o
else
SUF=ko
fi
echo
if [ -z "$FAST" ]; then
read -p " To begin compilation of $LT_PROPRIETARY_MODULE.$SUF and $LT_SERIAL_MODULE.$SUF , Enter"
fi
echo
cat<<END
To avoid faulting Systems with an Enviromental setting: make -e
make
is the compiling command used with build_module.
To modify "make" invocation on your System, if desirable,
edit the build_module line below: MAKEE
END
sleep 3
## MAKEE
make | grep -v echo 2>&1 | tee -a $RECORD
echo
echo "Checking for driver products:"
# MODULES="lt_modem.$SUF lt_serial.$SUF"
MODULES="$LT_PROPRIETARY_MODULE.$SUF $LT_SERIAL_MODULE.$SUF"
for i in $MODULES
do
if [ -f $i ] ; then
ls -l $i
ls -l $i >> $RECORD
else
cd ..
echo
echo Compilation of $i failed,
if [ -z "$MODVERH" ] && [ "$MAJOR" = "2.4" ] ; then
echo as expected from absence of modversions.h
else
echo "Do assess whether your utilities are up to date as listed within 1ST-READ!"
fi
echo "Read Compile_properly.txt from DOCs/."
echo $MSG
echo >> $RECORD
echo $MSG >> $RECORD
echo
exit 2
fi
done
echo
# depmod -e ,Dependencies test section removed because 2.6.n depmod only accepts on module. There cannot be run
# depmod -e -F System.map ltmodem.ko ltserial.ko
echo
echo "==========================================================================="
echo >> $RECORD
echo
if [ -z "$FAST" ]; then
read -p " Enter, to finish $0"
echo
fi
if [ $TEST = 0 ]; then
# Storage folder for drivers
if [ -n "$FV" ] ; then
MISFOLDER=../drivers-$FV
else
MISFOLDER=../drivers-$SYS
fi
if test ! -d $MISFOLDER ; then
mkdir $MISFOLDER
fi
echo Copying newly compiled drivers to folder $MISFOLDER as a backup,
echo " as the source/ folder will be deleted during next run of: $BN"
cp lt*.$SUF $MISFOLDER
ls -l $MISFOLDER
echo
## Back out of source/
cd ..
/bin/rm 0tmp* &>/dev/null
# RECORD=BLDrecord.txt
LINKS="$LT_PROPRIETARY_MODULE.$SUF $LT_SERIAL_MODULE.$SUF autoload ltinst2 cleanup ltuninst2"
# Removing symbolic links if kernel-headers and kernel-version are mis-matched or not build_module
if test -n "$FV" || test "$BN" != "build_module" ; then
echo Removing installation links if necessary:
echo which should NOT be used when the modem drivers
echo are Not version or flavor matched with the current kernel-$SYS
echo or after assembly of Debian or RPM installer packages.
for link in $LINKS
do
if [ -L $link ] ; then
rm $link
echo Removed symbolic link: $link
fi
done
if test -n "$FV" ; then
echo
echo Two steps in the complete installation procedure are not implemented
echo when a forced versioning is implemented : FORCED=$FORCED
echo is implemnted:
echo "First, the modem device nodes are not made;"
echo "Second autoloading of the drivers are not provided for."
echo "Do browse the files in DOCs/ should you wish to proceed thus By Hand."
echo
fi
else
# Making symbolic links for continuing installation, if not present already.
echo
if [ "$BN" != "build_module" ] ; then
LINKS="$LT_PROPRIETARY_MODULE.$SUF $LT_SERIAL_MODULE.$SUF"
fi
echo Making symbolic links: $LINKS
for link in $LINKS
do
if [ ! -L $link -a -f $BASE/$link ] ; then
ln -s $BASE/$link $link
fi
done
fi
## always KEEP ltuninst2 and cleanup links
# echo Verifying cleanup links.
KEEP="cleanup ltuninst2"
for FILE in $KEEP
do
if [ ! -L $FILE -a -f $BASE/$FILE ] ; then
ln -s $BASE/$FILE $FILE
fi
done
fi #TEST=1
if [ -z "$FAST" ]; then
if [ -n "$FV" ] ; then
echo For useful methods of packaging drivers read DOCs/Options.txt
else
echo
echo "A diagnostic record has been saved to $RECORD and $RECORD.2"
echo "To install the modem drivers in the Search Path for modules, run:"
echo " ./ltinst2"
echo "This command does require Root permission."
echo "For advanced User alternatives to this installation route,"
echo "involving assembly of RPM or Debian installers, read DOCs/Options.txt"
echo
fi # FV
# Reminder to save and terminate the ltrecord.txt
if [ -f ltrecord.txt ] ; then
echo " To continue the ltrecord.txt in the next step, use "
echo " ./ltinst2 | tee -a ltrecord.txt"
echo
fi
fi # FAST
rm $TMPM*
echo