Wiki section "Building Only Kernel Modules" incomplete

Philip A. Prindeville philipp_subx at redfish-solutions.com
Wed Dec 24 00:55:09 UTC 2008


I appreciate the offer.

I'll post a tarball to our website if it would help at all, but what's going on should be fairly straightforward.

The project is in the directory "tx4650" (yes, it's the drivers for the Promise "FastTrak TX4650" RAID controller).

The module t3sas.ko gets built from either ftlib/ftlib.obj.32 or ftlib/ftlib.obj.64 (i386 or x86_64, respectively) being linked against the dot-ohs from the linux/ subdirectory.

The project originally wasn't written to use Kbuild.


### tx/Kbuild

$(warn ARCH=$(ARCH))

ifeq ($(ARCH),x86_64)
FTLIB := ftlib/ftlib.obj.64
else
FTLIB := ftlib/ftlib.obj.32
endif

$(warn FTLIB=$(FTLIB))

obj-m += t3sas.o
libs-m += linux/

t3sas-objs := linux/lib.a $(FTLIB)

clean:
	rm -f t3sas.o


So... in a nutshell: build the subdirectory "linux".  In it, it will build the target lib.a ...  Not sure if I needed to use $(obj) here or just keep things relative.

Then link the ftlib.obj.* of the appropriate architecture to the linux/lib.a file.  Voila.  Should be simple, right?

Except it's not building the "linux" directory...

### tx4650/linux/Kbuild
$(warn ARCH=$(ARCH))

ifeq ($(ARCH),x86_64)
ARCH_FLAGS := -D_AMD64B -D_64BPLATFORM
else
ARCH_FLAGS := -D_X8632B -D_32BPLATFORM
endif

# KSRC is $(TOPDIR) ???  need to get to the kernel includes...

cflags-y += \
	-Wno-multichar -D_LINUXDRIVER $(ARCH_FLAGS) -D_OBSOLETE_PROC_ \
	-I$(KSRC)/include -I$(KSRC)/include/scsi -I$(KSRC)/include/drivers/scsi \
	-I$(src)/.. -I$(src) -I$(src)/../include

$(warn cflags-y=$(cflags-y))

lib-m := osd_main.o osd_cmpi.o osd_cmpm.o osd_ioctl.o osd_timer.o

clean:
	rm -f *.o lib.a


And all this directory is supposed to do is build the 5 targets into lib.a with my special cflags.

Again, should be simple enough...

What am I missing?

-Philip



Eric Sandeen wrote:
> Philip A. Prindeville wrote:
>> [ Resending per Jarod... ]
>>
>> Ok, so the below thread has changed tracks...  I started looking at:
>>
>> http://fedoraproject.org/wiki/Docs/CustomKernel?highlight=#Building_Only_Kernel_Modules
>>
>>
>> And saw, "*This section needs to be updated and fleshed out".  Yes,
>> indeed.  I'm trying to go by this section, but it's a little thin.
>>
>> Who owns it?  I'd like to work with them on figuring out what needs to
>> be added to make it useful.
> 
> I know my way around kbuild pretty well too, if I can help let me know,
> or if you have specific problems or examples I'd be willing to take a look.
> 
> See also Documentation/kbuild/ in the kernel tree, it's quite good.
> 
> Looking at the thread below, for cflags (including include paths) try
> this section:
> 
> --- 3.7 Compilation flags
> 
> As for subdirs, and out-of-tree module builds, last I checked it really
> all wants to be driven from one Makefile at the top (of the module dir).
> 
> -Eric
> 
>> Thanks,
>>
>> -Philip
>>
>> ==== Original thread below ====
>>
>> *Philip A. Prindeville wrote:
>>> Jerry Amundson wrote:
>>>> On 12/21/08, Jerry Amundson <jamundso at gmail.com> wrote:
>>>>  
>>>>> On 12/21/08, Philip A. Prindeville <philipp_subx at redfish-solutions.com>
>>>>> wrote:
>>>>>    
>>>>>> I was going to build an RPM for the modules for the Promise FastTrak
>>>>>> TX4650 PCI-e RAID controller for FC9.
>>>>>>
>>>>>> Their support website claims it's supported "in-box" in FC9, but it
>>>>>> turns out that's not true:
>>>>>>
>>>>>> $ lspci -v -s 02:00.0
>>>>>> 02:00.0 RAID bus controller: Promise Technology, Inc. Unknown 
>>>>>> device 3f20
>>>>>>     Subsystem: Promise Technology, Inc. Unknown device 3f22
>>>>>>     Flags: bus master, fast devsel, latency 0, IRQ 10
>>>>>>     I/O ports at dc00 [size=128]
>>>>>>     I/O ports at d800 [size=256]
>>>>>>     Memory at fbeff000 (32-bit, non-prefetchable) [size=4K]
>>>>>>     Memory at fbec0000 (32-bit, non-prefetchable) [size=128K]
>>>>>>     Memory at fbefc000 (32-bit, non-prefetchable) [size=8K]
>>>>>>     Expansion ROM at fbe80000 [disabled] [size=256K]
>>>>>>     Capabilities: [50] Power Management version 2
>>>>>>     Capabilities: [70] Express Legacy Endpoint, MSI 00
>>>>>>     Capabilities: [94] SATA HBA <?>
>>>>>>     Capabilities: [100] Advanced Error Reporting <?>
>>>>>>     Capabilities: [140] Virtual Channel <?>
>>>>>>     Capabilities: [160] Device Serial Number 01-00-00-00-02-00-00-00
>>>>>>     Capabilities: [170] Power Budgeting <?>
>>>>>>
>>>>>>
>>>>>> so...  I downloaded their drivers from their website:
>>>>>>
>>>>>> http://www.promise.com/upload/Support/Driver/FT%20TX4650-2650%20Linux%20Kernl%202.6%20PSC%20v1.1.0.12.tgz 
>>>>>>
>>>>>>
>>>>>> (Yes, I realize it will taint my kernel... and it doesn't include 
>>>>>> all of
>>>>>> the
>>>>>> source.)
>>>>>>
>>>>>> I tried to build it, but getting into the kernel directory:
>>>>>>       
>>>>> Don't start there. Start with the README of the source you downloaded.
>>>>>     
>>>> And it looks like you'll some code fixing to get it to compile...
>>>> http://www.colinmackenzie.net/index.php?option=com_content&view=article&id=12:promise-satasas-driver-update-tx4650tx2650&catid=8:rotator&Itemid=7 
>>>>
>>>>
>>>> jerry
>>>>
>>>>   
>>> I saw the more recent postings...
>>>
>>> My understanding is that the TX4650 has the RAID-5 XOR ASICs to 
>>> accelerate the reed-solomon code calculations... hence my wanting to 
>>> use this driver.
>>>
>>> I picked up the patches that you pointed me at (including "The 
>>> Czar's", which was necessary to compile on 2.6.25 and subsequent)...
>>>
>>> Then I looked at:
>>>
>>> http://fedoraproject.org/wiki/Docs/CustomKernel?highlight=#Building_Only_Kernel_Modules 
>>>
>>>
>>>
>>> but had some questions about that.
>>>
>>> The example is a little thin.  It doesn't explain what to do if you 
>>> need to pass in extra C flags, extra include directories, or if your 
>>> driver has several subdirectories that need to be compiled and linked 
>>> together (or if it is a partial-source release, and has canned object 
>>> files that also need to be linked in).
>>>
>>> Anyone have a real-life example that they can point me at that does this?
>>>
>>> Thanks,
>>>
>>> -Philip
>>>
>>>
> 




More information about the kernel mailing list