Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the license for modules in the linux kernel

I've written some kernel modules in Ada, and I've hit a bit of a problem. License is defined as a c macro, and I can't work out what it actually is. Is it a suitable solution to simply have some c re-exporting all the c functions which require GPL if both the c and the ada module have GPL compatible licenses? Is there a better way to do this?

like image 265
Probie Avatar asked Aug 13 '12 02:08

Probie


People also ask

How is the Linux kernel licensed?

The Linux kernel is licensed under the GPLv2. The headers that it exports to user space, however, are not covered by the license. This is documented in the kernel's licensing rules: The User-space API (UAPI) header files, which describe the interface of user-space programs to the kernel are a special case.

What is Linux kernel licensing model?

The Linux Kernel is provided under the terms of the GNU General Public License version 2 only (GPL-2.0), as provided in LICENSES/preferred/GPL-2.0, with an explicit syscall exception described in LICENSES/exceptions/Linux-syscall-note, as described in the COPYING file.

What is a module license?

MODULE_LICENSE() is a macro which allows loadable kernel modules to declare their license to the world. Its purpose is to let the kernel developers know when a non-free module has been inserted into a given kernel.


1 Answers

Dealing with C macros is a royal PITA. I have a dream that one day C programmers will do the rest of the world a favor and quit using them.

If it were me, I'd run the macro to see what it outputs, then write some Ada code to output the equivalent.

From reading through Roland's answer, it looks to me like the implementation-defined pragma linker_section may be required.

pragma Linker_Section ( [Entity =>] LOCAL_NAME, [Section =>] static_string_EXPRESSION);

LOCAL_NAME must refer to an object that is declared at the library level. This pragma specifies the name of the linker section for the given entity. It is equivalent to __attribute__((section)) in GNU C and causes LOCAL_NAME to be placed in the static_string_EXPRESSION section of the executable (assuming the linker doesn't rename the section).

like image 116
T.E.D. Avatar answered Oct 05 '22 07:10

T.E.D.