LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-31-2012, 08:14 AM   #1
orcaja
Member
 
Registered: Aug 2008
Posts: 94

Rep: Reputation: 1
Unhappy Old driver, new kernel, how to compile?


Hi there!

I know there are some threads like this one. I have an old driver for a DAQ. This is a package for Debian 4. I have been asked to install it on Debian 6. I asked to the manufacturer about a newer driver, but they answered me that they don't have the resources to do the code changes . I have seen similar posts out there and it seems that the solution is to recompile again, but I don't have a clue about how to do that. I guess the first step is to ask the manufacturer for the source code right?, and then what would be the next step?

Any advice, comment, solution, etc. is very welcome.

Thank you.
Joc
 
Old 01-31-2012, 08:32 AM   #2
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
Maybe Debian 6 can install the package you have and make it work. Maybe not.

But, is "DAQ" for a data aquisition machine? In this case, the company might not have much interest in keeping the source code as a secret, wich is good for your interest.

If you can get the source code for the driver, I think you will be fine.

There are no general compiling steps. You need the source files before you can know how exactly to compile or recompile them.
 
Old 01-31-2012, 11:04 AM   #3
orcaja
Member
 
Registered: Aug 2008
Posts: 94

Original Poster
Rep: Reputation: 1
I installed the package in debian 6. After that, I tried to load the module and I got the error:
insmode: error inserting ‘advdrv_core.ko’: -1 Invalid module format

It seems this error is due to the different versions of libraries. Here are the libraries needed:
Debian 4____________Debian 6
kernel:________ 2.6.18___________currently: 2.6. 32
gcc version:____4.1.1-15 ________currently: 4.4.5
Glibc _________ glibc-2.7 _______currently: glibc2.11-1
binutils________2.18.1 _________currently 2.20.1-16

I downloaded the source, a tar.bz2 file, and run "alien", this created the new package which I installed too.
But the module were supposed to be in /usr/src/Advantech/daq/modules/ , but the package created from the source does not generate those directories and I couldn't find the modules in any other directory either (I used find / -name "module name" ). I was expecting that the source file and deb package created the same directory tree, but they don't.

Any other ideas are very welcome.
Thanks in advance everyone!

Last edited by orcaja; 01-31-2012 at 11:05 AM.
 
Old 01-31-2012, 01:03 PM   #4
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
Orcaja. The "alien" program is to convert between different package formats. For example, Debian and its derivatives use ".deb" packages. Redhat, ".rpm". Slackware ".tgz". So it is expected it would not work. The source code is used to generate packages and binaries. We do not install them directly. Loosely speaking, "compiled binaries" or just "binaries" are synonims for "packages".

You might uninstall the "source code package" from your system.

Now, you need to extract the source code to some folder. Then try to compile it. And then (maybe) install it. Or (maybe) generate a package from the compiled thing and install it.

The steps for compiling vary. See if you can find it by looking at the source package contents you extract.

Is the whole source code public, somewhat? Do you have permission to show it to the world? If it is small, try to attach it here. If it is bigger, put it into something like 4shared (or equivalents) and give the address.
 
Old 01-31-2012, 03:01 PM   #5
orcaja
Member
 
Registered: Aug 2008
Posts: 94

Original Poster
Rep: Reputation: 1
headers vs sources, what's the difference?

Thanks Dedec0

The name of the package is advdaq-1.10.0001-1.tar.bz2 (20110621), and it is here:

http://support.advantech.com.tw/supp...ource=Download

I extracted the package, but now I have more questions: I have the linux-headers in a directory, but I ran make configure and it looks for the sources. I installed the sources in another directory, and now it says that the sources are not configured... it's more complicated than I thought.

Any help is really appreciated.

Joc

P.S. Then, the files in the tar.bz2 package...are they sources or binaries?

Last edited by orcaja; 01-31-2012 at 03:58 PM.
 
Old 02-01-2012, 06:19 AM   #6
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
Yes, it might look as a bit too complicated. But its not that much... be persistent.

I think you are on the right path.

Let's see if you are doing the same as I am:

- extract the contents of advdaq-1.10.0001-1.tar.bz2 to some folder (e.g., ~/daq/)
- this creates the directory: "~/daq/advdaq-1.10.0001/" with source code in it
- README file says some steps
- trying command "make config" on "~/daq/advdaq-1.10.0001/" gives
Code:
scripts/Configure
Enter location of Linux source tree [/usr/src/linux]: 
Kernel source tree at /usr/src/linux is not configured
Fix before continuing
make: ** [config] Erro 1
Quote:
headers vs sources?
Header files are files that hold information that may be used by a compiler (like gcc) for compilation of programs. Thus, the linux header files hold information that programs might need when they are compiled.

The linux source tree is not the same. It is the linux source code (wich usually refers to the the kernel source code, alone).

So you need to get the linux source code and unpack it to "/usr/src/linux", or another directory if you so prefer.

I am using Ubuntu. I guess yours steps will be similar.

I tried searching on Synaptic (package manager) and I found a package that might fit. Look for packages with names like "linux-source" or "linux-source-2.6.38". Get the one(s) you find more appropriate.

I installed these 2 packages. Among others, it installed the file "/usr/src/linux-source-2.6.38/linux-source-2.6.38.tar.bz2". This file should contain the source code of your kernel.

Now I created "~/daq/linux/" and extracted the "/usr/src/linux-source-2.6.38/linux-source-2.6.38.tar.bz2" inside it.

After this, I tried to compile your driver (giving it /home/YOU/daq/linux/linux-source-2.6.38/" as the path to the linux source tree. But I am getting errors I can't understand much.

I am not sure if the kernel needs to be built now, and this is causing the errors. If so, you would do: Inside "/home/YOU/daq/linux/linux-source-2.6.38", configure the kernel build with "make menuconfig". And after that a simpler "make", that will take some time...

Its better that someone else continues to help you from here.

Good luck!
 
Old 02-01-2012, 10:09 AM   #7
orcaja
Member
 
Registered: Aug 2008
Posts: 94

Original Poster
Rep: Reputation: 1
Configure requires bash

I extracted the sources at /usr/src/linux/linux-source-2.6.32 and I did something like:
cd ~/daq/linux/linux-sources-2.6.32/
cp /boot/config-2.6.32-5-686/config-2.6.32-5-686 ./.config (as I saw in http://frank.harvard.edu/~coldwell/at6n00/INSTALL )
then I tried again ~/advdaq/sudo make config:
scripts/Configure
Enter location of Linux source tree [/usr/src/linux]: /usr/src/linux/linux-source-2.6.32

and I got this:

using LINUXDIR=/usr/src/linux/linux-source-2.6.32
Kernel source version is
***
*** WARNING!!!
***
*** The kernel that is currently running (2.6.32-5-686)
*** appears to be a different version than the source in
*** /usr/src/linux/linux-source-2.6.32 ().
*** If so, the current compile will create a module that is
*** INCOMPATIBLE with the running kernel. (This could be
*** what you want, however.)
***
Configure requires bash
make: *** [config] Error 1

I typed bash (nothing happened) and tried again, with the same result

Any other ideas?
Thanks in advance.

Last edited by orcaja; 02-10-2012 at 09:20 AM.
 
Old 02-01-2012, 10:55 AM   #8
orcaja
Member
 
Registered: Aug 2008
Posts: 94

Original Poster
Rep: Reputation: 1
Configure requires bash

I typed
env and in the first lines I got something like:

TERM=xterm
SHELL=/bin/bash
so, I think I am running bash, am I right?
then I started to look at the scripts, for example, in the script dep.linux I found:

if [ ! -f "$LINUXDIR/.config" ];then
echo Kernel source tree at $LINUXDIR is not configured
echo Fix before continuing
exit 1
fi

I think that's why just by having the .config file, makes the things keep going. Then, in the script named Configure, I found these lines:


. scripts/preconfigure

#
# Make sure we're really running bash.
#
# I would really have preferred to write this script in a language with
# better string handling, but alas, bash is the only scripting language
# that I can be reasonable sure everybody has on their linux machine.
#
[ -z "$BASH" ] && { echo "Configure requires bash" 1>&2; exit 1; }

# Disable filename globbing once and for all.
# Enable function cacheing.
set -f -h

...mmm I was wondering how does this script check if I'm running bash, but I don't understand it, and I haven't found anything on google yet.

just in case I tried chsh and selected /bin/bash, and I tried again sudo make config
with the same result.
anyway, any help is really appreciated.

Joc

Last edited by orcaja; 02-01-2012 at 11:16 AM.
 
Old 02-01-2012, 11:18 AM   #9
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
Yes, I don't understand either.

Try to hand edit "Makefile" at line 117 to: "/bin/bash scripts/Configure".

And then it complains about a "-h" option for "set" (in Bash, there is "-h"). I just (blindly!) took it off of line 68 of "scripts/Configure".

But it just gave another error later, when it almost seemed to work... this isn't the right way...

Last edited by dedec0; 02-01-2012 at 11:22 AM.
 
Old 02-01-2012, 11:35 AM   #10
orcaja
Member
 
Registered: Aug 2008
Posts: 94

Original Poster
Rep: Reputation: 1
I did the same, I wrote a # in front of the
[ -z "$BASH" ] && { echo "Configure requires bash" 1>&2; exit 1; } and in front of the -h, but as you said, more errors appear... mmm...

... I still wonder how did they create the deb package ...

any ideas?

Thanks in advance.

Last edited by orcaja; 02-01-2012 at 11:42 AM.
 
Old 02-01-2012, 12:44 PM   #11
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Your terminal has a history, there are 2 definate ways to check it
1 way is to open terminal& press the up arrow button
The other way is to check .bash_history file.
But looking at your post you have an extra "." in your command maybe that's the problem.
cp /boot/config-2.4.18-3 ./.config
& the command suggested was
cp /boot/config-2.4.18-3 /usr/src/linux-2.4/.config but you have to change the kernel version to that of your own kernelversion.
Did you cd to the directory copied to & do "make oldconfig"?
 
Old 02-01-2012, 01:05 PM   #12
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
Quote:
Originally Posted by orcaja View Post
... I still wonder how did they create the deb package ...
First, we compile the source code. It is what you are trying to do now.

Second, some other programs are used to generate the package from compiled things.
 
Old 02-01-2012, 01:14 PM   #13
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
Lightbulb

New thing: did you have an "mv" error, for moving a ".tmpconfig.h"? Create that destination directory. It seemed to solve it all, for me.
 
Old 02-01-2012, 01:18 PM   #14
orcaja
Member
 
Registered: Aug 2008
Posts: 94

Original Poster
Rep: Reputation: 1
If I open a terminal and type bash, apparently nothing happens only a linefeed, and If I do that again, nothing happens, apparently. But, if I type "exit", the output is "exit" too, the same number of exits as the number of bash'es I typed before, If I write exit one more time, the terminal closes. It seems to me that the bash is "nested" if it is called several times.

When I copied the file, I did was already in /usr/src/linux/linux-source-2.6.32 then I typed
cp /boot/conf(tab to complete the name) and "./" for making the destination place the same directory where I was already, and finally ".config" as the name of the file (In the previous post I just copied from the other page sorry for that)... is that right?
and after that I typed ls -htl .config and I see the .config file and the creation time, and I thought that it was fine.

Finally I did the make oldconfig.

Am I missing something?, any more ideas? I'm willing to try anything

Thanks in advance.
Joc
 
Old 02-01-2012, 01:20 PM   #15
orcaja
Member
 
Registered: Aug 2008
Posts: 94

Original Poster
Rep: Reputation: 1
sounds good

Quote:
Originally Posted by dedec0 View Post
New thing: did you have an "mv" error, for moving a ".tmpconfig.h"? Create that destination directory. It seemed to solve it all, for me.
Where is that?, how did you get that error?, I'm still stuck with

Configure requires bash
make: *** [config] Error 1

or if I comment the two lines that we said before, I get

scripts/Configure: 73: Syntax error: "(" unexpected
make: *** [config] Error 2

and I don't know what to do.
I see grep -r "tmpconfig.h" and I found that the script Configure has a line
CONFIG_H=.tmpconfig.h
and I created the two directories: /include/linux and include/modbuild

more ideas?
Thanks in advance.
Joc

Last edited by orcaja; 02-01-2012 at 01:51 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to compile driver without kernel headers??? seattleweb Linux - General 3 07-20-2008 05:56 PM
Kernel-source, alsa-driver and kernel compile jasone Linux - General 13 05-26-2005 12:15 AM
How to compile new ALSA driver into old kernel? sandin Slackware 4 05-14-2005 05:06 AM
Driver won't compile on Kernel 2.6 - works fine on Kernel 2.4 c@sey Linux - Software 4 01-08-2005 01:01 PM
How to compile a driver with the kernel? Kermeat Linux - General 5 02-11-2003 04:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration