Re: The assemble file under the driver folder can not be recognized when the driver is built as module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 10 Apr 2006, Sam Ravnborg wrote:

> On Mon, Apr 10, 2006 at 02:04:59PM -0400, linux-os (Dick Johnson) wrote:
>
>> Can't he just put his own private compile definition in his
>> own Makefile?
>>
>> %.o:	%.S
>>  	as -o $@ $<
>
> That would never generate a module anyway. And kbuild support building
> .o from .S with all the kbuild argument chechking etc.
> Doing it so would be wrong.
>
> 	Sam
>


Really?? Here is a Makefile that has been known to work for sometime.
As you can clearly see, it has lots of ".S" files. The last compile
was on Linux-2.6.15.4. If current kernel building procedures prevents
the assembly of assembly-language files and requires that the kernel
modules be written entirely in 'C', then it is broken beyond all
belief and must be fixed.


#
#    Copyright(c) 2004  Analogic Corporation
#
#    This program may be distributed under the GNU Public License
#    version 2, as published by the Free Software Foundation, Inc.,
#    59 Temple Place, Suite 330 Boston, MA, 02111.
#
#    Project Makefile for kernel versions over 6
#    Created 05-OCT-2004    Richard B. Johnson
#
#    Note that macro "obj" refers to this directory when
#    make is executing from the kernel directory.
#

%.o:%.S
 		as -o $@ $<

VERS := $(shell uname -r)
CDIR := $(shell pwd)
MKNOD = /usr/bin/mknodp
FNAM = HeavyLink
EXTRA_CFLAGS += -DKVER6 -DMAJOR_NR=178 -DMODNAME="\"$(FNAM)"\"

OBJS =	datalink.o	min_size_t.o	license.o	ram_test.o\
 	rwcheck.o	seeprom.o	rwreg.o		rnd.o\
 	rdtsc.o		dma_buffer.o	ioctltxt.o

all:		chkhdrs
 		@./chkhdrs
 		@make V=1 -C /usr/src/linux-$(VERS) SUBDIRS=$(CDIR) modules
 		strip -x -R .note -R .comment $(FNAM).ko

obj-m		:= 	$(FNAM).o
$(FNAM)-objs	:=	$(OBJS)
$(obj)/min_size_t.o:	$(obj)/min_size_t.S	$(obj)/Makefile
$(obj)/license.o:	$(obj)/license.c	$(obj)/Makefile
$(obj)/ram_test.o:	$(obj)/ram_test.c	$(obj)/Makefile
$(obj)/rwcheck.o:	$(obj)/rwcheck.S	$(obj)/Makefile
$(obj)/rwreg.o:		$(obj)/rwreg.S		$(obj)/Makefile
$(obj)/rnd.o:		$(obj)/rnd.S		$(obj)/Makefile
$(obj)/rdtsc.o:		$(obj)/rdtsc.S		$(obj)/Makefile
$(obj)/ioctltxt.o:	$(obj)/ioctltxt.s
$(obj)/datalink.o:	$(obj)/datalink.c	$(obj)/datalink.h\
 			$(obj)/config.h		$(obj)/types.h\
 			$(obj)/plx.h		$(obj)/dlb.h\
 			$(obj)/ver.h		$(obj)/Makefile\
 			$(SUBDIRS)/bool.h	$(SUBDIRS)/kver.h
$(obj)/dma_buffer.o:	$(obj)/dma_buffer.c	$(obj)/datalink.h\
 			$(obj)/config.h		$(obj)/Makefile\
 			$(SUBDIRS)/bool.h
$(obj)/seeprom.o:	$(obj)/seeprom.c	$(obj)/plx.h\
 			$(obj)/types.h		$(obj)/Makefile

chkhdrs:	../tools/chkhdrs.c
 	gcc -O2 -Wall -o chkhdrs ../tools/chkhdrs.c

$(SUBDIRS)/chktrue:	$(SUBDIRS)/../tools/chktrue.c
 	gcc -O2 -Wall -o $(SUBDIRS)/chktrue $(SUBDIRS)/../tools/chktrue.c

$(SUBDIRS)/bool.h:	$(SUBDIRS)/chktrue
 	cd $(SUBDIRS) ; $(SUBDIRS)/chktrue

$(SUBDIRS)/mkioctltxt:	$(SUBDIRS)/mkioctltxt.c
 	gcc -O2 -Wall -o $(SUBDIRS)/mkioctltxt $(SUBDIRS)/mkioctltxt.c

$(SUBDIRS)/ioctltxt.s:	$(SUBDIRS)/mkioctltxt $(SUBDIRS)/datalink.h
 	cd $(SUBDIRS) ; $(SUBDIRS)/mkioctltxt

$(SUBDIRS)/chkver:	$(SUBDIRS)/../tools/chkver.c
 	gcc -O2 -Wall -o $(SUBDIRS)/chkver $(SUBDIRS)/../tools/chkver.c

$(SUBDIRS)/kver.h:	$(SUBDIRS)/chkver
 	cd $(SUBDIRS) ; $(SUBDIRS)/chkver $(VERS)


install:	install.sh $(MKNOD)
 	@sh install.sh install


$(MKNOD):	../tools/mknodp.c
 	make -C ../tools

clean:
 	rm -rf $(OBJS) $(FNAM).ko $(FNAM).mod.c $(FNAM)*.o \.*.cmd \
chkhdrs \.tmp_versions chktrue bool.h kver.h *.s mkioctltxt chkver
 		@sh install.sh clean




Cheers,
Dick Johnson
Penguin : Linux version 2.6.15.4 on an i686 machine (5589.42 BogoMips).
Warning : 98.36% of all statistics are fiction, book release in April.
_


****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux