it seems like we can not use standard header files in kernel programming. Thanks for your help
Adding userspace header files to make file
-
06-08-2022 - |
سؤال
I am building a linux device using make and i need to use string.h in my device. I tried to add /usr/include to make file but it does not work. can any one help me on adding another include path to make file. my make file is
KBUILD_CFLAGS += -w
obj-m += netlinkKernel.o
all:
make -w -C /lib/modules/$(shell uname -r)/build CPPFLAGS="usr/include/" M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
المحلول 2
نصائح أخرى
That's because just usr/include/
isn't a proper compiler flag. You need to use e.g. -I/usr/include/
.
However, using libraries from userspace in a kernel driver might not work as you expect it to, like not at all. The kernel should have have it's own string library (including the "string.h"
header file) that you should use.
لا تنتمي إلى StackOverflow