Re: Problems in compiling the module "/net/ieee80211"

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

 



On Mon, 18 Sep 2006, Anuj Tripathi wrote:

> Hi
>
> I am trying to compile the kernel source code of .c files in
> /linux-2.6.17.11/net/ieee80211 in  a standalone manner. My aim is to
> profile these files, especially the security functions, and to find the
> bottlenecks in the implementation and then to fine tune it.
>
> While compiling them as
>
> gcc -D__KERNEL__ -I ../../kernel2/linux-2.6.17.11/include ieee80211_crypt.c
>
> I initially got error with KBUILD but was able to remove it. Now
> following are the errors I am getting.


THEY (whoever 'they' are) don't want you to build modules that way
anymore. THEY don't want you to use standard tools in standard ways.
The module build procedure has been obfuscated to punish people
like you who are obviously traditionalists. However, if you insist
upon building a module the traditional way, try this:

#
VRS := $(shell uname -r)
INC := $(shell gcc --print-file-name include)
NAME   = YOUR_MODULE_NAME
CC     = gcc -Wall -O2 -nostdinc -fomit-frame-pointer
INCL   = -I$(INC)
INCL  += -I/usr/src/linux-$(VRS)/include
INCL  += -I/usr/src/linux-$(VRS)/include/asm/mach-default
DEFS   = -D__KERNEL__ -DMODULE -DMAJOR_NR=$(MAJR) -DCONFIG_SMP=1
DEFS  += -DMODNAME=$(NAME) -DKBUILD_BASENAME=\"$(NAME)\"
CC    += $(DEFS) $(INCL) -fno-strict-aliasing

... After that, you are going to have to link your module with:


#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/compiler.h>
#define DEREF(x) (#x)
#define MKSTR(x) DEREF(x)
#include <linux/vermagic.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
struct module __attribute__((section(".gnu.linkonce.this_module")))
  __this_module = {
  .name = MKSTR(MODNAME),
  .init = init_module,
  .exit = cleanup_module,
};
static const char __attribute_used__ __attribute__((section(".modinfo")))
__module_depends[]="depends=";


... to make a ".ko" file. See! Isn't that fun?


Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.66 BogoMips).
New book: http://www.AbominableFirebug.com/
_


****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux