Re: Building separate files for a kernel module
AFAIK if foo is GPL, you can't link bar to it except if it's GPL to. Doing so would be license breaking. If foo is not GPL, you are tainting your kernel and would be hard to get help with a tainted kernel. 2018-04-09 14:19 GMT-03:00 Martin Galvan : > 2018-04-05 12:02 GMT-03:00 Greg KH : > > On Thu, Apr 05, 2018 at 11:49:36AM -0300, Martin Galvan wrote: > >> I want my module to be DKMS-enabled, but since the 'bar' binaries > >> don't use anything Linux-specific I don't want to distribute the > >> sources for it. > > > > Hahaha, good luck, please discuss this with a lawyer as to the > > legalities involved. You are on your own here. > > You're right, and I apologize if this practice is frowned upon. I just > assumed it wasn't since the kbuild docs mention ways for having binary > blobs included with kernel modules. > > Thanks for the answer. > > ___ > Kernelnewbies mailing list > Kernelnewbies@kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > -- “If you're going to try, go all the way. Otherwise, don't even start. ..." Charles Bukowski ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Building separate files for a kernel module
except if it's GPL too* 2018-04-18 12:57 GMT-03:00 Daniel. : > AFAIK if foo is GPL, you can't link bar to it except if it's GPL to. Doing > so would be license breaking. If foo is not GPL, you are tainting your > kernel and would be hard to get help with a tainted kernel. > > 2018-04-09 14:19 GMT-03:00 Martin Galvan : > >> 2018-04-05 12:02 GMT-03:00 Greg KH : >> > On Thu, Apr 05, 2018 at 11:49:36AM -0300, Martin Galvan wrote: >> >> I want my module to be DKMS-enabled, but since the 'bar' binaries >> >> don't use anything Linux-specific I don't want to distribute the >> >> sources for it. >> > >> > Hahaha, good luck, please discuss this with a lawyer as to the >> > legalities involved. You are on your own here. >> >> You're right, and I apologize if this practice is frowned upon. I just >> assumed it wasn't since the kbuild docs mention ways for having binary >> blobs included with kernel modules. >> >> Thanks for the answer. >> >> ___ >> Kernelnewbies mailing list >> Kernelnewbies@kernelnewbies.org >> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >> > > > > -- > “If you're going to try, go all the way. Otherwise, don't even start. ..." > Charles Bukowski > -- “If you're going to try, go all the way. Otherwise, don't even start. ..." Charles Bukowski ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Building separate files for a kernel module
2018-04-05 12:02 GMT-03:00 Greg KH : > On Thu, Apr 05, 2018 at 11:49:36AM -0300, Martin Galvan wrote: >> I want my module to be DKMS-enabled, but since the 'bar' binaries >> don't use anything Linux-specific I don't want to distribute the >> sources for it. > > Hahaha, good luck, please discuss this with a lawyer as to the > legalities involved. You are on your own here. You're right, and I apologize if this practice is frowned upon. I just assumed it wasn't since the kbuild docs mention ways for having binary blobs included with kernel modules. Thanks for the answer. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Building separate files for a kernel module
On Thu, Apr 05, 2018 at 11:49:36AM -0300, Martin Galvan wrote: > 2018-04-05 2:26 GMT-03:00 : > > On Wed, 04 Apr 2018 18:29:21 -0300, Martin Galvan said: > > > >> PS: Yes, I'm aware I could just add $(bar-objs) to mydriver-y and > >> avoid building bar.a, but I really need to have those files as a > >> separate library. > > > > What's driving the requirement for a separate library? > > I want my module to be DKMS-enabled, but since the 'bar' binaries > don't use anything Linux-specific I don't want to distribute the > sources for it. Hahaha, good luck, please discuss this with a lawyer as to the legalities involved. You are on your own here. greg k-h ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Building separate files for a kernel module
2018-04-05 2:26 GMT-03:00 : > On Wed, 04 Apr 2018 18:29:21 -0300, Martin Galvan said: > >> PS: Yes, I'm aware I could just add $(bar-objs) to mydriver-y and >> avoid building bar.a, but I really need to have those files as a >> separate library. > > What's driving the requirement for a separate library? I want my module to be DKMS-enabled, but since the 'bar' binaries don't use anything Linux-specific I don't want to distribute the sources for it. It's similar to the "_shipped" binary blobs the documentation mentions, except in this case I want to use the kbuild machinery to build it. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Building separate files for a kernel module
On Wed, 04 Apr 2018 18:29:21 -0300, Martin Galvan said: > PS: Yes, I'm aware I could just add $(bar-objs) to mydriver-y and > avoid building bar.a, but I really need to have those files as a > separate library. What's driving the requirement for a separate library? ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Building separate files for a kernel module
Hi all, I'm trying to build a kernel module by statically linking object files with a library. My source tree looks like this: source/ ├── bar/ | ├── bar1.c | └── bar2.c └── foo.c The relevant parts of my Makefile look like this: mydriver-y := foo.o bar.a obj-m += mydriver.o bar-objs := bar/bar1.o bar/bar2.o # This builds foo.o mydriver: $(MAKE) -C $(kernel-src-dir) M=$(CURDIR) modules $(bar-objs): %.o: %.c $(MAKE) -C $(kernel-src-dir) M=$(CURDIR) $@ bar.a: $(bar-objs) ar rcs $@ $^ Here, the rule for $(bar-objs) should use the kbuild machinery to build bar1.o and bar2.o, as stated in Documentation/kbuld/modules.txt: --- 2.4 Building Separate Files It is possible to build single files that are part of a module. This works equally well for the kernel, a module, and even for external modules. Example (The module foo.ko, consist of bar.o and baz.o): make -C $KDIR M=$PWD bar.lst make -C $KDIR M=$PWD baz.o make -C $KDIR M=$PWD foo.ko make -C $KDIR M=$PWD / However, when I try to build bar.a, I get the following: make -C /lib/modules/$(uname -r)/build M=/home/martin/source/bar/bar1.o make[1]: Entering directory '/usr/src/linux-headers-4.13.0-38-generic' scripts/Makefile.build:44: /home/martin/source/bar/Makefile: No such file or directory make[2]: *** No rule to make target '/home/martin/source/bar/Makefile'. Stop. It's like kbuild expects me to have a Makefile on the 'bar' subdir as well. Am I doing something wrong? PS: Yes, I'm aware I could just add $(bar-objs) to mydriver-y and avoid building bar.a, but I really need to have those files as a separate library. Building them with a separate Makefile (i.e. without the kbuild machinery) isn't desirable either because I want to use the full array of flags and such that kbuild adds when invoking gcc. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies