.modinfo

In this section, we have to put certain information about the module of ours, such as license, dependencies, as well as the version of the kernel and supported options:

section '.modinfo'
; It is possible to specify another license here,
; however, some kernel symbols would not be
; available for license other than GPL
db 'license=GPL', 0

; Our LKM has no dependencies, therefore, we leave
; this blank
db 'depends=', 0

; Version of the kernel and supported options
db 'vermagic=3.16.0-4-amd64 SMP mod_unload modversions ', 0

If you are unsure about what to specify as vermagic, you may run the modinfo command on any of the modules found in the /lib/modules/`uname -r`/ directory. For example, I run the following command on my system:

/sbin/modinfo /lib/modules/`uname -r`/kernel/arch/x86/crypto/aesni-intel.ko

The output will be as shown in the following screenshot:

Once you have this information, you may simply copy the vermagic string and paste it into your code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset