* The assemble file under the driver folder can not be recognized when the driver is built as module
@ 2006-04-10 10:16 Aubrey
2006-04-10 11:28 ` Erik Mouw
0 siblings, 1 reply; 10+ messages in thread
From: Aubrey @ 2006-04-10 10:16 UTC (permalink / raw)
To: linux-kernel
Hi all,
I've written a framebuffer driver and put it under the folder
"./drivers/video", it consists of two files" mydriver.c and myfun.S".
When I build it into the kernel image, everything is ok.
But when I build it as module, I got the following error message:
===========================================
aubrey@linux:~/cvs/kernel/uClinux-dist> make V=1
--------snip---------
make -f scripts/Makefile.build obj=drivers/video
make -f scripts/Makefile.build obj=drivers/video/backlight
make[3]: *** No rule to make target `drivers/video/rgb2ycbcr.c',
needed by `drivers/video/rgb2ycbcr.o'. Stop.
make[2]: *** [drivers/video] Error 2
make[1]: *** [drivers] Error 2
make[1]: Leaving directory `/home/aubrey/cvs/kernel/uClinux-dist/linux-2.6.x'
make: *** [linux] Error 1
===========================================
Make ask me for ".c" file. But it's an assemble file indeed.
Is it a bug of kernel script? (I'm using 2.6.16)
Regards,
-Aubrey
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The assemble file under the driver folder can not be recognized when the driver is built as module
2006-04-10 10:16 The assemble file under the driver folder can not be recognized when the driver is built as module Aubrey
@ 2006-04-10 11:28 ` Erik Mouw
2006-04-10 13:27 ` Aubrey
0 siblings, 1 reply; 10+ messages in thread
From: Erik Mouw @ 2006-04-10 11:28 UTC (permalink / raw)
To: Aubrey; +Cc: linux-kernel
On Mon, Apr 10, 2006 at 06:16:56PM +0800, Aubrey wrote:
> I've written a framebuffer driver and put it under the folder
> "./drivers/video", it consists of two files" mydriver.c and myfun.S".
Why would you write a driver in assembly in the first place? That makes
it highly unportable, I bet you can't compile your driver for x86 and
ARM from the same source. There are only four drivers in the whole
kernel tree that have an assembly part, but those are so tied to their
platform (Acorn, Amiga) that they aren't portable anyway.
> When I build it into the kernel image, everything is ok.
> But when I build it as module, I got the following error message:
> ===========================================
> aubrey@linux:~/cvs/kernel/uClinux-dist> make V=1
> --------snip---------
> make -f scripts/Makefile.build obj=drivers/video
> make -f scripts/Makefile.build obj=drivers/video/backlight
> make[3]: *** No rule to make target `drivers/video/rgb2ycbcr.c',
> needed by `drivers/video/rgb2ycbcr.o'. Stop.
> make[2]: *** [drivers/video] Error 2
> make[1]: *** [drivers] Error 2
> make[1]: Leaving directory `/home/aubrey/cvs/kernel/uClinux-dist/linux-2.6.x'
> make: *** [linux] Error 1
> ===========================================
>
> Make ask me for ".c" file. But it's an assemble file indeed.
> Is it a bug of kernel script? (I'm using 2.6.16)
I haven't seen your Makefile so I can't see what's wrong, but see
drivers/scsi/arm/Makefile for an example.
Erik
--
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The assemble file under the driver folder can not be recognized when the driver is built as module
2006-04-10 11:28 ` Erik Mouw
@ 2006-04-10 13:27 ` Aubrey
2006-04-10 17:33 ` Sam Ravnborg
2006-04-10 17:42 ` Adrian Bunk
0 siblings, 2 replies; 10+ messages in thread
From: Aubrey @ 2006-04-10 13:27 UTC (permalink / raw)
To: Erik Mouw; +Cc: linux-kernel
On 4/10/06, Erik Mouw <erik@harddisk-recovery.com> wrote:
> On Mon, Apr 10, 2006 at 06:16:56PM +0800, Aubrey wrote:
> Why would you write a driver in assembly in the first place? That makes
> it highly unportable, I bet you can't compile your driver for x86 and
> ARM from the same source. There are only four drivers in the whole
> kernel tree that have an assembly part, but those are so tied to their
> platform (Acorn, Amiga) that they aren't portable anyway.
Yes, the driver isn't portable. I'm working on the blackfin linux
system. The driver is written mostly by c except one codec. You know,
blackfin has DSP instruction set, so I write the codec in assembly to
improve my driver's performance.
>
> I haven't seen your Makefile so I can't see what's wrong, but see
> drivers/scsi/arm/Makefile for an example.
>
Makefile is simple.
===============================
----snip----
obj-$(CONFIG_FB_BFIN_7171) += bfin_ad7171fb.o rgb2ycbcr.o
----snip----
===============================
There are two files, bfin_ad7171fb.c and rgb2ycbcr.S under the folder
" ./drivers/video".
It should be OK because the driver can pass the compilation when
select it as built-in.
It just failed when select it as module.
Thanks your any hints.
Regards,
-Aubrey
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The assemble file under the driver folder can not be recognized when the driver is built as module
2006-04-10 13:27 ` Aubrey
@ 2006-04-10 17:33 ` Sam Ravnborg
2006-04-10 17:42 ` Adrian Bunk
1 sibling, 0 replies; 10+ messages in thread
From: Sam Ravnborg @ 2006-04-10 17:33 UTC (permalink / raw)
To: Aubrey; +Cc: Erik Mouw, linux-kernel
On Mon, Apr 10, 2006 at 09:27:18PM +0800, Aubrey wrote:
> On 4/10/06, Erik Mouw <erik@harddisk-recovery.com> wrote:
> > On Mon, Apr 10, 2006 at 06:16:56PM +0800, Aubrey wrote:
> > Why would you write a driver in assembly in the first place? That makes
> > it highly unportable, I bet you can't compile your driver for x86 and
> > ARM from the same source. There are only four drivers in the whole
> > kernel tree that have an assembly part, but those are so tied to their
> > platform (Acorn, Amiga) that they aren't portable anyway.
>
> Yes, the driver isn't portable. I'm working on the blackfin linux
> system. The driver is written mostly by c except one codec. You know,
> blackfin has DSP instruction set, so I write the codec in assembly to
> improve my driver's performance.
> >
> > I haven't seen your Makefile so I can't see what's wrong, but see
> > drivers/scsi/arm/Makefile for an example.
> >
> Makefile is simple.
> ===============================
> ----snip----
> obj-$(CONFIG_FB_BFIN_7171) += bfin_ad7171fb.o rgb2ycbcr.o
> ----snip----
> ===============================
> There are two files, bfin_ad7171fb.c and rgb2ycbcr.S under the folder
> " ./drivers/video".
> It should be OK because the driver can pass the compilation when
> select it as built-in.
What you say with the above is that you want to create two modules.
One module named: bfin_ad7171fb
and another module named: rgb2ycbcr
But kbuild does not support creating modules based on a .S file alone.
What I expect you to say is that you have one module named: bfin_7171
this is expressed like this:
obj-$(CONFIG_FB_BFIN_7171) += bfin_7171.o
bfin_7171-y := bfin_ad7171fb.o rgb2ycbcr.o
And then it works with your .S file.
Sam
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The assemble file under the driver folder can not be recognized when the driver is built as module
2006-04-10 13:27 ` Aubrey
2006-04-10 17:33 ` Sam Ravnborg
@ 2006-04-10 17:42 ` Adrian Bunk
2006-04-10 18:04 ` linux-os (Dick Johnson)
1 sibling, 1 reply; 10+ messages in thread
From: Adrian Bunk @ 2006-04-10 17:42 UTC (permalink / raw)
To: Aubrey; +Cc: Erik Mouw, linux-kernel
On Mon, Apr 10, 2006 at 09:27:18PM +0800, Aubrey wrote:
>...
> Makefile is simple.
> ===============================
> ----snip----
> obj-$(CONFIG_FB_BFIN_7171) += bfin_ad7171fb.o rgb2ycbcr.o
> ----snip----
> ===============================
> There are two files, bfin_ad7171fb.c and rgb2ycbcr.S under the folder
> " ./drivers/video".
> It should be OK because the driver can pass the compilation when
> select it as built-in.
> It just failed when select it as module.
>
> Thanks your any hints.
You can't build an object only built from an assembler file.
But you don't want to get two modules, you want one module built from
two source files.
IOW, you want:
obj-$(CONFIG_FB_BFIN_7171) += bfin_ad7171fb.o
bfin_ad7171fb-objs := bfin_ad7171fb_main.o rgb2ycbcr.o
Note that this requires renaming bfin_ad7171fb.c to bfin_ad7171fb_main.c.
> Regards,
> -Aubrey
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The assemble file under the driver folder can not be recognized when the driver is built as module
2006-04-10 17:42 ` Adrian Bunk
@ 2006-04-10 18:04 ` linux-os (Dick Johnson)
2006-04-10 18:24 ` Sam Ravnborg
2006-04-11 2:58 ` Aubrey
0 siblings, 2 replies; 10+ messages in thread
From: linux-os (Dick Johnson) @ 2006-04-10 18:04 UTC (permalink / raw)
To: Adrian Bunk; +Cc: Aubrey, Erik Mouw, linux-kernel
On Mon, 10 Apr 2006, Adrian Bunk wrote:
> On Mon, Apr 10, 2006 at 09:27:18PM +0800, Aubrey wrote:
>> ...
>> Makefile is simple.
>> ===============================
>> ----snip----
>> obj-$(CONFIG_FB_BFIN_7171) += bfin_ad7171fb.o rgb2ycbcr.o
>> ----snip----
>> ===============================
>> There are two files, bfin_ad7171fb.c and rgb2ycbcr.S under the folder
>> " ./drivers/video".
>> It should be OK because the driver can pass the compilation when
>> select it as built-in.
>> It just failed when select it as module.
>>
>> Thanks your any hints.
>
> You can't build an object only built from an assembler file.
>
> But you don't want to get two modules, you want one module built from
> two source files.
>
> IOW, you want:
>
> obj-$(CONFIG_FB_BFIN_7171) += bfin_ad7171fb.o
> bfin_ad7171fb-objs := bfin_ad7171fb_main.o rgb2ycbcr.o
>
> Note that this requires renaming bfin_ad7171fb.c to bfin_ad7171fb_main.c.
>
>> Regards,
>> -Aubrey
>
> cu
> Adrian
Can't he just put his own private compile definition in his
own Makefile?
%.o: %.S
as -o $@ $<
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.
_
\x1a\x04
****************************************************************
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 DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The assemble file under the driver folder can not be recognized when the driver is built as module
2006-04-10 18:04 ` linux-os (Dick Johnson)
@ 2006-04-10 18:24 ` Sam Ravnborg
2006-04-10 19:12 ` linux-os (Dick Johnson)
2006-04-11 2:58 ` Aubrey
1 sibling, 1 reply; 10+ messages in thread
From: Sam Ravnborg @ 2006-04-10 18:24 UTC (permalink / raw)
To: linux-os (Dick Johnson); +Cc: Adrian Bunk, Aubrey, Erik Mouw, linux-kernel
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The assemble file under the driver folder can not be recognized when the driver is built as module
2006-04-10 18:24 ` Sam Ravnborg
@ 2006-04-10 19:12 ` linux-os (Dick Johnson)
2006-04-10 19:30 ` Sam Ravnborg
0 siblings, 1 reply; 10+ messages in thread
From: linux-os (Dick Johnson) @ 2006-04-10 19:12 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: Adrian Bunk, Aubrey, Erik Mouw, linux-kernel
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.
_
\x1a\x04
****************************************************************
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 DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The assemble file under the driver folder can not be recognized when the driver is built as module
2006-04-10 19:12 ` linux-os (Dick Johnson)
@ 2006-04-10 19:30 ` Sam Ravnborg
0 siblings, 0 replies; 10+ messages in thread
From: Sam Ravnborg @ 2006-04-10 19:30 UTC (permalink / raw)
To: linux-os (Dick Johnson); +Cc: Adrian Bunk, Aubrey, Erik Mouw, linux-kernel
On Mon, Apr 10, 2006 at 03:12:55PM -0400, linux-os (Dick Johnson) wrote:
>
> 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.
kbuild does not support a single-file module being written entirely in
assembler.
kbuild obviously support multi file modules where one file is in
assembler.
In your example you generate a multi file module where some files are in
assembler - supported.
And the point was that one should NOT define private rules like:
%.o: %.S
as -o $@ $<
If there is a valid need for such stuff - then kbuild needs to be fixed.
But I have yet to see a need like this.
I know several external modules plays all sort of tricks to avoid using
kbuild infrastructure - I recall you have posted such receipts before.
Recently posted loop-aes is another example (if USE_KBUILD is not set).
Sam
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The assemble file under the driver folder can not be recognized when the driver is built as module
2006-04-10 18:04 ` linux-os (Dick Johnson)
2006-04-10 18:24 ` Sam Ravnborg
@ 2006-04-11 2:58 ` Aubrey
1 sibling, 0 replies; 10+ messages in thread
From: Aubrey @ 2006-04-11 2:58 UTC (permalink / raw)
To: linux-os (Dick Johnson); +Cc: Adrian Bunk, Erik Mouw, linux-kernel
> > IOW, you want:
> >
> > obj-$(CONFIG_FB_BFIN_7171) += bfin_ad7171fb.o
> > bfin_ad7171fb-objs := bfin_ad7171fb_main.o rgb2ycbcr.o
> >
> > Note that this requires renaming bfin_ad7171fb.c to bfin_ad7171fb_main.c.
That's the trick. Thanks.
Regards,
-Aubrey
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-04-11 2:59 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-10 10:16 The assemble file under the driver folder can not be recognized when the driver is built as module Aubrey
2006-04-10 11:28 ` Erik Mouw
2006-04-10 13:27 ` Aubrey
2006-04-10 17:33 ` Sam Ravnborg
2006-04-10 17:42 ` Adrian Bunk
2006-04-10 18:04 ` linux-os (Dick Johnson)
2006-04-10 18:24 ` Sam Ravnborg
2006-04-10 19:12 ` linux-os (Dick Johnson)
2006-04-10 19:30 ` Sam Ravnborg
2006-04-11 2:58 ` Aubrey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox