Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 04-12-2006, 03:57 PM   #1
Last Attacker
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:

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 -------------

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


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

static void hello_exit()

---- Makefile -------------

#include includes.make

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

#obj-m:= hello.o

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

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!

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

Original Poster
Rep: Reputation: 15
Thanks to the guys on'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.


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-25-2006 12:51 AM
Interface between user mode and kernel mode santosh_pn Linux - Software 1 06-17-2005 08:20 AM
Compiling kernel module for linux kernel 2.4 in 2.6 guam Linux - Software 0 01-13-2005 03:02 AM
UML--->compiling user mode linux in kernel 2.6 waqasgujjar Red Hat 0 12-18-2004 04:20 PM
Error compiling Module in Linux kernel iannou Linux - Software 1 06-27-2003 08:06 PM > Forums > Non-*NIX Forums > Programming

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

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