Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to export header files to a kernel module from source code of a kernel or other means to get a structure object #100

Open
ArmanAirapetov opened this issue Jun 11, 2024 · 2 comments

Comments

@ArmanAirapetov
Copy link

ArmanAirapetov commented Jun 11, 2024

Hello. My module requires some structure to function, for example, the timer_list structure of the linux/timer.h . How can I import it in my project?
Detail information about subject

I have added linux source to KernelPatch/kernel/. I have changed the Makefile.
Before:

INCLUDE_DIRS := . include patch/include linux/include linux/arch/arm64/include linux/tools/arch/arm64/include

After:

INCLUDE_DIRS := . include patch/include linux-4.14.156/include linux-4.14.156/arch/arm64/include linux-4.14.156/tools/arch/arm64/include

I got this error message:

make 
/home/user/Downloads/aarch64-none-elf-gcc-xpack-13.2.1-1.1/xpacks/.bin/aarch64-none-elf-gcc  -I../../kernel/. -I../../kernel/include -I../../kernel/patch/include -I../../kernel/linux-4.14.156/include -I../../kernel/linux-4.14.156/arch/arm64/include -I../../kernel/linux-4.14.156/tools/arch/arm64/include -c -O2 -o secure.o secure.c
In file included from secure.c:4:
../../kernel/linux-4.14.156/include/uapi/asm-generic/unistd.h:2:10: fatal error: asm/bitsperlong.h: No such file or directory
    2 | #include <asm/bitsperlong.h>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:26: secure.o] Error 1
@ArmanAirapetov
Copy link
Author

I replaced the INCLUDE_DIRS again:

INCLUDE_DIRS := . include patch/include linux-4.14.156/include linux-4.14.156/arch/arm64/include linux-4.14.156/tools/arch/arm64/include linux-4.14.156/include/uapi linux-4.14.156/arch/arm64/include/uapi linux-4.14.156/arch/arm64/include/generated/uapi linux-4.14.156/arch/arm64/include/generated

I get this error log when executing make
err.log

@xiaotujinbnb
Copy link

I want to know too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants