Skip to content

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

@ArmanAirapetov

Description

@ArmanAirapetov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions