LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   kernel config (https://www.linuxquestions.org/questions/linux-kernel-70/kernel-config-447922/)

yhus 05-23-2006 09:34 PM

kernel config
 
Hi,

How can I add a new module or submenu to kernel config menu? Do I need to modify Makefile or Config.in?

Thank you.

Jim

perfect_circle 05-23-2006 10:03 PM

what exactly do you mean by adding?
have you created a new module or do you want to compile a standard kernel module that was disabled in your old kernel?

jschiwal 05-23-2006 10:33 PM

I ran
make cloneconfig
make oldconfig
to generate a new .config file.

Then I noticed this in the Makefile
Code:

# Read in dependencies to all Kconfig* files, make sure to run
# oldconfig if changes are detected.
-include .kconfig.d

include .config

# If .config needs to be updated, it will be done via the dependency
# that autoconf has on .config.
# To avoid any implicit rule to kick in, define an empty command
.config .kconfig.d: ;

# If .config is newer than include/linux/autoconf.h, someone tinkered
# with it and forgot to run make oldconfig.
# If kconfig.d is missing then we are probarly in a cleaned tree so
# we execute the config step to be sure to catch updated Kconfig files
$(objtree)/include/linux/autoconf.h: .kconfig.d .config
        $(Q)mkdir -p include/linux
        $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
else
# Dummy target needed, because used as prerequisite
$(objtree)/include/linux/autoconf.h: ;
endif

I also looked in the kernels Documentation directory:
/usr/src/linux-2.6.16.13-4/Documentation/kbuild/modules.txt
/usr/src/linux-2.6.16.13-4/Documentation/HOWTO
/usr/src/linux-2.6.16.13-4/Documentation/kernel-docs.txt

After running "make pdfdocs"
/usr/src/linux-2.6.16.13-4/Documentation/DocBook/kernel-hacking.pdf

Be sure to work in a copy of the kernel source before you do your hacking. However, why not look at how ndiswrapper or nvidia produces externel loadable modules in the /lib/modules/ tree if your kernel module could be a loadable module using the standard kernel.

I hope I made at least some sense.

yhus 05-23-2006 10:49 PM

I have a new device driver module and I want to add it as SUPPORT_MY_NEW_DEVICE_DRIVER to the kernel config menu. By running make menuconfig, it displays existing modules and submenus. I can select or remove modules by keys, but how can I add a new module SUPPORT_MY_NEW_DEVICE_DRIVER to the menu?

Thanks.

Jim

jschiwal 05-24-2006 01:25 AM

Running "make oldconfig" will prompt for new items in the kernel. Then subsequently when you run "make xconfig" those items will show up.

What you need to do to get these items to show up when you run "make oldconfig" are explained on page 23 of the kernel_hacking.pdf document I mentioned in my previous post.

For most device modules, I still think that an external build process, such as nvidia and ndiswrapper uses to build a kernel module without the need to recompile the kernel is a better way to go. What kind of device is this for?

yhus 05-24-2006 06:49 AM

After looking at kernel structure, I guess that kernel 2.6 is now using Kconfig (equivalent to Config.in in kernel 2.4, right??) for module / menu configuration. New modules should be added to Kconfig, is it correct?

Thank you.

Jim


All times are GMT -5. The time now is 02:52 PM.