Find the answer to your Linux question:
Results 1 to 8 of 8
Hi, How do i add driver in kernel permanently?..I tried with insmod but after power off its gone. How will i do this?. Anyone knows plz reply.. Thanks...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2011
    Posts
    68

    How to add driver in kernel permanently??


    Hi,
    How do i add driver in kernel permanently?..I tried with insmod but after power off its gone. How will i do this?. Anyone knows plz reply..

    Thanks

  2. #2
    Just Joined!
    Join Date
    Sep 2008
    Posts
    10
    If you want to automatically load a module (with a driver) whenever your machine starts you should add that info to the config file under /etc. Depending on what software you're using you should look for /etc/conf.d/modules or /etc/modules.autoload/ or sth similar.

    To "add driver in kernel permanently" rebuild your kernel (i think that's the only option, could be wrong)

  3. #3
    Just Joined!
    Join Date
    Nov 2011
    Posts
    68
    First of all i want to tell you one thing that i am a newbie to this field. Can you give an example that how to add driver module in config file?

    output of cd /etc
    ls

    boa.conf inetd.conf ntp.conf
    default init.d pam.d
    dev.d inittab passwd
    dhcpc inputrc profile
    dhcpcdhcpcd-eth0.cache issue rc.d
    dhcpcdhcpcd-eth0.info issue.net resolv.conf
    fstab localtime rpc
    group mime.types samba
    host.conf modprobe.d services
    hosts motd shells
    hosts.equiv mtab udev
    hotplug network udhcpc
    hotplug.d nsswitch.conf yp.conf

    Where should i add? If anyone knows plz help me to do it??

    Thanks

  4. #4
    Just Joined!
    Join Date
    Nov 2011
    Posts
    68
    Plz help me !!

  5. #5
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    Hello

    The best kernel howto that I've found and used in the past for building kernels was this one:

    Digital Hermit - Kernel-Build-HOWTO

    Note that I've not used it with the 3.x kernels so not sure how well it still applies.
    oz

  6. #6
    Linux Enthusiast gruven's Avatar
    Join Date
    Dec 2004
    Location
    Arkansas
    Posts
    541
    First of all, if all you want to know is how to get the driver to load on startup without you having to load it, it would be helpful to know what distribution you are using. That way we can better tell you where the autoload file will be.

    If you actually want to know how to compile the driver into the kernel, that would require patching the kernel with your code, and recompiling the kernel.

    Linux User #376741
    Code is Poetry

  7. #7
    Just Joined!
    Join Date
    Nov 2011
    Posts
    68
    Quote Originally Posted by gruven View Post
    First of all, if all you want to know is how to get the driver to load on startup without you having to load it, it would be helpful to know what distribution you are using. That way we can better tell you where the autoload file will be.

    If you actually want to know how to compile the driver into the kernel, that would require patching the kernel with your code, and recompiling the kernel.
    I am working on 2.6.10 linux kernel. I wanna know how to patch the kernel with my code and recompiling the kernel. Should i do Any modification in the kconfig and Makefile in drivers directory?

  8. #8
    Just Joined!
    Join Date
    Mar 2012
    Posts
    2
    hi steffi,
    yes you have to edit kconfig and makefile ....
    I am giving you a step by step procedure for inserting your driver statically and making it available in make menuconfig
    step 1.
    go to kernel source.
    step 2
    go to drivers directory
    step 3
    go to particular subdirectory according to your driver like eg. if i want to insert driver for serial port then i will go to /drivers/serial/
    step 4
    copy your sourcecode of driver ( .c file ) into current directory.
    step 5
    vim kconfig of the current directory
    go at the end of the file , now before endmenu you have to give your entry for your driver
    now you can give that entry by two way
    ( I am giving you an overview according to my example ,,you change it according to your driver)
    option 1
    tristate " Board test serial driver "
    select SERIAL_CORE
    line 1 ==> this message will show in the make menuconfig command
    line 2 ==> This is dependancy driver which is compiled when your driver gets called, keep it as it is.

    option 2
    config SERIAL_TEST
    bool " Board test serial driver "
    select SERIAL_CORE

    use option 1 when you want to give user a option to compile it as a dynamically or statically <M> / <*>
    use option 2 when you want user should compile it as only statically [ * ]

    step 6
    vim Makefile of the same directory
    at the end of the file give an entry as
    obj-$(CONFIG_SERIAL_TEST) += <your .c file name>.o
    step 7
    close the files and come out of source code
    step 8
    now compile your kernel source using make menuconfig ,and you will find your driver entry into drivers part of make menuconfig....


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •