🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.os.linux.programowanie
Article #60534

Re: module hello world

#60534
From: Jarosław Siebert
Date: Sun, 20 Nov 2005 11:15
58 lines
2126 bytes
On Sat, Nov 19, 2005 at 10:05:57PM +0000, Kuba_O wrote:
> Wszystkie komentarze mile widziane :-)
inny przykład:
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>

#define MY_NAME "hello"

static int __init hello_init (void)     {printk(KERN_INFO "Witaj swiecie\n");
re
turn 0;}
static void __exit hello_exit (void) {printk(KERN_INFO "zegnaj swiecie\n");}

module_init (hello_init);
module_exit (hello_exit);

MODULE_DESCRIPTION("Przykladowy modul");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("noname");

Makefile do tego:

MODNAME = hello
ifneq ($(KERNELRELEASE),)
obj-m   := $(MODNAME).o

else
KDIR    := /lib/modules/$(shell uname -r)
BDIR    := $(KDIR)/build
PWD     := $(shell pwd)

modules:
        $(MAKE) -C $(BDIR) SUBDIRS=$(PWD) modules

modules_install: modules
        cp $(MODNAME).ko $(KDIR)/
        depmod -a

test: modules
        insmod $(MODNAME).ko
        dmesg|tail -n1

endif

clean:
        rm -rf *.o *.ko $(MODNAME).mod.c


pozdrawiam
	iu1j4


-- 
               .:  DLJ PROJECT  :.
             .: Jarosław  Siebert :. 
    ........: jsiebert@poczta.wp.pl :.........
  .: Lru: 255615 | tel: 603877428 | Gg: 560046:. 
Technical Details
Message-ID: <20051120121508.GB17781@siebert.dljproject.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
References: <slrndnv91v.52g.this@localhost.localdomain>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
From: Jarosław Siebert <jsiebert@poczta.wp.pl>
Newsgroups: pl.comp.os.linux.programowanie
Subject: Re: module hello world
Date: Sun, 20 Nov 2005 11:15:26 +0000 (UTC)
Organization: tp.internet - http://www.tpi.pl/
Lines: 58
Message-ID: <20051120121508.GB17781@siebert.dljproject.pl>
References: <slrndnv91v.52g.this@localhost.localdomain>
NNTP-Posting-Host: awr154.internetdsl.tpnet.pl
Mime-Version: 1.0
X-Trace: atlantis.news.tpi.pl 1132485326 18864 83.18.69.154 (20 Nov 2005 11:15:26 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Sun, 20 Nov 2005 11:15:26 +0000 (UTC)
In-Reply-To: <slrndnv91v.52g.this@localhost.localdomain>
User-Agent: mutt-ng/devel-r570 (NetBSD)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit