This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[OMAP3] How to compile a driver module?

Other Parts Discussed in Thread: AM1808

Hello All,

Can anyone tell me how to compile a driver as module for OMAP3 board. I have tool chain and kernel installed on my machine. I am not able to compile a test driver as module. Compilation steps or commands can be help full for me.

Thanks!

  • This involves two steps

    1) First, you need to run a utility such as menuconfig (see Getting Started Guide) which allows you to select which drivers you want to build into Linux Kernel and which drivers you want to build as modules (tool has instructions on how to do this)

    2) Second you need to build modules in a similar way you build kernel image; for example " % make modules" assuming all your paths and makefiles are set up correctly.

    Also, please note that these steps are not specific to OMAP35x platforms, most Linux kernels have similar commands.

  • That applies to drivers/modules included in Kernel already. My question was- how to compile a new driver (say hello_world) which is not included in current kernel version. obj-m += hello-1.o all: make -C /path/$(shell uname -r)/build M=$(PWD) modules clean: make -C /path/$(shell uname -r)/build M=$(PWD) clean This is how we do it normally. But in OMAP case, I am getting many errors after I set correct paths. I feel we have some deviation from standard directory structure or I am not following this well.

  • Just to be clear, what follows -C should be the path to the Linux kernel root directory.  Also, do you have more than one file (e.g. "+=" as opposed to ":=")?

    I have not tried OMAP environment, but have done this on DaVinci (a long time ago). 

  • Hi..

    I am also trying to compile a hello world kernel module for am1808 based evm.

    The module gets compiled, but when i do insmod,i.e.

        [linux-devkit]:/usr/local/practice> insmod test.ko 
        insmod: error inserting 'test.ko': -1 Invalid module format
    I get the above mentioned error.

    And after this when i did rmmod test.ko , this is what I got,

    [linux-devkit]:/usr/local/practice> rmmod test.ko 
    ERROR: Module test does not exist in /proc/modules
    
    
    According to me the modules for the linux kernel i.e linux-headers-2.6.32-33 should come to
    /proc/modules, rather the kernel modules for my specific board. 

    Any help on this will be highly appreciated..
    Thanks .