kernel headers from vanilla kernel compilation

  • Follow


When using kernels from linux distributions there are usually a kernel 
package and a kernel-headers package which are be installed.
But when compiling the a vanilla kernel, there are no instructions in 
the readme file on how to install the headers. How can this be done

I am assuming that when compiling programs that runs on linux a matching 
set of kernel headers should be installed on the system (I am compiling 
truecrypt and it has some problems with BYTE_ORDER which is defined in 
the kernel headers, and the headers are from the original kernel of the 
distribution, 2.6.12. I am not running 2.6.19.2).

Any hints are appreciated.

regards

tom
0
Reply spam225 (180) 1/17/2007 11:51:18 PM

In news:45aeb67a@news.broadpark.no,
Tom Forsmo <spam@nospam.net> wrote:

> I am assuming that when compiling programs that runs on linux a
> matching set of kernel headers should be installed on the system (I
> am compiling truecrypt and it has some problems with BYTE_ORDER which
> is defined in the kernel headers, and the headers are from the
> original kernel of the distribution, 2.6.12. I am not running
> 2.6.19.2). 
> 
> Any hints are appreciated.

Let's play guessing games ... what distribution?
0
Reply p.at.r.c.k (19) 1/18/2007 7:50:52 AM



Tom Forsmo wrote:
> 
> When using kernels from linux distributions there are usually a kernel 
> package and a kernel-headers package which are be installed.
> But when compiling the a vanilla kernel, there are no instructions in 
> the readme file on how to install the headers. How can this be done
> 
> I am assuming that when compiling programs that runs on linux a matching 
> set of kernel headers should be installed on the system (I am compiling 
> truecrypt and it has some problems with BYTE_ORDER which is defined in 
> the kernel headers, and the headers are from the original kernel of the 
> distribution, 2.6.12. I am not running 2.6.19.2).
> 
> Any hints are appreciated.

Sorry, I meant to say "... I am now running 2.6.19.2"

Its a custom made vanilla kernel for my laptop, a thinkpad t60.

regards
0
Reply spam225 (180) 1/18/2007 8:50:51 AM

patrick wrote:
> In news:45aeb67a@news.broadpark.no,
> Tom Forsmo <spam@nospam.net> wrote:
> 
>> I am assuming that when compiling programs that runs on linux a
>> matching set of kernel headers should be installed on the system (I
>> am compiling truecrypt and it has some problems with BYTE_ORDER which
>> is defined in the kernel headers, and the headers are from the
>> original kernel of the distribution, 2.6.12. I am not running
>> 2.6.19.2). 
>>
>> Any hints are appreciated.
> 
> Let's play guessing games ... what distribution?

Sorry, I meant to say "... I am now running 2.6.19.2"

I am assuming you asked because of that error in the statement...

I am compiling a vanilla kernel, not a distribution kernel. I am 
assuming installing kernel headers from a vanilla kernel is not 
distribution dependent...

(Its Mandriva 2006, with a custom made vanilla kernel for my laptop a)

regards
0
Reply spam225 (180) 1/18/2007 8:51:55 AM

Tom Forsmo wrote:
> When using kernels from linux distributions there are usually a kernel 
> package and a kernel-headers package which are be installed.
> But when compiling the a vanilla kernel, there are no instructions in 
> the readme file on how to install the headers. How can this be done

Which "kernel headers" are you referring to?  On most distros there are 
two types of of "kernel header" packages available.

On Debian there is a linux-headers-<version> package corresponding to 
each linux-image-<version> package.  You need the headers package to 
build kernel modules (e.g., nVidia or ATI drivers) to run in the kernel 
from the matching image package.  IOW, you only need those "kernel 
headers" when building modules for the pre-packaged kernels.  So since 
you have the full kernel source installed already you don't need to do 
anything.

Then (on Debian, at least) there is also a linux-kernel-headers package 
that contains the headers from /usr/include/linux and /usr/include/asm. 
  You need these headers (and hence this package) to build user space 
programs.  Those directories used to be symlinks to the live kernel 
headers under /usr/src/linux but this no longer recommended.  You need 
your distro's package for these "kernel headers" regardless of what 
kernel version you're currently running.

> I am assuming that when compiling programs that runs on linux a matching 
> set of kernel headers should be installed on the system (I am compiling 
> truecrypt and it has some problems with BYTE_ORDER which is defined in 
> the kernel headers, and the headers are from the original kernel of the 
> distribution, 2.6.12. I am not running 2.6.19.2).

I would assume that truecrypt is a user space program (not a kernel 
module), so you need the second type of "kernel headers".  Install your 
distribution's packaged headers.  (Note that the package name may not be 
"kernel headers" at all.  Those might be in a glibc-devel package or 
something.)

The BYTE_ORDER macro you mention is defined in /usr/include/endian.h 
which should be in the same package as the other basic glibc headers, 
not the "kernel headers" of any sort.
0
Reply jpstewart (2598) 1/19/2007 4:28:07 PM

John-Paul Stewart wrote:
> Tom Forsmo wrote:
>> When using kernels from linux distributions there are usually a kernel 
>> package and a kernel-headers package which are be installed.
>> But when compiling the a vanilla kernel, there are no instructions in 
>> the readme file on how to install the headers. How can this be done
> 
> Which "kernel headers" are you referring to?  On most distros there are 
> two types of of "kernel header" packages available.
....
> Then (on Debian, at least) there is also a linux-kernel-headers package 
> that contains the headers from /usr/include/linux and /usr/include/asm. 
>  You need these headers (and hence this package) to build user space 
> programs.  Those directories used to be symlinks to the live kernel 
> headers under /usr/src/linux but this no longer recommended.  You need 
> your distro's package for these "kernel headers" regardless of what 
> kernel version you're currently running.

It makes sense now. I was not aware that the headers were from different 
packages. So that means the headers in /usr/include must be compatible 
with the glibc version and package.

> I would assume that truecrypt is a user space program (not a kernel 
> module), so you need the second type of "kernel headers".  Install your 
> distribution's packaged headers.  (Note that the package name may not be 
> "kernel headers" at all.  Those might be in a glibc-devel package or 
> something.)

its both a kernel module and a userspace program. But I have managed to 
make the kernel module compile without problems, so the problem now lies 
with the userspace program

> The BYTE_ORDER macro you mention is defined in /usr/include/endian.h 
> which should be in the same package as the other basic glibc headers, 
> not the "kernel headers" of any sort.

The program seems to include its own endian.h file, which might override 
the /usr/include/endian.h. I am not sure whats going on here, but there 
seems to be either some conflict or that the truecrypt local endian.h 
file are missing something it expects from the system version.

Maybe this problem is distribution dependant, because different 
distributions contains different glibc version and mine just does not 
contain the version of glibc headers truecrypt needs. So the remedy 
might seem to be finding out why the local endian.h does not define 
BYTE_ORDER and what else might be missing compared to the system/glibc 
version of endian.h Would that be a correct analysis?

Below is the output from the compilation:

[root@duplo Linux]# ./build.sh
Building truecrypt... Compiling Aescrypt.c
cc -w -I../../Crypto -I../../Common -I../Kernel -I/usr/include 
-D_cdecl="" -DBOOL=int -DTRUE=1 -DFALSE=0 -DMAX_PATH=260 -D__int8="char" 
-D__int16="short" -D__int32="int" -D__int64="long long" -O2 
-fno-strict-aliasing  -MMD -o ../../Crypto/Aescrypt.o -c 
.../../Crypto/Aescrypt.c
In file included from ../../Crypto/Aesopt.h:144,
                  from ../../Crypto/Aescrypt.c:33:
.../../Common/Endian.h:43:5: error: #error Byte order cannot be 
determined (BYTE_ORDER undefined)
make: *** [../../Crypto/Aescrypt.o] Error 1
Error: Failed to build truecrypt



regards

tom
0
Reply spam225 (180) 1/20/2007 1:18:35 AM

Tom Forsmo wrote:
> 
> [root@duplo Linux]# ./build.sh
> Building truecrypt... Compiling Aescrypt.c
> cc -w -I../../Crypto -I../../Common -I../Kernel -I/usr/include 
> -D_cdecl="" -DBOOL=int -DTRUE=1 -DFALSE=0 -DMAX_PATH=260 -D__int8="char" 
> -D__int16="short" -D__int32="int" -D__int64="long long" -O2 
> -fno-strict-aliasing  -MMD -o ../../Crypto/Aescrypt.o -c 
> ../../Crypto/Aescrypt.c
> In file included from ../../Crypto/Aesopt.h:144,
>                   from ../../Crypto/Aescrypt.c:33:
> ../../Common/Endian.h:43:5: error: #error Byte order cannot be 
> determined (BYTE_ORDER undefined)
> make: *** [../../Crypto/Aescrypt.o] Error 1
> Error: Failed to build truecrypt

OK.  It seems truecrypt has its own Endian.h which contains the line:

#include <endian.h>

to use the standard one (/usr/include/endian.h).  That's good.  Then 
endian.h in turn contains:

#include <bits/endian.h>

to refer to the file /usr/include/bits/endian.h which is where 
__BYTE_ORDER is really defined.  Do you have both of those files?
0
Reply jpstewart (2598) 1/20/2007 9:47:48 PM


John-Paul Stewart wrote:
> OK.  It seems truecrypt has its own Endian.h which contains the line:
> 
> #include <endian.h>
> 
> to use the standard one (/usr/include/endian.h).  That's good.  Then 
> endian.h in turn contains:
> 
> #include <bits/endian.h>
> 
> to refer to the file /usr/include/bits/endian.h which is where 
> __BYTE_ORDER is really defined.  Do you have both of those files?

Yes, I have those two files. So I tried the following, I include the 
relevant pieces from those two files directly into the Endian.h right 
after the include for the /usr/include/endian.h


#define __BYTE_ORDER __LITTLE_ENDIAN

#if __BYTE_ORDER == __LITTLE_ENDIAN
# define __LONG_LONG_PAIR(HI, LO) LO, HI
#elif __BYTE_ORDER == __BIG_ENDIAN
# define __LONG_LONG_PAIR(HI, LO) HI, LO
#endif


That seemed to solve the problem, because the compilation now continues. 
But what I dont understand is why the include in Endian.h does not work 
properly. It would be nice to possibly get a patch for the problem.

Now the compilation continues until another error appears

Compiling Cli.c
cc -w -I../../Crypto -I../../Common -I../Kernel -D_cdecl="" -DBOOL=int 
-DTRUE=1 -DFALSE=0 -DMAX_PATH=260 -D__int8="char" -D__int16="short" 
-D__int32="int" -D__int64="long long" -O2 -fno-strict-aliasing  -MMD -o 
Cli.o -c Cli.c
In file included from /usr/include/sys/wait.h:79,
                  from Cli.c:23:
/usr/include/bits/waitstatus.h:80: error: duplicate member '__w_retcode'
/usr/include/bits/waitstatus.h:80: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:80: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:81: error: duplicate member '__w_coredump'
/usr/include/bits/waitstatus.h:81: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:81: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:81: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:82: error: duplicate member '__w_termsig'
/usr/include/bits/waitstatus.h:82: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:82: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:82: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:82: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:94: error: duplicate member '__w_stopsig'
/usr/include/bits/waitstatus.h:94: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:94: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:95: error: duplicate member '__w_stopval'
/usr/include/bits/waitstatus.h:95: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:95: error: duplicate member '({anonymous})'
/usr/include/bits/waitstatus.h:95: error: duplicate member '({anonymous})'
make: *** [Cli.o] Error 1
Error: Failed to build truecrypt



After looking at the code, this amounts to another BYTE_ORDER definition 
problem or endian.h problem

So there seems to be something wrong with my distributions setup in this 
respect or truecrypt has an define error somewhere. Any suggestions?

tom
0
Reply spam225 (180) 1/21/2007 12:41:57 AM


Tom Forsmo wrote:
> Now the compilation continues until another error appears
> 
> Compiling Cli.c
> cc -w -I../../Crypto -I../../Common -I../Kernel -D_cdecl="" -DBOOL=int 
> -DTRUE=1 -DFALSE=0 -DMAX_PATH=260 -D__int8="char" -D__int16="short" 
> -D__int32="int" -D__int64="long long" -O2 -fno-strict-aliasing  -MMD -o 
> Cli.o -c Cli.c
> In file included from /usr/include/sys/wait.h:79,
>                  from Cli.c:23:
> /usr/include/bits/waitstatus.h:80: error: duplicate member '__w_retcode'
> /usr/include/bits/waitstatus.h:80: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:80: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:81: error: duplicate member '__w_coredump'
> /usr/include/bits/waitstatus.h:81: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:81: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:81: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:82: error: duplicate member '__w_termsig'
> /usr/include/bits/waitstatus.h:82: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:82: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:82: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:82: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:94: error: duplicate member '__w_stopsig'
> /usr/include/bits/waitstatus.h:94: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:94: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:95: error: duplicate member '__w_stopval'
> /usr/include/bits/waitstatus.h:95: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:95: error: duplicate member '({anonymous})'
> /usr/include/bits/waitstatus.h:95: error: duplicate member '({anonymous})'
> make: *** [Cli.o] Error 1
> Error: Failed to build truecrypt
> 
> 
> 
> After looking at the code, this amounts to another BYTE_ORDER definition 
> problem or endian.h problem
> 
> So there seems to be something wrong with my distributions setup in this 
> respect or truecrypt has an define error somewhere. Any suggestions?

I found that if I removed the #ifdef cases for BIG_ENDIAN in 
/usr/include/bits/waitstatus.h then truecrypt compiled without errors.
Of course, when trying to test it is fails. So in other wwords truecrypt 
does not seem to be very compatible with Mandriva.

But do you have eny suggestions on how to fix the BYTE_ORDER problem?

tom
> 
> tom
0
Reply spam225 (180) 1/21/2007 1:05:19 AM

On Sun, 21 Jan 2007 02:05:19 +0100, Tom Forsmo wrote:


> I found that if I removed the #ifdef cases for BIG_ENDIAN in 
> /usr/include/bits/waitstatus.h then truecrypt compiled without errors.
> Of course, when trying to test it is fails. So in other wwords truecrypt 
> does not seem to be very compatible with Mandriva.

No offense, but the problem is yours, not Mandriva's. I've run truecrypt
on Mandrake 10.1, Mandriva 2006, and currently on Mandriva 2007. Compiling
with the distro kernels, and kernel sources, truecrypt throws no errors,
and runs as advertised.

[root@fatman imotgm]# truecrypt -V
truecrypt 4.2a

Released under the TrueCrypt Collective License 1.0

Copyright (C) 2004-2006 TrueCrypt Foundation. All Rights Reserved.
Copyright (C) 1998-2000 Paul Le Roux. All Rights Reserved.
Copyright (C) 2004 TrueCrypt Team. All Rights Reserved.
Copyright (C) 1999-2005 Dr. Brian Gladman. All Rights Reserved.
Copyright (C) 1995-1997 Eric Young. All Rights Reserved.
Copyright (C) 2001 Markus Friedl. All Rights Reserved.

[root@fatman imotgm]# uname -a
Linux fatman.home.local 2.6.17-5mdv #1 SMP Wed Sep 13 14:32:31 EDT 2006 i686 AMD Athlon(tm) 64 Processor 3000+ GNU/Linux

[root@fatman imotgm]# cat /etc/release
Mandriva Linux release 2007.0 (Official) for i586


-- 
imotgm   
       "Lost? Lost? I've never been lost... Been a tad confused for a
        month or two, but never lost."
0
Reply imotgmREM1 (40) 1/22/2007 7:15:47 AM


imotgm wrote:
> On Sun, 21 Jan 2007 02:05:19 +0100, Tom Forsmo wrote:
> 
> 
>> I found that if I removed the #ifdef cases for BIG_ENDIAN in 
>> /usr/include/bits/waitstatus.h then truecrypt compiled without errors.
>> Of course, when trying to test it is fails. So in other wwords truecrypt 
>> does not seem to be very compatible with Mandriva.
> 
> No offense, but the problem is yours, not Mandriva's.

No offence taken. its constructive feedback, not offensive feedback.
Of course, you could have rephrased the sentence a bit to make it more 
friendly, e.g. "I don't think the problem is with Mandriva per se..."
Any ways, it doesn't matter.

  I've run truecrypt
> on Mandrake 10.1, Mandriva 2006, and currently on Mandriva 2007. Compiling
> with the distro kernels, and kernel sources, truecrypt throws no errors,
> and runs as advertised.

Interesting. I talked to somebody on the truecrypt forum, which have the 
same problem as I but on Ubuntu instead. But just as you state, he also 
got it working when using official distribution kernels. So there must 
be a dependency on the kernel that is missing in both our custom made 
vanilla kernels.

Do you have any suggestions about how to track down what might be missing?

tom
0
Reply spam225 (180) 1/22/2007 8:48:01 AM

On Mon, 22 Jan 2007 09:48:01 +0100, Tom Forsmo wrote:


> Interesting. I talked to somebody on the truecrypt forum, which have the 
> same problem as I but on Ubuntu instead. But just as you state, he also 
> got it working when using official distribution kernels. So there must 
> be a dependency on the kernel that is missing in both our custom made 
> vanilla kernels.
> 
> Do you have any suggestions about how to track down what might be missing?

Sorry, not a clue. I also run SUSE 10.0, 10,1, and 10.2 with truecrypt
working on all of them. I've never had a problem compiling truecrypt, so
haven't had cause to dig into it. 

fatman:~ # truecrypt -V
truecrypt 4.2a

Released under the TrueCrypt Collective License 1.0

Copyright (C) 2004-2006 TrueCrypt Foundation. All Rights Reserved.
Copyright (C) 1998-2000 Paul Le Roux. All Rights Reserved.
Copyright (C) 2004 TrueCrypt Team. All Rights Reserved.
Copyright (C) 1999-2005 Dr. Brian Gladman. All Rights Reserved.
Copyright (C) 1995-1997 Eric Young. All Rights Reserved.
Copyright (C) 2001 Markus Friedl. All Rights Reserved.

fatman:~ # cat /etc/issue

Welcome to SUSE LINUX 10.1 (i586) - Kernel \r (\l).

fatman:~ # uname -a
Linux fatman 2.6.16.27-0.6-default #1 Wed Dec 13 09:34:50 UTC 2006 i686 athlon i386 GNU/Linux

There have been three updates to this kernel, besides the original, and
I've had to recompile truecrypt with each update, but they've all been
without issue, except for the notice that modprobe couldn't find the
module, immediately after the kernel update.

I'm not laughing at you; I promise. Really, I'm friendly, and don't bite.
These are just to make up for sounding harsh in the previous post.

	:)	:)	:)	;)

-- 
imotgm   
       "Lost? Lost? I've never been lost... Been a tad confused for a
        month or two, but never lost."
0
Reply imotgmREM1 (40) 1/22/2007 10:24:32 PM

11 Replies
45 Views

(page loaded in 0.114 seconds)


Reply: