Can't build loadable module for 2.6.kernel
Hi all,
I hope this is the right forum for this question.
I'm trying to build a loadable module for a telephony card that includes several files. Some of the files are source files (written by me) and some are object files (provided by the chip vendor). I'm unable to link the vendor object files with the target.
Make displays the following error:
make[4]: *** No rule to make target drivers/telephony/mrvphone/apicnt.s', needed by drivers/telephony/mrvphone/apicnt.o'. Stop.
The makefile has the following rule to build apicnt.o:
apicnt.o: apicnt.o.shipped
cp apicnt.o.shipped apicnt.o
I have also included the whole Makefile with this email.
Thanks in advance,
Carlos Munoz
#
# Makefile for the phone_mrvl driver loadable module #
TARGET = phone_mrvl.o
obj-$(CONFIG_PHONE_MARVELL) = phone_mrvl.o
ifeq ($(CONFIG_PHONE_LEGERITY),y)
phone_mrvl-objs = mrvphone.o slic.o legerity.o vp_hal.o sys_service.o apicnt.o apiinit.o apiquery.o vp_api.o vp_api_common.o mvutils.o endif
ifeq ($(CONFIG_PHONE_PROSLIC),y)
phone_mrvl-objs = mrvphone.o proslic.o
endif
CFLAGS += -D__linux__EXTRA_CFLAGS += -Idrivers/telephony/mrvphoneEXTRA_CFLAGS += -DNDEBUG -Dlinux -D__linux__ -Dunix -DEMBED -DLINUX -DHOST_LE
ifeq ($(CONFIG_PHONE_LEGERITY),y)EXTRA_CFLAGS += -D__LEGERITY__
endif
ifeq ($(CONFIG_PHONE_PROSLIC),y)EXTRA_CFLAGS += -D__PROSLIC__
endif
all: $(TARGET)
$(TARGET): $(OBJS)
$(LD) -r $(OBJS) -o $(TARGET)
clean:
-rm -f $(TARGET) *.elf *.gdb *.o
apicnt.o: apicnt.o.shipped
cp apicnt.o.shipped apicnt.o
Quoted 3 lines · Carlos Munoz
Hi all,
I hope this is the right forum for this question.
Yes.
Quoted 3 lines
The makefile has the following rule to build apicnt.o:
apicnt.o: apicnt.o.shipped
cp apicnt.o.shipped apicnt.o
This is wrong. kbuild has knowledge how to copy a file named:
apicnt.o_shippd to apicnt.o
So you renamed the supplied .o fiel to apicnt.o_shipped and delte your own rule.
Quoted 10 lines
#
#Makefilefor thephone_mrvldriver loadable module #
TARGET = phone_mrvl.oobj-$(CONFIG_PHONE_MARVELL) = phone_mrvl.o
ifeq ($(CONFIG_PHONE_LEGERITY),y)
phone_mrvl-objs = mrvphone.o slic.o legerity.o vp_hal.o sys_service.o apicnt.o apiinit.o apiquery.o vp_api.o vp_api_common.o mvutils.o endif
Please do:
phone_mrvl-$(CONFIG_PHONE_LEGERITY) := mrvphone.o slic.o legerity.o phone_mrvl-$(CONFIG_PHONE_LEGERITY) += vp_hal.o sys_service.o apicnt.o phone_mrvl-$(CONFIG_PHONE_LEGERITY) += apiinit.o apiquery.o vp_api.o phone_mrvl-$(CONFIG_PHONE_LEGERITY) += vp_api_common.o mvutils.o
Quoted 4 lines
ifeq ($(CONFIG_PHONE_PROSLIC),y)
phone_mrvl-objs = mrvphone.o proslic.o
endif
phone_mrvl-$(CONFIG_PHONE_PROSLIC) += mrvphone.o proslic.o
Quoted 11 lines
CFLAGS += -D__linux__
EXTRA_CFLAGS+= -Idrivers/telephony/mrvphoneEXTRA_CFLAGS+= -DNDEBUG -Dlinux -D__linux__ -Dunix -DEMBED -DLINUX -DHOST_LEifeq ($(CONFIG_PHONE_LEGERITY),y)
EXTRA_CFLAGS+= -D__LEGERITY__
endif
ifeq ($(CONFIG_PHONE_PROSLIC),y)EXTRA_CFLAGS+= -D__PROSLIC__
endif
Here you could do:
extra-cflags-$(CONFIG_PHONE_LEGERITY) += -D__LEGERITY__ extra-cflags-$(CONFIG_PHONE_PROSLIC) += -D__PROSLIC__ EXTRA_CFLAGS += $(extra-cflags-y)
Please delete the rest - it is not needed.
Quoted 10 lines
all: $(TARGET)
$(TARGET): $(OBJS)
$(LD) -r $(OBJS) -o $(TARGET)clean:
-rm -f $(TARGET) *.elf *.gdb *.oapicnt.o: apicnt.o.shipped
cp apicnt.o.shipped apicnt.o
When you build your module use:
make -C $PATH_TO_COMPILED_KERNEL M=pwd
See also Documentation/kbuild/modules.txt for further reference.
Sam
Hi Sam,
Thanks to your help and the kbuild documentation you referred me to I was able to build the module.
Thanks again,
Carlos Munoz
Quoted 94 lines · Sam Ravnborg
Quoted 5 lines · Carlos Munoz
Hi all,
I hope this is the right forum for this question.
Yes.
Quoted 5 lines
The makefile has the following rule to build apicnt.o:
apicnt.o: apicnt.o.shipped
cp apicnt.o.shipped apicnt.oThis is wrong. kbuild has knowledge how to copy a file named:
apicnt.o_shippd to apicnt.o
So you renamed the supplied .o fiel to apicnt.o_shipped and delte your own rule.Quoted 5 lines
#
#Makefilefor thephone_mrvldriver loadable module #
TARGET = phone_mrvl.oQuoted 7 lines
obj-$(CONFIG_PHONE_MARVELL) = phone_mrvl.o
ifeq ($(CONFIG_PHONE_LEGERITY),y)
phone_mrvl-objs = mrvphone.o slic.o legerity.o vp_hal.o sys_service.o apicnt.o apiinit.o apiquery.o vp_api.o vp_api_common.o mvutils.o endifPlease do:
phone_mrvl-$(CONFIG_PHONE_LEGERITY) := mrvphone.o slic.o legerity.o phone_mrvl-$(CONFIG_PHONE_LEGERITY) += vp_hal.o sys_service.o apicnt.o phone_mrvl-$(CONFIG_PHONE_LEGERITY) += apiinit.o apiquery.o vp_api.o phone_mrvl-$(CONFIG_PHONE_LEGERITY) += vp_api_common.o mvutils.oQuoted 5 lines
ifeq ($(CONFIG_PHONE_PROSLIC),y)
phone_mrvl-objs = mrvphone.o proslic.o
endifphone_mrvl-$(CONFIG_PHONE_PROSLIC) += mrvphone.o proslic.o
Quoted 4 lines
CFLAGS += -D__linux__
EXTRA_CFLAGS+= -Idrivers/telephony/mrvphoneEXTRA_CFLAGS+= -DNDEBUG -Dlinux -D__linux__ -Dunix -DEMBED -DLINUX -DHOST_LEQuoted 8 lines
ifeq ($(CONFIG_PHONE_LEGERITY),y)
EXTRA_CFLAGS+= -D__LEGERITY__
endif
ifeq ($(CONFIG_PHONE_PROSLIC),y)EXTRA_CFLAGS+= -D__PROSLIC__
endifHere you could do:
extra-cflags-$(CONFIG_PHONE_LEGERITY) += -D__LEGERITY__ extra-cflags-$(CONFIG_PHONE_PROSLIC) += -D__PROSLIC__EXTRA_CFLAGS+= $(extra-cflags-y)Please delete the rest - it is not needed.
Quoted 12 lines
all: $(TARGET)
$(TARGET): $(OBJS)
$(LD) -r $(OBJS) -o $(TARGET)clean:
-rm -f $(TARGET) *.elf *.gdb *.oapicnt.o: apicnt.o.shipped
cp apicnt.o.shipped apicnt.oWhen you build your module use:
make -C $PATH_TO_COMPILED_KERNEL M=pwdSee also
Documentation/kbuild/modules.txtfor further reference.Sam
Quoted 8 lines · Carlos Munoz
Hi all,
I hope this is the right forum for this question.
I'm trying to build a loadable module for a telephony card that includes several files. Some of the files are source files (written by me) and some are object files (provided by the chip vendor). I'm unable to link the vendor object files with the target.
you might want to ask them for the source, lots easier that way as well.