🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

module hello world

#60531
From: Kuba_O
Date: Sat, 19 Nov 2005 22:05
33 lines
1314 bytes
Witam, napisałem sobie modułowe "Hello, world!":


#define __KERNEL__
#define MOUDLE
#define LINUX
#include<linux/module.h>
#include<linux/kernel.h>
#include<asm/unistd.h>
int init_module(void)
{
	printk("HELLO!\n");
	return 0;
}
void cleanup_module(void)
{
	printk("BYE\n");
}

Skompilowałem to przez:
 gcc -I /usr/src/*2.6.14/include -O3 -Wall -c hello.c

I przy próbie ładowania (insmod hello.o) dostaję:
insmod: error inserting 'hello.o': -1 Invalid module format

Wszystkie komentarze mile widziane :-)

Pozdrawiam

PS. Kernel oczywiście 2.6.14, system: Debian 3.1, gcc 3.3.5
-- 

empty
Technical Details
Message-ID: <slrndnv91v.52g.this@localhost.localdomain>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
From: Kuba_O <this@foo.o2.shmoo.pl>
Newsgroups: pl.comp.os.linux.programowanie
Subject: module hello world
Date: Sat, 19 Nov 2005 22:05:57 +0000 (UTC)
Organization: independet
Lines: 34
Message-ID: <slrndnv91v.52g.this@localhost.localdomain>
NNTP-Posting-Host: h234086.net.pulawy.pl
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1132437957 18182 82.177.234.86 (19 Nov 2005 22:05:57 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Sat, 19 Nov 2005 22:05:57 +0000 (UTC)
foo: shmoo
X-User: this
User-Agent: slrn/0.9.8.1 (Debian)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit