* [Buildroot] Cross compiling kernel module for the target
@ 2018-12-20 7:39 Łukasz Przeniosło
2018-12-20 8:04 ` Thomas Petazzoni
0 siblings, 1 reply; 10+ messages in thread
From: Łukasz Przeniosło @ 2018-12-20 7:39 UTC (permalink / raw)
To: buildroot
Hello there,
I am using Buildroot to compile the kernel for my ARM target, which is a
Beaglebone black. This part works. Now I would like to use the
crosscompiler available from the output of the buildroot in order to
compile a "Hello World" Kernel module. I have already checked a regular c
file Hello World and it crosscompiles on host and runs on the target
correctly. I am having problems with setting up the whole environment for
the kernel module development. There are many tutorials available for
kernel modules development, but they assume developing on the target/ host.
I am able to compile a native host x86 kernel module, that works.
I am still missing some dependencies when trying to crosscompile for the
Beagle, I am not sure either I need to build some further packages, but
when doing xconfig I think I checked everything related to the kernel
modules. At the moment I have the following Makefile:
obj-m := simp.o
KERNELDIR ?= /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92
PWD := $(shell pwd)
all: default
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
And the example module code (simp.c):
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
When trying to make:
make ARCH=arm CROSS_COMPILE=arm-buildroot-linux-uclibcgnueabihf-
-I/home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92/include
-I/home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92
-I/home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92/include/generated/autoconf.h
I get the following error:
make -C /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92
M=/tmp/test modules
make[1]: Entering directory
'/home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92'
WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /tmp/test/simp.o
In file included from <command-line>:0:0:
././include/linux/kconfig.h:4:32: fatal error: generated/autoconf.h:
No such file or directory
#include <generated/autoconf.h>
^
compilation terminated.
scripts/Makefile.build:299: recipe for target '/tmp/test/simp.o' failed
make[2]: *** [/tmp/test/simp.o] Error 1
Makefile:1493: recipe for target '_module_/tmp/test' failed
make[1]: *** [_module_/tmp/test] Error 2
make[1]: Leaving directory
'/home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92'
Makefile:8: recipe for target 'default' failed
make: *** [default] Error 2
Which I dont understand, since included the .h file specifically. I would
appreciate all help regarding this. I was trying to find anyone else doing
something similar (trying to cross compile a kernel module on the host
using buildroot build tools), but was unable to. Most of the cases are
already to advanced or dont apply to my problem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181220/338d77b1/attachment.html>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] Cross compiling kernel module for the target
2018-12-20 7:39 [Buildroot] Cross compiling kernel module for the target Łukasz Przeniosło
@ 2018-12-20 8:04 ` Thomas Petazzoni
[not found] ` <CA+OsCCQ2TWYiEv-a8uRaJVSd4YX9A4T_EV1ihC1Y2ZyrNPAkag@mail.gmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2018-12-20 8:04 UTC (permalink / raw)
To: buildroot
Hello,
On Thu, 20 Dec 2018 08:39:26 +0100, ?ukasz Przenios?o wrote:
> obj-m := simp.o
> KERNELDIR ?= /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92
This should point to output/build/linux-<version>/ and not
output/build/linux-headers-<version>/.
> CC [M] /tmp/test/simp.o
> In file included from <command-line>:0:0:
> ././include/linux/kconfig.h:4:32: fatal error: generated/autoconf.h:
> No such file or directory
> #include <generated/autoconf.h>
As explained above, this is because you're using the linux-headers
source, which is not "configured" (i.e no kernel configuration has been
applied to it), and building a kernel module requires a configured
source tree.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] Cross compiling kernel module for the target
[not found] ` <CA+OsCCQ2TWYiEv-a8uRaJVSd4YX9A4T_EV1ihC1Y2ZyrNPAkag@mail.gmail.com>
@ 2018-12-20 9:07 ` Thomas Petazzoni
2018-12-20 9:14 ` Łukasz Przeniosło
0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2018-12-20 9:07 UTC (permalink / raw)
To: buildroot
Hello,
Please keep the mailing list in Cc when replying. Thanks!
On Thu, 20 Dec 2018 09:55:41 +0100, ?ukasz Przenios?o wrote:
> Hello Thomas, thank you for answer.
> Yes, I know it should point to the build dir, but the problem is, I dont
> have that directory and I dont know how to "place" is there. On my host I
> have seen that this build dir is a soft link to the linux headers folder,
> thus, thought this is the way around it. Could you please give me a hint on
> what I am missing in the buildroot config maybe?
Are you building a Linux kernel image as part of your Buildroot
configuration ?
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] Cross compiling kernel module for the target
2018-12-20 9:07 ` Thomas Petazzoni
@ 2018-12-20 9:14 ` Łukasz Przeniosło
2018-12-20 9:20 ` Thomas Petazzoni
0 siblings, 1 reply; 10+ messages in thread
From: Łukasz Przeniosło @ 2018-12-20 9:14 UTC (permalink / raw)
To: buildroot
Thomas, sorry for the Cc, its there now.
No, my module is supposed to be a completely separate thing for now. I
intend to build it using cross compilation tools provided by build root
after the image is loaded to the target. I want to load the module using
insmod. Then after the module is stable, I could add it to the buildroot
config.
czw., 20 gru 2018 o 10:07 Thomas Petazzoni <thomas.petazzoni@bootlin.com>
napisa?(a):
> Hello,
>
> Please keep the mailing list in Cc when replying. Thanks!
>
> On Thu, 20 Dec 2018 09:55:41 +0100, ?ukasz Przenios?o wrote:
> > Hello Thomas, thank you for answer.
> > Yes, I know it should point to the build dir, but the problem is, I dont
> > have that directory and I dont know how to "place" is there. On my host I
> > have seen that this build dir is a soft link to the linux headers folder,
> > thus, thought this is the way around it. Could you please give me a hint
> on
> > what I am missing in the buildroot config maybe?
>
> Are you building a Linux kernel image as part of your Buildroot
> configuration ?
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181220/bb43b13f/attachment.html>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] Cross compiling kernel module for the target
2018-12-20 9:14 ` Łukasz Przeniosło
@ 2018-12-20 9:20 ` Thomas Petazzoni
2018-12-20 9:34 ` Łukasz Przeniosło
0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2018-12-20 9:20 UTC (permalink / raw)
To: buildroot
Hello,
On Thu, 20 Dec 2018 10:14:41 +0100, ?ukasz Przenios?o wrote:
> Thomas, sorry for the Cc, its there now.
> No, my module is supposed to be a completely separate thing for now. I
> intend to build it using cross compilation tools provided by build root
> after the image is loaded to the target. I want to load the module using
> insmod. Then after the module is stable, I could add it to the buildroot
> config.
You cannot build a kernel module out of nowhere, it has to be compiled
against a kernel source tree with configuration, or a kernel headers
tree with configuration. In the context of Buildroot, only the former
exists, so if you don't build your Linux kernel with Buildroot, you
cannot build a kernel module with Buildroot.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] Cross compiling kernel module for the target
2018-12-20 9:20 ` Thomas Petazzoni
@ 2018-12-20 9:34 ` Łukasz Przeniosło
2018-12-20 13:04 ` Thomas Petazzoni
0 siblings, 1 reply; 10+ messages in thread
From: Łukasz Przeniosło @ 2018-12-20 9:34 UTC (permalink / raw)
To: buildroot
Thomas, I do build my kernel using buildroot- it gives me the cross
compiling tools. My problem is, that I think that the buildroot doesnt
provide the sources for me in the output.
czw., 20 gru 2018 o 10:21 Thomas Petazzoni <thomas.petazzoni@bootlin.com>
napisa?(a):
> Hello,
>
> On Thu, 20 Dec 2018 10:14:41 +0100, ?ukasz Przenios?o wrote:
> > Thomas, sorry for the Cc, its there now.
> > No, my module is supposed to be a completely separate thing for now. I
> > intend to build it using cross compilation tools provided by build root
> > after the image is loaded to the target. I want to load the module using
> > insmod. Then after the module is stable, I could add it to the buildroot
> > config.
>
> You cannot build a kernel module out of nowhere, it has to be compiled
> against a kernel source tree with configuration, or a kernel headers
> tree with configuration. In the context of Buildroot, only the former
> exists, so if you don't build your Linux kernel with Buildroot, you
> cannot build a kernel module with Buildroot.
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181220/e788ab16/attachment-0001.html>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] Cross compiling kernel module for the target
2018-12-20 9:34 ` Łukasz Przeniosło
@ 2018-12-20 13:04 ` Thomas Petazzoni
2018-12-20 20:49 ` Łukasz Przeniosło
0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2018-12-20 13:04 UTC (permalink / raw)
To: buildroot
Hello,
On Thu, 20 Dec 2018 10:34:42 +0100, ?ukasz Przenios?o wrote:
> Thomas, I do build my kernel using buildroot- it gives me the cross
> compiling tools. My problem is, that I think that the buildroot doesnt
> provide the sources for me in the output.
I'm sorry, but I don't really understand what you're saying.
If you are building the Linux kernel with Buildroot, so you definitely
have a directory called output/build/linux-<version>/ which contains
the kernel source code, the kernel configuration (.config file) and
all the object files/images that result from a kernel build.
If you don't have this folder, then you are definitely not building the
Linux kernel with Buildroot.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] Cross compiling kernel module for the target
2018-12-20 13:04 ` Thomas Petazzoni
@ 2018-12-20 20:49 ` Łukasz Przeniosło
2018-12-20 21:04 ` Łukasz Przeniosło
0 siblings, 1 reply; 10+ messages in thread
From: Łukasz Przeniosło @ 2018-12-20 20:49 UTC (permalink / raw)
To: buildroot
Thomas, I am building the Kernel with buildroot. Did you mean this
directory?
lukasz at lukasz-vb:~/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92$
ls -l
total 114892
drwxr-xr-x 33 lukasz lukasz 4096 pa? 5 11:52 arch
drwxr-xr-x 3 lukasz lukasz 4096 pa? 5 11:56 block
drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 certs
-rw-r--r-- 1 lukasz lukasz 18693 gru 22 2017 COPYING
-rw-r--r-- 1 lukasz lukasz 98277 gru 22 2017 CREDITS
drwxr-xr-x 4 lukasz lukasz 20480 pa? 5 11:57 crypto
drwxr-xr-x 119 lukasz lukasz 12288 pa? 5 11:52 Documentation
drwxr-xr-x 130 lukasz lukasz 4096 pa? 5 11:57 drivers
drwxr-xr-x 36 lukasz lukasz 4096 pa? 5 11:56 firmware
drwxr-xr-x 75 lukasz lukasz 12288 pa? 5 11:56 fs
drwxr-xr-x 30 lukasz lukasz 4096 pa? 5 11:52 include
drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 init
drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 ipc
-rw-r--r-- 1 lukasz lukasz 2888 gru 22 2017 Kbuild
-rw-r--r-- 1 lukasz lukasz 252 gru 22 2017 Kconfig
drwxr-xr-x 16 lukasz lukasz 16384 pa? 5 11:56 kernel
drwxr-xr-x 12 lukasz lukasz 28672 pa? 5 11:56 lib
-rw-r--r-- 1 lukasz lukasz 384216 gru 22 2017 MAINTAINERS
-rw-r--r-- 1 lukasz lukasz 59246 gru 22 2017 Makefile
drwxr-xr-x 3 lukasz lukasz 12288 pa? 5 11:56 mm
-rw-r--r-- 1 lukasz lukasz 7056 pa? 5 11:56 modules.builtin
-rw-r--r-- 1 lukasz lukasz 17409 pa? 5 11:57 modules.order
-rw-r--r-- 1 lukasz lukasz 549487 pa? 5 11:57 Module.symvers
drwxr-xr-x 65 lukasz lukasz 4096 pa? 5 11:56 net
-rw-r--r-- 1 lukasz lukasz 18372 gru 22 2017 README
-rw-r--r-- 1 lukasz lukasz 7490 gru 22 2017 REPORTING-BUGS
drwxr-xr-x 25 lukasz lukasz 4096 pa? 5 11:52 samples
drwxr-xr-x 14 lukasz lukasz 4096 pa? 5 11:56 scripts
drwxr-xr-x 10 lukasz lukasz 4096 pa? 5 11:56 security
drwxr-xr-x 23 lukasz lukasz 4096 pa? 5 11:57 sound
-rw-r--r-- 1 lukasz lukasz 2571239 pa? 5 11:56 System.map
drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:52 ti_config_fragments
drwxr-xr-x 30 lukasz lukasz 4096 pa? 5 11:52 tools
drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 usr
drwxr-xr-x 4 lukasz lukasz 4096 pa? 5 11:56 virt
-rwxr-xr-x 1 lukasz lukasz 51072304 pa? 5 11:56 vmlinux
-rw-r--r-- 1 lukasz lukasz 62819472 pa? 5 11:55 vmlinux.o
I tried providing it as KERNELDIR, but yielded errors as well.
czw., 20 gru 2018 o 14:04 Thomas Petazzoni <thomas.petazzoni@bootlin.com>
napisa?(a):
> Hello,
>
> On Thu, 20 Dec 2018 10:34:42 +0100, ?ukasz Przenios?o wrote:
>
> > Thomas, I do build my kernel using buildroot- it gives me the cross
> > compiling tools. My problem is, that I think that the buildroot doesnt
> > provide the sources for me in the output.
>
> I'm sorry, but I don't really understand what you're saying.
>
> If you are building the Linux kernel with Buildroot, so you definitely
> have a directory called output/build/linux-<version>/ which contains
> the kernel source code, the kernel configuration (.config file) and
> all the object files/images that result from a kernel build.
>
> If you don't have this folder, then you are definitely not building the
> Linux kernel with Buildroot.
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181220/df908c41/attachment.html>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] Cross compiling kernel module for the target
2018-12-20 20:49 ` Łukasz Przeniosło
@ 2018-12-20 21:04 ` Łukasz Przeniosło
2018-12-21 7:14 ` Łukasz Przeniosło
0 siblings, 1 reply; 10+ messages in thread
From: Łukasz Przeniosło @ 2018-12-20 21:04 UTC (permalink / raw)
To: buildroot
Thomas, hold on... It has just built... Replaced the KERNELDIR that was set
to the headers dir with the sources dir listed above. Now the makefile
looks like this:
obj-m := simp.o
KERNELDIR ?=
/home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92
PWD := $(shell pwd)
all: default
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
And the make output:
lukasz at lukasz-vb:/tmp/test$ make ARCH=arm
CROSS_COMPILE=arm-buildroot-linux-uclibcgnueabihf-
make -C
/home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92
M=/tmp/test modules
make[1]: Entering directory
'/home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92'
CC [M] /tmp/test/simp.o
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/test/simp.mod.o
LD [M] /tmp/test/simp.ko
make[1]: Leaving directory
'/home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92'
lukasz at lukasz-vb:/tmp/test$
lukasz at lukasz-vb:/tmp/test$
lukasz at lukasz-vb:/tmp/test$ ls -l
total 64
-rw-rw-r-- 1 lukasz lukasz 284 gru 20 21:59 Makefile
-rw-rw-r-- 1 lukasz lukasz 25 gru 20 22:02 modules.order
-rw-rw-r-- 1 lukasz lukasz 0 gru 20 22:02 Module.symvers
-rw-rw-r-- 1 lukasz lukasz 297 gru 20 21:54 simp.c
-rw-rw-r-- 1 lukasz lukasz 12220 gru 20 22:02 simp.ko
-rw-rw-r-- 1 lukasz lukasz 839 gru 20 22:02 simp.mod.c
-rw-rw-r-- 1 lukasz lukasz 18340 gru 20 22:02 simp.mod.dwo
-rw-rw-r-- 1 lukasz lukasz 7608 gru 20 22:02 simp.mod.o
-rw-rw-r-- 1 lukasz lukasz 6120 gru 20 22:02 simp.o
But I dont have the target with me, so cannot test the module. But it
compiles! Thank you very much for help Thomas. I could swear I tried this
setup before, cant tell now what I have missed.
czw., 20 gru 2018 o 21:49 ?ukasz Przenios?o <bremenpl@gmail.com> napisa?(a):
> Thomas, I am building the Kernel with buildroot. Did you mean this
> directory?
>
> lukasz at lukasz-vb:~/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92$
> ls -l
> total 114892
> drwxr-xr-x 33 lukasz lukasz 4096 pa? 5 11:52 arch
> drwxr-xr-x 3 lukasz lukasz 4096 pa? 5 11:56 block
> drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 certs
> -rw-r--r-- 1 lukasz lukasz 18693 gru 22 2017 COPYING
> -rw-r--r-- 1 lukasz lukasz 98277 gru 22 2017 CREDITS
> drwxr-xr-x 4 lukasz lukasz 20480 pa? 5 11:57 crypto
> drwxr-xr-x 119 lukasz lukasz 12288 pa? 5 11:52 Documentation
> drwxr-xr-x 130 lukasz lukasz 4096 pa? 5 11:57 drivers
> drwxr-xr-x 36 lukasz lukasz 4096 pa? 5 11:56 firmware
> drwxr-xr-x 75 lukasz lukasz 12288 pa? 5 11:56 fs
> drwxr-xr-x 30 lukasz lukasz 4096 pa? 5 11:52 include
> drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 init
> drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 ipc
> -rw-r--r-- 1 lukasz lukasz 2888 gru 22 2017 Kbuild
> -rw-r--r-- 1 lukasz lukasz 252 gru 22 2017 Kconfig
> drwxr-xr-x 16 lukasz lukasz 16384 pa? 5 11:56 kernel
> drwxr-xr-x 12 lukasz lukasz 28672 pa? 5 11:56 lib
> -rw-r--r-- 1 lukasz lukasz 384216 gru 22 2017 MAINTAINERS
> -rw-r--r-- 1 lukasz lukasz 59246 gru 22 2017 Makefile
> drwxr-xr-x 3 lukasz lukasz 12288 pa? 5 11:56 mm
> -rw-r--r-- 1 lukasz lukasz 7056 pa? 5 11:56 modules.builtin
> -rw-r--r-- 1 lukasz lukasz 17409 pa? 5 11:57 modules.order
> -rw-r--r-- 1 lukasz lukasz 549487 pa? 5 11:57 Module.symvers
> drwxr-xr-x 65 lukasz lukasz 4096 pa? 5 11:56 net
> -rw-r--r-- 1 lukasz lukasz 18372 gru 22 2017 README
> -rw-r--r-- 1 lukasz lukasz 7490 gru 22 2017 REPORTING-BUGS
> drwxr-xr-x 25 lukasz lukasz 4096 pa? 5 11:52 samples
> drwxr-xr-x 14 lukasz lukasz 4096 pa? 5 11:56 scripts
> drwxr-xr-x 10 lukasz lukasz 4096 pa? 5 11:56 security
> drwxr-xr-x 23 lukasz lukasz 4096 pa? 5 11:57 sound
> -rw-r--r-- 1 lukasz lukasz 2571239 pa? 5 11:56 System.map
> drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:52 ti_config_fragments
> drwxr-xr-x 30 lukasz lukasz 4096 pa? 5 11:52 tools
> drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 usr
> drwxr-xr-x 4 lukasz lukasz 4096 pa? 5 11:56 virt
> -rwxr-xr-x 1 lukasz lukasz 51072304 pa? 5 11:56 vmlinux
> -rw-r--r-- 1 lukasz lukasz 62819472 pa? 5 11:55 vmlinux.o
>
> I tried providing it as KERNELDIR, but yielded errors as well.
>
> czw., 20 gru 2018 o 14:04 Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> napisa?(a):
>
>> Hello,
>>
>> On Thu, 20 Dec 2018 10:34:42 +0100, ?ukasz Przenios?o wrote:
>>
>> > Thomas, I do build my kernel using buildroot- it gives me the cross
>> > compiling tools. My problem is, that I think that the buildroot doesnt
>> > provide the sources for me in the output.
>>
>> I'm sorry, but I don't really understand what you're saying.
>>
>> If you are building the Linux kernel with Buildroot, so you definitely
>> have a directory called output/build/linux-<version>/ which contains
>> the kernel source code, the kernel configuration (.config file) and
>> all the object files/images that result from a kernel build.
>>
>> If you don't have this folder, then you are definitely not building the
>> Linux kernel with Buildroot.
>>
>> Best regards,
>>
>> Thomas
>> --
>> Thomas Petazzoni, CTO, Bootlin
>> Embedded Linux and Kernel engineering
>> https://bootlin.com
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181220/8b9140c9/attachment.html>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] Cross compiling kernel module for the target
2018-12-20 21:04 ` Łukasz Przeniosło
@ 2018-12-21 7:14 ` Łukasz Przeniosło
0 siblings, 0 replies; 10+ messages in thread
From: Łukasz Przeniosło @ 2018-12-21 7:14 UTC (permalink / raw)
To: buildroot
Hi Thomas, just tested the compiled module on the target- everything works.
Again, thank you for help.
czw., 20 gru 2018 o 22:04 ?ukasz Przenios?o <bremenpl@gmail.com> napisa?(a):
> Thomas, hold on... It has just built... Replaced the KERNELDIR that was
> set to the headers dir with the sources dir listed above. Now the makefile
> looks like this:
>
> obj-m := simp.o
> KERNELDIR ?=
> /home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92
> PWD := $(shell pwd)
>
> all: default
>
> default:
> $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
>
> clean:
> rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
>
> And the make output:
>
> lukasz at lukasz-vb:/tmp/test$ make ARCH=arm
> CROSS_COMPILE=arm-buildroot-linux-uclibcgnueabihf-
> make -C
> /home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92
> M=/tmp/test modules
> make[1]: Entering directory
> '/home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92'
> CC [M] /tmp/test/simp.o
> Building modules, stage 2.
> MODPOST 1 modules
> CC /tmp/test/simp.mod.o
> LD [M] /tmp/test/simp.ko
> make[1]: Leaving directory
> '/home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92'
> lukasz at lukasz-vb:/tmp/test$
> lukasz at lukasz-vb:/tmp/test$
> lukasz at lukasz-vb:/tmp/test$ ls -l
> total 64
> -rw-rw-r-- 1 lukasz lukasz 284 gru 20 21:59 Makefile
> -rw-rw-r-- 1 lukasz lukasz 25 gru 20 22:02 modules.order
> -rw-rw-r-- 1 lukasz lukasz 0 gru 20 22:02 Module.symvers
> -rw-rw-r-- 1 lukasz lukasz 297 gru 20 21:54 simp.c
> -rw-rw-r-- 1 lukasz lukasz 12220 gru 20 22:02 simp.ko
> -rw-rw-r-- 1 lukasz lukasz 839 gru 20 22:02 simp.mod.c
> -rw-rw-r-- 1 lukasz lukasz 18340 gru 20 22:02 simp.mod.dwo
> -rw-rw-r-- 1 lukasz lukasz 7608 gru 20 22:02 simp.mod.o
> -rw-rw-r-- 1 lukasz lukasz 6120 gru 20 22:02 simp.o
>
> But I dont have the target with me, so cannot test the module. But it
> compiles! Thank you very much for help Thomas. I could swear I tried this
> setup before, cant tell now what I have missed.
>
>
>
> czw., 20 gru 2018 o 21:49 ?ukasz Przenios?o <bremenpl@gmail.com>
> napisa?(a):
>
>> Thomas, I am building the Kernel with buildroot. Did you mean this
>> directory?
>>
>> lukasz at lukasz-vb:~/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92$
>> ls -l
>> total 114892
>> drwxr-xr-x 33 lukasz lukasz 4096 pa? 5 11:52 arch
>> drwxr-xr-x 3 lukasz lukasz 4096 pa? 5 11:56 block
>> drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 certs
>> -rw-r--r-- 1 lukasz lukasz 18693 gru 22 2017 COPYING
>> -rw-r--r-- 1 lukasz lukasz 98277 gru 22 2017 CREDITS
>> drwxr-xr-x 4 lukasz lukasz 20480 pa? 5 11:57 crypto
>> drwxr-xr-x 119 lukasz lukasz 12288 pa? 5 11:52 Documentation
>> drwxr-xr-x 130 lukasz lukasz 4096 pa? 5 11:57 drivers
>> drwxr-xr-x 36 lukasz lukasz 4096 pa? 5 11:56 firmware
>> drwxr-xr-x 75 lukasz lukasz 12288 pa? 5 11:56 fs
>> drwxr-xr-x 30 lukasz lukasz 4096 pa? 5 11:52 include
>> drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 init
>> drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 ipc
>> -rw-r--r-- 1 lukasz lukasz 2888 gru 22 2017 Kbuild
>> -rw-r--r-- 1 lukasz lukasz 252 gru 22 2017 Kconfig
>> drwxr-xr-x 16 lukasz lukasz 16384 pa? 5 11:56 kernel
>> drwxr-xr-x 12 lukasz lukasz 28672 pa? 5 11:56 lib
>> -rw-r--r-- 1 lukasz lukasz 384216 gru 22 2017 MAINTAINERS
>> -rw-r--r-- 1 lukasz lukasz 59246 gru 22 2017 Makefile
>> drwxr-xr-x 3 lukasz lukasz 12288 pa? 5 11:56 mm
>> -rw-r--r-- 1 lukasz lukasz 7056 pa? 5 11:56 modules.builtin
>> -rw-r--r-- 1 lukasz lukasz 17409 pa? 5 11:57 modules.order
>> -rw-r--r-- 1 lukasz lukasz 549487 pa? 5 11:57 Module.symvers
>> drwxr-xr-x 65 lukasz lukasz 4096 pa? 5 11:56 net
>> -rw-r--r-- 1 lukasz lukasz 18372 gru 22 2017 README
>> -rw-r--r-- 1 lukasz lukasz 7490 gru 22 2017 REPORTING-BUGS
>> drwxr-xr-x 25 lukasz lukasz 4096 pa? 5 11:52 samples
>> drwxr-xr-x 14 lukasz lukasz 4096 pa? 5 11:56 scripts
>> drwxr-xr-x 10 lukasz lukasz 4096 pa? 5 11:56 security
>> drwxr-xr-x 23 lukasz lukasz 4096 pa? 5 11:57 sound
>> -rw-r--r-- 1 lukasz lukasz 2571239 pa? 5 11:56 System.map
>> drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:52 ti_config_fragments
>> drwxr-xr-x 30 lukasz lukasz 4096 pa? 5 11:52 tools
>> drwxr-xr-x 2 lukasz lukasz 4096 pa? 5 11:56 usr
>> drwxr-xr-x 4 lukasz lukasz 4096 pa? 5 11:56 virt
>> -rwxr-xr-x 1 lukasz lukasz 51072304 pa? 5 11:56 vmlinux
>> -rw-r--r-- 1 lukasz lukasz 62819472 pa? 5 11:55 vmlinux.o
>>
>> I tried providing it as KERNELDIR, but yielded errors as well.
>>
>> czw., 20 gru 2018 o 14:04 Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>> napisa?(a):
>>
>>> Hello,
>>>
>>> On Thu, 20 Dec 2018 10:34:42 +0100, ?ukasz Przenios?o wrote:
>>>
>>> > Thomas, I do build my kernel using buildroot- it gives me the cross
>>> > compiling tools. My problem is, that I think that the buildroot doesnt
>>> > provide the sources for me in the output.
>>>
>>> I'm sorry, but I don't really understand what you're saying.
>>>
>>> If you are building the Linux kernel with Buildroot, so you definitely
>>> have a directory called output/build/linux-<version>/ which contains
>>> the kernel source code, the kernel configuration (.config file) and
>>> all the object files/images that result from a kernel build.
>>>
>>> If you don't have this folder, then you are definitely not building the
>>> Linux kernel with Buildroot.
>>>
>>> Best regards,
>>>
>>> Thomas
>>> --
>>> Thomas Petazzoni, CTO, Bootlin
>>> Embedded Linux and Kernel engineering
>>> https://bootlin.com
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181221/209ccefa/attachment.html>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-12-21 7:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-20 7:39 [Buildroot] Cross compiling kernel module for the target Łukasz Przeniosło
2018-12-20 8:04 ` Thomas Petazzoni
[not found] ` <CA+OsCCQ2TWYiEv-a8uRaJVSd4YX9A4T_EV1ihC1Y2ZyrNPAkag@mail.gmail.com>
2018-12-20 9:07 ` Thomas Petazzoni
2018-12-20 9:14 ` Łukasz Przeniosło
2018-12-20 9:20 ` Thomas Petazzoni
2018-12-20 9:34 ` Łukasz Przeniosło
2018-12-20 13:04 ` Thomas Petazzoni
2018-12-20 20:49 ` Łukasz Przeniosło
2018-12-20 21:04 ` Łukasz Przeniosło
2018-12-21 7:14 ` Łukasz Przeniosło
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox