re: Files missing in /usr/include?

2010-05-26 Thread matthew green

> I'm working on porting the OpenAFS client over to NetBSD 5.0.2. In
> trying to compile the LKM for it, the files cpu.h and intr.h in
> /usr/include/x86/ are included. These headers include additional
> headers. The problem, however, is that a couple of the headers they
> try to include are not in /usr/include/x86. For example:
> 
> /usr/include/x86/cpu.h includes /x86/via_padlock.h
> /usr/include/x86/intr.h includes /machine/pic.h
> 
> Instead, these included headers are located in the src tree
> (/usr/src/sys/arch/x86/include). They can be linked in to satisfy the
> dependency, but intr.h errors out due to missing some expected
> characters.
> 
> Does anyone know why these files would be missing from /usr/include?
> Additionally, why would non-compilable files be placed for use in
> /usr/include?


/usr/include is for compiling userland components.  to compile
kernel code, you need a copy of the kernel source tree as well.

most of the above files probably shouldn't be installed unless
they're actually usable from userland...


.mrg.


Re: Files missing in /usr/include?

2010-05-26 Thread Adam Hoka
On Wed, 26 May 2010 12:10:44 -0500
Matt Smith  wrote:

> Hello,
> 
> I'm working on porting the OpenAFS client over to NetBSD 5.0.2. In
> trying to compile the LKM for it, the files cpu.h and intr.h in
> /usr/include/x86/ are included. These headers include additional
> headers. The problem, however, is that a couple of the headers they
> try to include are not in /usr/include/x86. For example:
> 
> /usr/include/x86/cpu.h includes /x86/via_padlock.h
> /usr/include/x86/intr.h includes /machine/pic.h
> 
> Instead, these included headers are located in the src tree
> (/usr/src/sys/arch/x86/include). They can be linked in to satisfy the
> dependency, but intr.h errors out due to missing some expected
> characters.
> 
> Does anyone know why these files would be missing from /usr/include?
> Additionally, why would non-compilable files be placed for use in
> /usr/include?
> 
> Thanks!
> Matt Smith

Yeah building 3rd party kernel modules is sadly unsupported.
However, I use this own hacked up script to generate a ddk:


$ cat ddk.sh
#!/bin/sh -e

if [ -z $1 ]; then
DEST=/usr/ddk
else
DEST=$1
fi

if [ ! $(uname -m) = i386 ]; then
echo "Platform not supported..."
exit
fi

# i386
mkdir -p ${DEST}/include
cp -r /usr/src/sys/sys ${DEST}/include/
cp -r /usr/src/common/include/* ${DEST}/include/ # XXX CVS
cp -r /usr/src/sys/arch/i386/include ${DEST}/include/i386
cp -r /usr/src/sys/arch/x86/include ${DEST}/include/x86
cp -r ${DEST}/include/i386 ${DEST}/include/machine
ln -s ${DEST}/include/i386 ${DEST}/include/machine

mkdir -p ${DEST}/include/lib/libkern
cp -r /usr/src/sys/lib/libkern/libkern.h ${DEST}/include/lib/libkern

for i in $(find /usr/src/sys/crypto/ -name '*.h'); do
pax -rw -s '/usr\/src\/sys\///' $i ${DEST}/include
done

for i in $(find /usr/src/sys/dev/ -name '*.h'); do
pax -rw -s '/usr\/src\/sys\///' $i ${DEST}/include
done


-- 
NetBSD - Simplicity is prerequisite for reliability


Re: Files missing in /usr/include?

2010-05-26 Thread Iain Hibbert
On Wed, 26 May 2010, Jonathan A. Kollasch wrote:

> On Wed, May 26, 2010 at 01:35:27PM -0500, Matt Smith wrote:
> > /usr/include/x86/intr.h:131: error: expected '=', ',', ';', 'asm' or
> > '__attribute__' before 'ipl_cookie_t'
> > /usr/include/x86/intr.h:138: error: expected '=', ',', ';', 'asm' or
>
> An excerpt from that file:
>
> 126 typedef uint8_t ipl_t;
> 127 typedef struct {
> 128 ipl_t _ipl;
> 129 } ipl_cookie_t;
> 130
> 131 static inline ipl_cookie_t
> 132 makeiplcookie(ipl_t ipl)
> 133 {
>
> In short, alone, this code is perfectly valid C99.
> Is "inline" really what you think it is?
>
> From what I know of the OpenAFS codebase, anything could
> actually be a macro in disguise.

on the other hand, it could be that it needs to include  as
that is only included by the file when _KERNEL is defined..

iain




Re: Files missing in /usr/include?

2010-05-26 Thread Jonathan A. Kollasch
On Wed, May 26, 2010 at 01:35:27PM -0500, Matt Smith wrote:
> Fair enough.
> 
> What would be the best way to deal with the existing error with intr.h
> then? It persists in the src tree as well.
> 
> /usr/include/x86/intr.h:131: error: expected '=', ',', ';', 'asm' or
> '__attribute__' before 'ipl_cookie_t'
> /usr/include/x86/intr.h:138: error: expected '=', ',', ';', 'asm' or

An excerpt from that file:

126 typedef uint8_t ipl_t;
127 typedef struct {
128 ipl_t _ipl;
129 } ipl_cookie_t;
130 
131 static inline ipl_cookie_t
132 makeiplcookie(ipl_t ipl)
133 {

In short, alone, this code is perfectly valid C99.
Is "inline" really what you think it is?

>From what I know of the OpenAFS codebase, anything could
actually be a macro in disguise.

Jonathan Kollasch


Re: Files missing in /usr/include?

2010-05-26 Thread Matt Smith
Fair enough.

What would be the best way to deal with the existing error with intr.h
then? It persists in the src tree as well.

/usr/include/x86/intr.h:131: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'ipl_cookie_t'
/usr/include/x86/intr.h:138: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'int'


On Wed, May 26, 2010 at 12:37 PM, Jonathan A. Kollasch
 wrote:
> On Wed, May 26, 2010 at 12:10:44PM -0500, Matt Smith wrote:
>> Hello,
>>
>> I'm working on porting the OpenAFS client over to NetBSD 5.0.2. In
>> trying to compile the LKM for it, the files cpu.h and intr.h in
>> /usr/include/x86/ are included. These headers include additional
>> headers. The problem, however, is that a couple of the headers they
>> try to include are not in /usr/include/x86. For example:
>>
>> /usr/include/x86/cpu.h includes /x86/via_padlock.h
>> /usr/include/x86/intr.h includes /machine/pic.h
>>
>> Instead, these included headers are located in the src tree
>> (/usr/src/sys/arch/x86/include). They can be linked in to satisfy the
>> dependency, but intr.h errors out due to missing some expected
>> characters.
>>
>> Does anyone know why these files would be missing from /usr/include?
>> Additionally, why would non-compilable files be placed for use in
>> /usr/include?
>
> I don't think we have yet bothered to support building 3rd-party kernel
> modules without also having various parts of the src tree around.
>
> At least this was the case with Arla.  I believe OpenAFS needs src
> trees for OpenBSD and FreeBSD cache manager builds too.
>
> I could see it being hard to integrate, but using 
> may make some things easier.
>
>        Jonathan Kollasch
>



-- 
Matt Smith


Re: Files missing in /usr/include?

2010-05-26 Thread Jonathan A. Kollasch
On Wed, May 26, 2010 at 12:10:44PM -0500, Matt Smith wrote:
> Hello,
> 
> I'm working on porting the OpenAFS client over to NetBSD 5.0.2. In
> trying to compile the LKM for it, the files cpu.h and intr.h in
> /usr/include/x86/ are included. These headers include additional
> headers. The problem, however, is that a couple of the headers they
> try to include are not in /usr/include/x86. For example:
> 
> /usr/include/x86/cpu.h includes /x86/via_padlock.h
> /usr/include/x86/intr.h includes /machine/pic.h
> 
> Instead, these included headers are located in the src tree
> (/usr/src/sys/arch/x86/include). They can be linked in to satisfy the
> dependency, but intr.h errors out due to missing some expected
> characters.
> 
> Does anyone know why these files would be missing from /usr/include?
> Additionally, why would non-compilable files be placed for use in
> /usr/include?

I don't think we have yet bothered to support building 3rd-party kernel
modules without also having various parts of the src tree around.

At least this was the case with Arla.  I believe OpenAFS needs src
trees for OpenBSD and FreeBSD cache manager builds too.

I could see it being hard to integrate, but using 
may make some things easier.

Jonathan Kollasch


Files missing in /usr/include?

2010-05-26 Thread Matt Smith
Hello,

I'm working on porting the OpenAFS client over to NetBSD 5.0.2. In
trying to compile the LKM for it, the files cpu.h and intr.h in
/usr/include/x86/ are included. These headers include additional
headers. The problem, however, is that a couple of the headers they
try to include are not in /usr/include/x86. For example:

/usr/include/x86/cpu.h includes /x86/via_padlock.h
/usr/include/x86/intr.h includes /machine/pic.h

Instead, these included headers are located in the src tree
(/usr/src/sys/arch/x86/include). They can be linked in to satisfy the
dependency, but intr.h errors out due to missing some expected
characters.

Does anyone know why these files would be missing from /usr/include?
Additionally, why would non-compilable files be placed for use in
/usr/include?

Thanks!
Matt Smith