* [PATCH] mk: pass CROSS_COMPILE when compiling kernel modules
@ 2014-02-07 16:44 Aaro Koskinen
[not found] ` <1391791458-17601-1-git-send-email-aaro.koskinen-OYasijW0DpE@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Aaro Koskinen @ 2014-02-07 16:44 UTC (permalink / raw)
To: dev-VfR2kkLFssw
Pass CROSS_COMPILE to the kernel build system when compiling kernel
modules. Although we export CC etc. the top level kernel Makefile will
override the environment. As a result it will end up using wrong tools
if cross-compilation is desired but CROSS_COMPILE is not set.
Signed-off-by: Aaro Koskinen <aaro.koskinen-OYasijW0DpE@public.gmane.org>
---
mk/rte.module.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/rte.module.mk b/mk/rte.module.mk
index b3a630e..5d66d90 100644
--- a/mk/rte.module.mk
+++ b/mk/rte.module.mk
@@ -77,7 +77,7 @@ build: _postbuild
# build module
$(MODULE).ko: $(SRCS_LINKS)
@if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi
- @$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR)
+ @$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) CROSS_COMPILE=$(CROSS)
# install module in $(RTE_OUTPUT)/kmod
$(RTE_OUTPUT)/kmod/$(MODULE).ko: $(MODULE).ko
--
1.8.5.1
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <1391791458-17601-1-git-send-email-aaro.koskinen-OYasijW0DpE@public.gmane.org>]
* Re: [PATCH] mk: pass CROSS_COMPILE when compiling kernel modules [not found] ` <1391791458-17601-1-git-send-email-aaro.koskinen-OYasijW0DpE@public.gmane.org> @ 2014-02-25 21:55 ` Thomas Monjalon 2014-03-07 13:32 ` Aaro Koskinen 0 siblings, 1 reply; 4+ messages in thread From: Thomas Monjalon @ 2014-02-25 21:55 UTC (permalink / raw) To: Aaro Koskinen; +Cc: dev-VfR2kkLFssw Hi, 07/02/2014 18:44, Aaro Koskinen : > Pass CROSS_COMPILE to the kernel build system when compiling kernel > modules. Although we export CC etc. the top level kernel Makefile will > override the environment. As a result it will end up using wrong tools > if cross-compilation is desired but CROSS_COMPILE is not set. > > Signed-off-by: Aaro Koskinen <aaro.koskinen-OYasijW0DpE@public.gmane.org> Could you explain why it's needed ? In a basic test, CC=$(CROSS)gcc in rte.vars.mk seems sufficient. Thanks -- Thomas ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mk: pass CROSS_COMPILE when compiling kernel modules 2014-02-25 21:55 ` Thomas Monjalon @ 2014-03-07 13:32 ` Aaro Koskinen [not found] ` <20140307133226.GV15431-wKwWf7Pro3RJlwZWLBHdvBaOaYmgohGe0e7PPNI6Mm0@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Aaro Koskinen @ 2014-03-07 13:32 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev-VfR2kkLFssw Hi, On Tue, Feb 25, 2014 at 10:55:36PM +0100, Thomas Monjalon wrote: > 07/02/2014 18:44, Aaro Koskinen : > > Pass CROSS_COMPILE to the kernel build system when compiling kernel > > modules. Although we export CC etc. the top level kernel Makefile will > > override the environment. As a result it will end up using wrong tools > > if cross-compilation is desired but CROSS_COMPILE is not set. > > > > Signed-off-by: Aaro Koskinen <aaro.koskinen-OYasijW0DpE@public.gmane.org> > > Could you explain why it's needed ? > In a basic test, CC=$(CROSS)gcc in rte.vars.mk seems sufficient. If you compile on 32-bit host to 64-bit target, the build fails with errors such as: [...]include/linux/kernfs.h:331:1: note: expected 'const char *' but argument is of type 'const unsigned char *' kernfs_find_and_get(struct kernfs_node *kn, const char *name) ^ cc1: all warnings being treated as errors Build with V=1 shows that following appears in the command line when compiling the kernel modules: -isystem /usr/lib/gcc/i486-linux-gnu/4.8/include With the patch this will be corrected to point to my target's sysroot: -isystem /foo/bar/lib/gcc/x86_64-linux-gnu/4.8.2/include And the build succeeds without any warnings. A. ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <20140307133226.GV15431-wKwWf7Pro3RJlwZWLBHdvBaOaYmgohGe0e7PPNI6Mm0@public.gmane.org>]
* Re: [PATCH] mk: pass CROSS_COMPILE when compiling kernel modules [not found] ` <20140307133226.GV15431-wKwWf7Pro3RJlwZWLBHdvBaOaYmgohGe0e7PPNI6Mm0@public.gmane.org> @ 2014-04-17 13:38 ` Thomas Monjalon 0 siblings, 0 replies; 4+ messages in thread From: Thomas Monjalon @ 2014-04-17 13:38 UTC (permalink / raw) To: Aaro Koskinen; +Cc: dev-VfR2kkLFssw Hi, 2014-03-07 15:32, Aaro Koskinen: > On Tue, Feb 25, 2014 at 10:55:36PM +0100, Thomas Monjalon wrote: > > 07/02/2014 18:44, Aaro Koskinen : > > > Pass CROSS_COMPILE to the kernel build system when compiling kernel > > > modules. Although we export CC etc. the top level kernel Makefile will > > > override the environment. As a result it will end up using wrong tools > > > if cross-compilation is desired but CROSS_COMPILE is not set. > > > > > > Signed-off-by: Aaro Koskinen <aaro.koskinen-OYasijW0DpE@public.gmane.org> > > > > Could you explain why it's needed ? > > In a basic test, CC=$(CROSS)gcc in rte.vars.mk seems sufficient. > > If you compile on 32-bit host to 64-bit target, the build fails with > errors such as: > > [...]include/linux/kernfs.h:331:1: note: expected 'const char *' but > argument is of type 'const unsigned char *' kernfs_find_and_get(struct > kernfs_node *kn, const char *name) > ^ > cc1: all warnings being treated as errors > > Build with V=1 shows that following appears in the command line > when compiling the kernel modules: > > -isystem /usr/lib/gcc/i486-linux-gnu/4.8/include > > With the patch this will be corrected to point to my target's sysroot: > > -isystem /foo/bar/lib/gcc/x86_64-linux-gnu/4.8.2/include > > And the build succeeds without any warnings. Acked-by: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> It's applied for version 1.6.0r2. Thanks -- Thomas ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-17 13:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-07 16:44 [PATCH] mk: pass CROSS_COMPILE when compiling kernel modules Aaro Koskinen
[not found] ` <1391791458-17601-1-git-send-email-aaro.koskinen-OYasijW0DpE@public.gmane.org>
2014-02-25 21:55 ` Thomas Monjalon
2014-03-07 13:32 ` Aaro Koskinen
[not found] ` <20140307133226.GV15431-wKwWf7Pro3RJlwZWLBHdvBaOaYmgohGe0e7PPNI6Mm0@public.gmane.org>
2014-04-17 13:38 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).