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]
Code:
#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]
Code:
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.
terminal Message
Code:
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