Skip to contentSkip to conversation

building external library under 2.6

DISCUSSION Frederic Dumoulin 2 participants 3 messages Sep 30, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

I succeeded to build an externel module under 2.6 with the following Makefile:

ifneq ($(KERNELRELEASE),)
obj-m := testKernel.o
testKernel-objs := $(OBJS)
else
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
testKernel.ko :

	$(MAKE) -C $(KDIR) M=$(PWD) modules

endif

I made modifications in order to build a library:

ifneq ($(KERNELRELEASE),)
lib-y := $(OBJS)
else
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
lib.a :

	$(MAKE) -C $(KDIR) M=$(PWD) modules

endif

I've just the following output:

make -C /lib/modules/2.6.8.1/build M=xxx/testKernel modules make[1]: Entering directory `/usr/src/linux-2.6.8.1'
Building modules, stage 2.
MODPOST
make[1]: Leaving directory `/usr/src/linux-2.6.8.1'

I've got neither .o nor .a files

What's wrong?

Fred

#1 lore raw
Quoted 12 lines

Hi,

I succeeded to build an externel module under 2.6 with the following Makefile:

ifneq ($(KERNELRELEASE),)
obj-m := testKernel.o
testKernel-objs := $(OBJS)
else
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
testKernel.ko :

Quoted 2 lines
	$(MAKE) -C $(KDIR) M=$(PWD) modules

endif

Look ok except the way you use testKernel.ko. Much better to use all: since this will not conflict with a potential output file.

Quoted 11 lines

I made modifications in order to build a library:

ifneq ($(KERNELRELEASE),)
lib-y := $(OBJS)
else
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
lib.a :

	$(MAKE) -C $(KDIR) M=$(PWD) modules

endif

Try wil all: as replacement for lib.a:
It should cure things.

No access to Linux box atm so I cannot check.

Sam

#2 lore raw

It doesn't change anything!

Quoted 39 lines · Sam Ravnborg
Quoted 12 lines

Hi,

I succeeded to build an externel module under 2.6 with the following Makefile:

ifneq ($(KERNELRELEASE),)
obj-m := testKernel.o
testKernel-objs := $(OBJS)
else
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
testKernel.ko :

Quoted 2 lines
	$(MAKE) -C $(KDIR) M=$(PWD) modules

endif

Look ok except the way you use testKernel.ko. Much better to use all: since this will not conflict with a potential output file.

Quoted 10 lines

I made modifications in order to build a library:

ifneq ($(KERNELRELEASE),)
lib-y := $(OBJS)
else
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
lib.a :

	$(MAKE) -C $(KDIR) M=$(PWD) modules

endif

Try wil all: as replacement for lib.a:
It should cure things.

No access to Linux box atm so I cannot check.

Sam