[CMake] Building linux kernel module with Cmake

suhasj at aftek.com suhasj at aftek.com
Sat Nov 3 01:49:20 EDT 2007


Oops I missed the main statements...
Sorry for that

Contibuing to the previous post ...

ADD_CUSTOM_COMMAND(OUTPUT DRIVER_BIN_FILE
                   COMMAND ${KBUILD_CMD}
                   DEPENDS ${MODULE_SOURCE_FILES} VERBATIM
                   )

ADD_CUSTOM_TARGET(driver
                   DEPENDS ALL DRIVER_BIN_FILE )


> Well there's no ADD_CUSTOM_COMMAND or ADD_CUSTOM_TARGET for one thing.
> :-)
>
> Cheers,
> Brandon Van Every
>
> On Nov 2, 2007 7:40 AM, Suhas Jain <suhasj at aftek.com> wrote:
>> As you said I am using these ADD_CUSTOM_COMMAND / ADD_CUSTOM_TARGET
>> But its not working at my end... please help me out
>> This is what I have in my CMakeLists.txt file
>> ===========================================================================
>> Set( MODULE_OUTPUT_FILES    hello.o
>>                             hello.mod.c
>>                             hello.mod.o
>>                             hello.ko
>>                             .hello.o.cmd
>>                             .hello.ko.cmd
>>                             .hello.mod.o.cmd
>>                                     main.o
>>                                     .main.o.cmd
>>                                     output.o
>>                                     output.o.cmd
>>                             .tmp_versions/hello.mod
>>                             .tmp_versions/ )
>>
>> Set( MODULE_SOURCE_FILES    output.c
>>                                     main.c )
>>
>> Set( DRIVER_FILE        hello.ko )
>> Set( DRIVER_TARGET_NAME hello-module )
>> Set( DRIVER_BIN_FILE    ${CMAKE_BINARY_DIR}/bin/${DRIVER_FILE} )
>> Set( MODULE_SOURCE_DIR  ${CMAKE_CURRENT_BINARY_DIR} )
>>
>> Set( KERNEL_DIR "/lib/modules/2.6.20-16-generic/build" )
>> Set( KBUILD_CMD ${CMAKE_MAKE_PROGRAM}
>>                 -C ${KERNEL_DIR}
>>                 M=${MODULE_SOURCE_DIR}
>>                 modules )
>> =========================================================================
>>
>> Please point me out if I am doing something wrong. I think I am missing
>> something to add.
>>
>>
>>
>>
>> -----Original Message-----
>> From: cmake-bounces+suhasj=aftek.com at cmake.org
>> [mailto:cmake-bounces+suhasj=aftek.com at cmake.org] On Behalf Of Brandon
>> Van
>> Every
>> Sent: Friday, November 02, 2007 12:08 AM
>> To: cmake at cmake.org
>> Subject: Re: [CMake] Building linux kernel module with Cmake
>>
>>
>> On Nov 1, 2007 5:48 AM, Suhas Jain <suhasj at aftek.com> wrote:
>> > Thanks for you reply Hendrik
>> > Even I know that Kbuild is a very simple procedure to do so.
>> > But I have a source tree which has applications, drivers and other
>> modules
>> > for different OS as well as hardware architectures and I want to
>> compile
>> all
>> > these folders from a single top level directory. All this can be
>> achieved
>> > with Cmake utlity. I have already compiled other modules.
>> > I want to know if it possible to use cmake for compiling kernel module
>>
>> It would be simpler to use ADD_CUSTOM_COMMAND / ADD_CUSTOM_TARGET to
>> invoke the Linux kernel's native Kbuild, then utilize the results.
>>
>>
>> Cheers,
>> Brandon Van Every
>>
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>>
>>
>>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>




More information about the CMake mailing list