How to link some .o files in kernel?
Hi friends,I have a question.It has been bothering me for a while.Here is details:
I'm adding some ebpf helpers into the kernel.My kernel version is 5.15.153 I modify /kernel/bpf/helpers.c like that: … #include "../../security/dir/header.h" … BPF_CALL1(func1,argType,argName){ func2(argName); return 0; } … The function "func2" is in another .c file.That file can't be compiled with kernel because it uses some standard lib such as stdio,stdlib.So I compile it in gcc and get the .o file.I think maybe that .o file can be linked with "helpers.o".But I don't get any idea after I check the Makefile of the kernel and not find any information for this question. Actually I find two similar question in stackoverflow and here: https://stackoverflow.com/questions/...-kernel-binary https://www.linuxquestions.org/quest...kbuild-694396/ But I don't think these can resolve my question. I want to ask that is it possible to link a .o file with kernel?I think that I need to modify the Makefile in somewhere. |
|
I do not have your OS here.
I don't have your code here. Hence I tried simulating your sample code at bash.exe/gcc.exe using CYGWIN_NT at windows. cat CommonMakefile Code:
all: Code:
BUILD = ERP Code:
#include "header.h" Code:
#include <stdio.h> Code:
$ file ../../security/dir/header.h Code:
$ /usr/bin/make.exe |
I am feeling much happy after writing above comment :)
enjoy maadi => enjoy => at kannadaa nanukku kannada solpha solpha barathu => I knew only few words at kannada(Karnataka Kannada language) even though I am staying there from 2004 to till now. |
All times are GMT -5. The time now is 11:31 PM. |