简体   繁体   中英

how to compile libraries for the Linux kernel?

I have a library of C code which has an abstraction layer and I wish to port to the Linux kernel.

Googling for "compiling library for Linux kernel" is useless, because all you find are hits for "compiling Linux kernel".

Does anyone have pointers to explanations/descriptions/etc on how to compile libraries for the kernel?

Is the question even correct? does the kernel have a notion of libraries?

What you want to learn is to create a kernel module . You have a choice of making the library a part of that module (there would be nothing Linux kernel specific about that), or build it as a separate module with exported symbols, allowing reuse.

For the vast majority of tasks I would recommend looking for a solution completely or mostly in userland (keeping the library and all code that uses it in a regular process) and run only the absolutely necessary code, if any remains, in the kernel.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM