2003-11-17 17:58:31

by Wojciech 'Sas' Cieciwa

[permalink] [raw]
Subject: HOWTO build modules in 2.6.0 ...


Hi,

How can I build kernel modele from other package without root, or copying
all from /usr/scr/linux/ ??
When I try build kernel module from user i got error,

[...]
make[1]: Leaving directory `/users/cieciwa/rpm/BUILD/eagle-1.0.4/driver'
/usr/bin/make -C /usr/src/linux SUBDIRS=`pwd` modules;
make[1]: Entering directory `/usr/src/linux-2.6.0'
HOSTCC scripts/fixdep
cc1: Permission denied: opening dependency file scripts/.fixdep.d
make[2]: *** [scripts/fixdep] Error 1
make[1]: *** [scripts] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.0'
make: *** [adiusbadsl.o] Error 2
make: Leaving directory `/users/cieciwa/rpm/BUILD/eagle-1.0.4/driver'

How can I solve this problem ??

Thanx,
Sas.
--
{Wojciech 'Sas' Cieciwa} {Member of PLD Team }
{e-mail: [email protected], http://www2.zarz.agh.edu.pl/~cieciwa}


2003-11-17 18:10:32

by Randy.Dunlap

[permalink] [raw]
Subject: Re: HOWTO build modules in 2.6.0 ...

On Mon, 17 Nov 2003 20:00:50 +0100 (CET) "Wojciech 'Sas' Cieciwa" <[email protected]> wrote:

|
| Hi,
|
| How can I build kernel modele from other package without root, or copying
| all from /usr/scr/linux/ ??
| When I try build kernel module from user i got error,
|
| [...]
| make[1]: Leaving directory `/users/cieciwa/rpm/BUILD/eagle-1.0.4/driver'
| /usr/bin/make -C /usr/src/linux SUBDIRS=`pwd` modules;
| make[1]: Entering directory `/usr/src/linux-2.6.0'
| HOSTCC scripts/fixdep
| cc1: Permission denied: opening dependency file scripts/.fixdep.d
| make[2]: *** [scripts/fixdep] Error 1
| make[1]: *** [scripts] Error 2
| make[1]: Leaving directory `/usr/src/linux-2.6.0'
| make: *** [adiusbadsl.o] Error 2
| make: Leaving directory `/users/cieciwa/rpm/BUILD/eagle-1.0.4/driver'
|
| How can I solve this problem ??

Current kernel build requires a kernel source tree.
Given that, follow directions in linux/Documentation/kbuild/modules.txt
and .../makefiles.txt.
I have some working examples if you want pointers to them.

--
~Randy
MOTD: Always include version info.

2003-11-17 18:28:16

by David Hollis

[permalink] [raw]
Subject: Re: HOWTO build modules in 2.6.0 ...

On Mon, 2003-11-17 at 14:00, Wojciech 'Sas' Cieciwa wrote:
> Hi,
>
> How can I build kernel modele from other package without root, or copying
> all from /usr/scr/linux/ ??
> When I try build kernel module from user i got error,
>
> [...]
> make[1]: Leaving directory `/users/cieciwa/rpm/BUILD/eagle-1.0.4/driver'
> /usr/bin/make -C /usr/src/linux SUBDIRS=`pwd` modules;
> make[1]: Entering directory `/usr/src/linux-2.6.0'
> HOSTCC scripts/fixdep
> cc1: Permission denied: opening dependency file scripts/.fixdep.d
> make[2]: *** [scripts/fixdep] Error 1
> make[1]: *** [scripts] Error 2
> make[1]: Leaving directory `/usr/src/linux-2.6.0'
> make: *** [adiusbadsl.o] Error 2
> make: Leaving directory `/users/cieciwa/rpm/BUILD/eagle-1.0.4/driver'
>
> How can I solve this problem ??
>
> Thanx,
> Sas.

Here's what I have used that works quite well. Taken from the lwn.net
articles on porting to 2.5/2.6:


ifneq ($(KERNELRELEASE),)
obj-m := usbnet.o

else
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
endif


The only item to change would be the 'obj-m := usbnet.o'. That's the
module that you want built.

2003-11-17 20:33:41

by Sam Ravnborg

[permalink] [raw]
Subject: Re: HOWTO build modules in 2.6.0 ...

On Mon, Nov 17, 2003 at 08:00:50PM +0100, Wojciech 'Sas' Cieciwa wrote:
>
> Hi,
>
> How can I build kernel modele from other package without root, or copying
> all from /usr/scr/linux/ ??
> When I try build kernel module from user i got error,
>
> [...]
> make[1]: Leaving directory `/users/cieciwa/rpm/BUILD/eagle-1.0.4/driver'
> /usr/bin/make -C /usr/src/linux SUBDIRS=`pwd` modules;
> make[1]: Entering directory `/usr/src/linux-2.6.0'
> HOSTCC scripts/fixdep
> cc1: Permission denied: opening dependency file scripts/.fixdep.d

Hi Sas.
What you really need is the possibility to specify an alternate location
for output files.

Use the following:
make -C /usr/src/linux SUBDIRS=`pwd` O=/users/cieciwa/rpm/BUILD/eagle-1.0.4/linux modules

O=/users/cieciwa/rpm/BUILD/eagle-1.0.4/linux
tell kbuild to locate all files in the specified directory, which must exist.
This is also the location of .config, so make sure to copy that one over.

Sam

2003-11-17 23:59:30

by John Levon

[permalink] [raw]
Subject: Re: HOWTO build modules in 2.6.0 ...

On Mon, Nov 17, 2003 at 09:33:36PM +0100, Sam Ravnborg wrote:

> Use the following:
> make -C /usr/src/linux SUBDIRS=`pwd` O=/users/cieciwa/rpm/BUILD/eagle-1.0.4/linux modules
>

This requires a kernel source tree empty of built files though, so it's
really not a great solution ...

regards
john
--
Khendon's Law:
If the same point is made twice by the same person, the thread is over.

2003-11-18 05:50:12

by Sam Ravnborg

[permalink] [raw]
Subject: Re: HOWTO build modules in 2.6.0 ...

On Mon, Nov 17, 2003 at 11:59:27PM +0000, John Levon wrote:
> On Mon, Nov 17, 2003 at 09:33:36PM +0100, Sam Ravnborg wrote:
>
> > Use the following:
> > make -C /usr/src/linux SUBDIRS=`pwd` O=/users/cieciwa/rpm/BUILD/eagle-1.0.4/linux modules
> >
>
> This requires a kernel source tree empty of built files though, so it's
> really not a great solution ...

Correct - but why keep kernel trees around full of build files, when
there is a proper solution to keep them out of the src.

The problem was generated files. If a generated file were present in
the kernel source tree, it would not be built again.
This resulted in a few suprises during development, and I therefore
added the check for a kernel source tree with no built-files.
It can be avoided, but that required too much surgery in various
makefiles and include statements. So that part is 2.7 material.

Sam

2003-11-18 07:10:17

by Ian Kent

[permalink] [raw]
Subject: Re: HOWTO build modules in 2.6.0 ...

On Tue, 18 Nov 2003, Sam Ravnborg wrote:

> On Mon, Nov 17, 2003 at 11:59:27PM +0000, John Levon wrote:
> > On Mon, Nov 17, 2003 at 09:33:36PM +0100, Sam Ravnborg wrote:
> >
> > > Use the following:
> > > make -C /usr/src/linux SUBDIRS=`pwd` O=/users/cieciwa/rpm/BUILD/eagle-1.0.4/linux modules
> > >
> >
> > This requires a kernel source tree empty of built files though, so it's
> > really not a great solution ...
>
> Correct - but why keep kernel trees around full of build files, when
> there is a proper solution to keep them out of the src.
>
> The problem was generated files. If a generated file were present in
> the kernel source tree, it would not be built again.
> This resulted in a few suprises during development, and I therefore
> added the check for a kernel source tree with no built-files.
> It can be avoided, but that required too much surgery in various
> makefiles and include statements. So that part is 2.7 material.

And this method works for versioned kernels as well without having to
build a new kernel?

--

,-._|\ Ian Kent
/ \ Perth, Western Australia
*_.--._/ E-mail: [email protected]
v Web: http://themaw.net/

2003-11-18 13:39:11

by John Levon

[permalink] [raw]
Subject: Re: HOWTO build modules in 2.6.0 ...

On Tue, Nov 18, 2003 at 06:50:07AM +0100, Sam Ravnborg wrote:

> > This requires a kernel source tree empty of built files though, so it's
> > really not a great solution ...
>
> Correct - but why keep kernel trees around full of build files, when
> there is a proper solution to keep them out of the src.

Because people *will* have build trees that are in the source directory.
You're effectively requiring everybody to rebuild their kernel using
some new syntax the first time they want to compile an external module.

External modules were compilable fine (if somewhat clumsily) in 2.4
without any special setup; it's a pity that 2.6 regresses in this given
how superior the build system is in every other way.

> It can be avoided, but that required too much surgery in various
> makefiles and include statements. So that part is 2.7 material.

Would allowing non-O= builds to work again be 2.7 too ? It worked up
until very recently.

regards
john

--
Khendon's Law:
If the same point is made twice by the same person, the thread is over.