LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 04-18-2013, 11:11 PM   #1
TeaYoung
LQ Newbie
 
Registered: Apr 2013
Posts: 7

Rep: Reputation: Disabled
Need help with cross-compiling self-written kernel modules


I do not speak English well.

I live in South Korea.

Courage was required to write the articles on this site.

I study device driver.

I made ​​a hello world module.

The link below is the result of the execution.

http://com.odroid.com/sigong/_Files/...1738298441.png

I want to cross-compile from the Host PC to the Target Borad.

The below source Hello.c and the Makefile

The red lettering is the part that is added to cross-compile.

[hello1.c]
#include <linux/module.h>
#include <linux/kernel.h>

static int debug_enable = 0;
module_param(debug_enable, int, 0);
MODULE_PARM_DESC(debug_enable, "Enable module debug mode.");

static int __init hello_init(void)
{
printk(KERN_ALERT "Hello Example Init - debug mode is %sn", debug_enable ? "enabled" : "disabled");
return 0;
}

static void __exit hello_exit(void)
{
printk(KERN_ALERT "Hello Example Exitn");
}

module_init(hello_init);
module_exit(hello_exit);

MODULE_AUTHOR("Chris Hallinan");
MODULE_DESCRIPTION("Hello world Example");
MODULE_LICENSE("GPL");

[Makefile]
obj-m := hello1.o

KDIR := /lib/modules/$(shell uname -r)/build

PWD := $(shell pwd)

CROSS=arm-linux-gnueabihf-
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) ARCH=arm CROSS_COMPILE=$(CROSS) modules

test:
echo $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
rm -rf *.mod.c *.ko *.o *.symvers *.order


It will make the following error
http://com.odroid.com/sigong/_Files/...1800123246.png

Going to the folder of / usr/src/linux-headers-3.5.0-27-generic/arch/arm/include/asm the file does not exist.

However, this crab / usr/src/linux-headers-3.5.0-27-generic/include/asm-generic folder, the file was!!!

I am so copy bitsperlong.h, and make this time was not errono.h.

bitsperlong.h.....errno.h.....rwsem.h.... timex.h...

How should be able to handle this problem?

Limited English proficiency, and my question has been passed, I do not know.

I do not know really was trying for two weeks.
 
Old 04-20-2013, 04:34 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,630
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Firstly: don't call your thread "Hello..... I need help". It gives us no information about what your problem is, and many people will not answer your thread. A better title is "Error compiling a 'hello world' device driver" (you can change it to that by clicking "Edit" on your post).

Secondly: if you're posting code, put [CODE][/CODE] tags around it, it makes it a lot easier for us to read.

I'm afraid I don't speak Korean - what does the error say? (after "fatal error: asm/bitsperlong.h")
 
Old 04-21-2013, 01:08 PM   #3
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,533

Rep: Reputation: 148Reputation: 148
Could you please run the make command in the following way:
sudo LC_ALL=C make

This will print the error message in English, it will be much easier for us to understand.

It seems that the file is missing. If so, please make sure that you have re-compiled the kernel on the machine you're using. Some files are generated during the build.
 
Old 04-21-2013, 11:54 PM   #4
TeaYoung
LQ Newbie
 
Registered: Apr 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Snark1994 View Post
Firstly: don't call your thread "Hello..... I need help". It gives us no information about what your problem is, and many people will not answer your thread. A better title is "Error compiling a 'hello world' device driver" (you can change it to that by clicking "Edit" on your post).

Secondly: if you're posting code, put [CODE][/CODE] tags around it, it makes it a lot easier for us to read.

I'm afraid I don't speak Korean - what does the error say? (after "fatal error: asm/bitsperlong.h")
Oh... Sorry for the late reply

I did not think the Korean error

Fatal error: asm/bitsperlong.h: ]no such file or dirctory
 
Old 04-23-2013, 05:09 PM   #5
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,630
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Okay, and what does

Code:
locate bitsperlong.h
print?

(if you don't have 'locate', try
Code:
find / -name bitsperlong.h
)
 
  


Reply


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
Beagleboard Kernel Module Cross Compiling dreamer2000 Programming 0 01-29-2012 01:12 PM
cross-compiling modules for a preemptive kernel(2.6.23) Trixy_Tree Linux - Embedded & Single-board computer 1 04-07-2009 10:47 AM
Compiling routing algo written for 2.4 kernel, with 2.6 kernel rvenkatesh25 Linux - Networking 1 08-28-2007 02:19 PM
Compiling a program written for 2.4 kernel, with 2.6 kernel rvenkatesh25 Programming 0 08-28-2007 09:31 AM


All times are GMT -5. The time now is 03:51 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