makefile - Compile linux kernel (2.6) module including non kernel headers -


Is it possible to compile a Linux kernel (2.6) module that includes non-kernel-defined functionality?

For example:


kernelmodule.h

#include & lt; Linux / init.h & gt; #include & lt; Linux / module.h & gt; #include & lt; Linux / kernel.h & gt; // printk () // ... # include & lt; Openssl / sha.h & gt; // ...

makefile

  obj-m: = kernelmodule.o all: $ (make) -c / lib / module /`Uname -r` / BuildM = 'pwd` Module Clean: $ (Make) -C / Lib / Module / `one-R` / Build M =` PWD' Clean $ (Rm) Module. Markers Module Order  

The kernel module I have written and are trying to compile are found in many types of openssl files.

The standard presented in the makefile is not included in the Linux header, it is possible to include this functionality, and if so, please tell me in the right direction.

Thanks, Mike

Kernel can not use the userspace code and Should stand alone (i.e. completely self contained, no library), so it does not raise standard headers.

It is not clear what is the use of taking userspace titles? If there are some things that are legitimate to use it (constants, some macros may have been provided that they do not call any userspace function), it might be better to duplicate them and only kernel-compatible parts Can be included.

It is not possible to link the kernel to libraries designed for use by userspace - even if they do not call any OS - because the linking environment in the kernel can not lift them.

Instead, recompile any work that is used in the kernel (assuming they do not make any OS or library calls - such as malloc - in that case they still Will need to be modified). To use them in your kernel module, include them in your library.


Recent versions of Linux contain cryptographic functions, which include various SHA hash - maybe you can use one of them instead.


Another idea would be to stop trying to create crypto in kernel-space and take the code to userspace. It is easy to keep userspace code easy / debug / etc.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -