Active Topics

 


Reply
Thread Tools
Posts: 58 | Thanked: 8 times | Joined on Aug 2010
#1
Hi,

I want to test a 'hello' module program (see below) in N900. I make it work in Ubuntu X86. But when I do the same thing in scratchbox
(sbox-FREMANTLE_ARMEL), the compilation result seems wrong.


I run command:
[sbox-FREMANTLE_ARMEL: ~/MyDocs/LinuxDriver] > fakeroot make -C ../linux-headers-2.6.32-23-generic/ M=$(pwd) modules


But the result:
make: Entering directory `/home/maemo/MyDocs/linux-headers-2.6.32-23-generic'
make: *** No rule to make target `modules'. Stop.
make: Leaving directory `/home/maemo/MyDocs/linux-headers-2.6.32-23-generic'


Note:
(1) I copy all the header files to the directory '/home/maemo/MyDocs/linux-headers-2.6.32-23-generic' already.

(2) I put 'hello.c' and 'Makefile' below into scratchbox directory '~/MyDocs/LinuxDriver'


Can anyone tell me what's wrong with it?
Thanks!




hello.c
==========================================
#ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif

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


MODULE_LICENSE("GPL");

int text_init(void){
printk("<0>Hello World!");
return 0;
}

void text_cleanup(void){
printk("<0>Goodbye World!");
}

module_init(text_init);
module_exit(text_cleanup);
==========================================


Makefile
==========================================
obj-m := hello.o
==========================================

Last edited by justforfun; 2010-08-29 at 15:13.
 
MohammadAG's Avatar
Posts: 2,473 | Thanked: 12,265 times | Joined on Oct 2009 @ Jerusalem, PS/IL
#2
apt-get install kernel-headers then make -C /usr/src/kernel-headers M=$(pwd) modules
 

The Following 2 Users Say Thank You to MohammadAG For This Useful Post:
Posts: 58 | Thanked: 8 times | Joined on Aug 2010
#3
Originally Posted by MohammadAG View Post
apt-get install kernel-headers then make -C /usr/src/kernel-headers M=$(pwd) modules
I compiled the code according to your hint and the module works normally on my N900 now. Thank you for your help!
 
Reply


 
Forum Jump


All times are GMT. The time now is 08:40.