[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: adding modules to the kernel



> -----Original Message-----
> From: Amit Kucheria [mailto:akucheria@xxxxxxx.com] 
> Sent: Tuesday, March 04, 2003 23:43
> To: Etrax mailing list
> Subject: adding modules to the kernel
> 
> Hi,
> 
> I have written a module that I would like to include onto the 
> LX board. I want to be able to {ins,rm,ls}mod it instead of 
> compiling it into the kernel.
> 
> After making the necessary changes in
> arch/cris/drivers{Config.in,Makefile}, I run 'make menuconfig'
> to enable my driver as a module and thereby creating the 
> .config file in the process. Now, I am trying to 'make kernel'
> from the top level directory.
> 
> ------- Snip from top level Makefile -------------------------
>        @xxxxxxx.latest \
>               -o ! -f $(AXIS_KERNEL_DIR)/.config; then \
>                 cp kernelconfig $(AXIS_KERNEL_DIR)/.config ; \
>                 rm -f kernelconfig.latest ; \
>         fi
>         @xxxxxxx.config \
>             2> /dev/null ; then \
>                 ($(MAKE) -C $(AXIS_KERNEL_DIR) oldconfig \
>                  && $(MAKE) -C $(AXIS_KERNEL_DIR) dep \
>                  && $(MAKE) -C $(AXIS_KERNEL_DIR) clean) || exit 1; \
>         fi
> --------------------------------------------------------------
> 
> This part of the Top-level Makefile (under 'kernel' target) 
> will always overwrite the .config with kernelconfig.latest.

I think you have misread what the Makefile does above. It never
overwrites .config with kernelconfig.latest. If it cannot find
a kernelconfig.latest file or it cannot find a .config file,
then it will use the kernelconfig file as the default configuration
by copying it to .config.

Then it checks if kernelconfig.latest differs from .config, in
which case it will do a make oldconfig dep clean.

Then (in the lines following your snippet) it will copy .config
to kernelconfig.latest.

So the only case where your .config file could be overwritten
is if you do not have a kernelconfig.latest file at all. So to
make sure your changes to the .config file are not lost under
any circumstances, you should copy it to the kernelconfig file
after you have updated it.

> Wouldn't it be a better strategy to just prompt the user to 
> generate his/her own .config by running 'make menuconfig' in
> the os/linux directory and have kernelconfig.latest as a 
> symlink to os/linux/.config?

Nope, that defeats the purpose of the kernelconfig file (note
that kernelconfig.latest is a generated file that is only used
to see if .config has changed since the last time we built the
product). kernelconfig is the default kernel configuration file 
as it is present in the product description directory.

> How are other developers organizing their own modules? Also,
> where are you putting the modules on the filesystem?

Modules are installed automatically by the main Makefile in the
/lib/modules/<kernel version>/kernel directory.

> Thanks in advance.
> 
> Regards,
> Amit

//Peter