Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


Closed Thread
  Search this Thread
Old 04-22-2013, 10:17 AM   #1
LQ Newbie
Registered: Apr 2013
Posts: 26

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.

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.

#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_AUTHOR("Chris Hallinan");
MODULE_DESCRIPTION("Hello world Example");
 obj-m := hello1.o

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

PWD := $(shell pwd)


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

It will make the following error

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.

terminal Message
kty@ubuntu:/study$ sudo make
make  -C /lib/modules/3.5.0-25-generic/build SUBDIRS=/study ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
make[1]: Entering directory `/usr/src/linux-headers-3.5.0-25-generic'
  CC [M]  /study/hello1.o
In file included from /usr/src/linux-headers-3.5.0-25-generic/arch/arm/include/asm/types.h:4:0,
                 from include/linux/types.h:4,
                 from include/linux/list.h:4,
                 from include/linux/module.h:9,
                 from /study/hello1.c:1:
include/asm-generic/int-ll64.h:11:29: fatal error: asm/bitsperlong.h: No such file or directory
compilation terminated.
make[2]: *** [/study/hello1.o] error 1
make[1]: *** [_module_/study] error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-25-generic'
make: *** [default] error 2

Closed Thread

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
Need help with cross-compiling self-written kernel modules TeaYoung Linux - Kernel 6 04-23-2013 06:09 PM
cross-compiling modules for a preemptive kernel(2.6.23) Trixy_Tree Linux - Embedded & Single-board computer 1 04-07-2009 11:47 AM
Compiling routing algo written for 2.4 kernel, with 2.6 kernel rvenkatesh25 Linux - Networking 1 08-28-2007 03:19 PM
Compiling a program written for 2.4 kernel, with 2.6 kernel rvenkatesh25 Programming 0 08-28-2007 10:31 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:04 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
Open Source Consulting | Domain Registration