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. :redface: 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... :banghead: 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. |
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") |
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. |
Quote:
I did not think the Korean error Fatal error: asm/bitsperlong.h: ]no such file or dirctory |
Doing things in /usr/src/ is not wise, because you have to be root. Better to use /home.
The error seems to occur because Quote:
|
Quote:
A long period of time, no one was discouraged did not leave a reply. Let's now 1:00 AM. If the day is bright, I'm gonna try to go to school. I did not think to use a different directory. /usr/src -> /home I want to quickly go to the school to try to run. Run, and once again, I will leave a reply. Thank You!! |
Okay, and what does
Code:
locate bitsperlong.h (if you don't have 'locate', try Code:
find / -name bitsperlong.h |
All times are GMT -5. The time now is 02:06 AM. |