lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 25 Oct 2006 14:26:10 +0200
From:	Matthias Fechner <idefix@...hner.net>
To:	kbuild-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: Re: [kbuild-devel] Link lib to a kernel module

Hello Oleg,

* Oleg Verych <olecom@...wer.upol.cz> [24-10-06 12:11]:
> `Documentation/kbuild' directory in your linux sources.
> `makefiles.txt' about `lib-y',
> `modules.txt'   about modules.

I was now successfull with:
hello_lib.h:
int printHello(int);

hello_lib.c
int printHello(int count)
{
   int i;
      
   for(i=0;i<=count;i++)
   {
       printk("Hello World\n");
   }
   return 0;
}
			   
hello.c:
#include <linux/kernel.h>
#include <linux/module.h>
#include "hello_lib.h"
   
MODULE_LICENSE("GPL");
			   
int init_module(void)
{
    printk("call function\n");
    printHello(5);
    return 0;
}
				    
void cleanup_module(void)
{
    printk(KERN_INFO "remove module\n");
    return;
}
					  
Makefile:
KDIR    := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

obj-m += test.o
test-y := hello.o libhello_lib.a

all:
   gcc -I/usr/include -c -o hello_lib.o hello_lib.c
   rm -f libhello_lib.a
   ar cru libhello_lib.a hello_lib.o
   $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules KBUILD_VERBOSE=1
	      


Best regards,
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ