Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

How to create a Kernel driver

Dear Hippo

I have read you guide how to create a simple kernel driver . i wish you can give a more information to do it .

<div class='quotetop'>QUOTE </div>

--- Quote Start ---

# copy module files to rootfs and generate modules.dep

make ARCH=nios2nommu CROSS_COMPILE=nios2-linux-uclibc- INSTALL_MOD_PATH=~/rootfs modules_install[/b]

--- Quote End ---

first , i don&#39;t konw what&#39;s means the "INSTALL_MOD_PATH=~/rootfs modules_install" can you tell me ?

second . if i want to config it when i use "menuconfig"

what should i modify. can you give me a document ?

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You have to modify Kconfig and Makefile for the drivers. Look at the sud dirs of kernel drivers.

    make modules_install is need only when you use modules. It copies the moudels files .ko into rootfs. It is not needed if you do not use moduels.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks hippo

    but i can&#39;t find the *.ko in rootfs.I want to know which dir can be find the *.ko file when i use the command "modules_install" .

    I want to know can i use the next commnd to insert a module or remove a module.

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    #insmod &#21152;&#36733;&#27169;&#22359;# rmmod &#21368;&#36733;&#27169;&#22359;[/b]

    --- Quote End ---

    Thanks !
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    First, enable modules support in your kernel.

    Then config the drivers which you want to turn into modules, with [M] your drivers.

    Then build the kernel and modules install.

    The modules fies will be in the /lib/modules/2.6.11-uc0/kernel/drivers/..... .

    There is a file /lib/modules/2.6.11-uc0/modules.dep, which list all of them.