LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-12-2006, 02:57 PM   #1
Last Attacker
Member
 
Registered: Jun 2004
Location: South Africa
Distribution: Ubuntu
Posts: 120

Rep: Reputation: 15
Compiling a Kernel Module for User Mode Linux


Hello everyone!
I am having problems compiling a module for the 2.6.10 kernel (or rather I tried 2 other kernels aswell) but it keeps on giving me "file not found" errors such as:

Code:
include/asm/ptrace.h:9:27: error: sysdep/ptrace.h: No such file or directory
include/asm/ptrace-generic.h:24:25: error: skas_ptrace.h: No such file or directory
include/asm/processor-generic.h:15:25: error: choose-mode.h: No such file or directory
I have the 2.6.13-15 kernel that came with SuSE 10.0 and I'm using the 2.6.10 kernel for User Mode Linux support.
I compiled the UML version with success. It runs, opens up my root_fs without problems, even runs the already-compiled modules, but from outside if I try to compile then its a no-go.

The module is just a simple hello world one.

---- hello.c -------------

Code:
#include <linux/init.h>
#include <linux/module.h>

MODULE_LICENSE("GPL");

static int hello_init()
{
	printk("Hello, world!\n");
	
	return 0;
}

static void hello_exit()
{
	printk("Bye!\n");
}

module_init(hello_init);
module_exit(hello_exit);
---- Makefile -------------

Code:
#include includes.make

KERNELDIR ?= /tmp/linux-2.6.10
PWD=$(shell pwd)

#obj-m:= hello.o

default:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
---- KBuild -------------

Code:
obj-m:= hello.o
And yes my 2.6.10 kernel is in my tmp directory.

I just can't see what I have done wrong.
Its asif the MAKE program or something just can't see that I'm usng the UM Architecture and that it should look in those directories to find it.

Any help would REALLY be appreciated!

Thanks
 
Old 04-13-2006, 06:26 AM   #2
Last Attacker
Member
 
Registered: Jun 2004
Location: South Africa
Distribution: Ubuntu
Posts: 120

Original Poster
Rep: Reputation: 15
Thanks to the guys on neutron.oftc.net's IRC chat channel #kernelnewbies, we got the solution.
Its embarresing but in my case all I had to do was add the "ARCH=um" at the end of the $(MAKE) line in the Makefile.
 
  


Reply

Tags
compile, kernel, module, uml


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel panic while running user mode linux nlatha Linux - Software 3 03-24-2006 11:51 PM
Interface between user mode and kernel mode santosh_pn Linux - Software 1 06-17-2005 07:20 AM
Compiling kernel module for linux kernel 2.4 in 2.6 guam Linux - Software 0 01-13-2005 02:02 AM
UML--->compiling user mode linux in kernel 2.6 waqasgujjar Red Hat 0 12-18-2004 03:20 PM
Error compiling Module in Linux kernel iannou Linux - Software 1 06-27-2003 07:06 PM


All times are GMT -5. The time now is 12:44 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration