I'm new to kernel compilation and am trying to cross-compile a userspace program for an existing kernel driver for an ARM board. Basically, I'm trying to access the ioctl facilities of the driver.
I'm using arm-linux-gnueabihf-gcc (4.9.2).
I can compile the kernel successfully. The userspace code looks like following
getefuse.c
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/amlogic/efuse.h> //The driver's header file
....
When I try to compile the userspace code, I get entangled in a mesh of 'include' file issues. The kernel source code resides at /home/cheema/boards/linux/
$ arm-linux-gnueabihf-gcc -I/home/cheema/boards/linux/include getefuse.c
In file included from getefuse.c:7:0:
/home/cheema/boards/linux/include/linux/amlogic/efuse.h:5:24: fatal error: mach/efuse.h: No such file or directory
#include <mach/efuse.h>
^
compilation terminated.
I try to add the missing 'include' file path. But every time I add another file path, the compiler gives the No such file or directory error for a different file.
I believe I have to use kernel's config files(Makefile??) to get out of this mess, but don't know how.
-Ithat I add, the error shifts somewhere else. For ex:$ arm-linux-gnueabihf-gcc -I/home/cheema/boards/linux/include -I../../../arch/arm/mach-meson8/include getefuse.c .... .... from /home/cheema/boards/linux/include/linux/amlogic/efuse.h:75, from getefuse.c:7: /home/cheema/boards/linux/include/linux/atomic.h:4:24: fatal error: asm/atomic.h: No such file or directory #include <asm/atomic.h> ^ compilation terminated.- Neomach/efuse.hexists. So only the kernel config can identify and pick the correctmach/efuse.h. - Neoamlogicyour board ? - srd