ltp-testsuite: build kernel modules when appropriate
PATCH 1/1 ltp-testsuite: build kernel modules when appropriate
From: Marc Gonzalez <[email protected]>
When building a kernel, build LTP's test kernel modules also.
--- package/ltp-testsuite/ltp-testsuite.mk | 7 +++++++ 1 file changed, 7 insertions(+)
package/ltp-testsuite/ltp-testsuite.mk +7 -0
@@ -13,6 +13,13 @@ LTP_TESTSUITE_CONF_OPTS += \ --with-power-management-testsuite \ --with-realtime-testsuite +ifeq ($(BR2_LINUX_KERNEL),y) +LTP_TESTSUITE_DEPENDENCIES += linux +LTP_TESTSUITE_CONF_OPTS += --with-linux-dir=$(LINUX_DIR) +else +LTP_TESTSUITE_CONF_OPTS += --without-modules +endif + # Needs libcap with file attrs which needs attr, so both required ifeq ($(BR2_PACKAGE_LIBCAP)$(BR2_PACKAGE_ATTR),yy) LTP_TESTSUITE_DEPENDENCIES += libcap
Signature · 1 line
2.7.0
PATCH 1/1 ltp-testsuite: build kernel modules when appropriate
Hello,
Quoted 14 lines · Mason
From: Marc Gonzalez <[email protected]>
When building a kernel, build LTP's test kernel modules also.
Signed-off-by Marc Gonzalez <[email protected]>--- package/ltp-testsuite/ltp-testsuite.mk | 7 +++++++ 1 file changed, 7 insertions(+)package/ltp-testsuite/ltp-testsuite.mk +0
-0
package/ltp-testsuite/ltp-testsuite.mk LTP_TESTSUITE_CONF_OPTS += \ · line 21
Quoted 9 lines
package/ltp-testsuite/ltp-testsuite.mk +6
-0@@ -13,6 +13,13 @@ LTP_TESTSUITE_CONF_OPTS += \ --with-power-management-testsuite \ --with-realtime-testsuite +ifeq ($(BR2_LINUX_KERNEL),y) +LTP_TESTSUITE_DEPENDENCIES += linux +LTP_TESTSUITE_CONF_OPTS += --with-linux-dir=$(LINUX_DIR) +else +LTP_TESTSUITE_CONF_OPTS += --without-modules +endif
It looks good in principle, but unfortunately in practice it doesn't work. Try to build the following configuration:
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-cortex-a9-glibc-2016.02-3-g762b7c9.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_5=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_4=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_DEFCONFIG="mvebu_v7"
BR2_LINUX_KERNEL_ZIMAGE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_LTP_TESTSUITE=y
# BR2_TARGET_ROOTFS_TAR is not set
And you will see that the LTP kernel modules are not built. And the reason is that it tries to build them without passing the appropriate ARCH= variable, so it falls back to x86, and therefore fails to build them. Here is what I see:
LD /home/thomas/projets/buildroot/output/build/ltp-testsuite-20160126/testcases/kernel/module/delete_module/built-in.o CC [M] /home/thomas/projets/buildroot/output/build/ltp-testsuite-20160126/testcases/kernel/module/delete_module/dummy_del_mod.o CC [M] /home/thomas/projets/buildroot/output/build/ltp-testsuite-20160126/testcases/kernel/module/delete_module/dummy_del_mod_dep.o
In file included from ./arch/x86/include/asm/atomic.h:6:0,
from /home/thomas/projets/buildroot/output/build/ltp-testsuite-20160126/testcases/kernel/module/delete_module/dummy_del_mod.c:32:./arch/x86/include/asm/arch_hweight.h: In function ?__arch_hweight64?:
In file included from ./arch/x86/include/asm/atomic.h:6:0,
from /home/thomas/projets/buildroot/output/build/ltp-testsuite-20160126/testcases/kernel/module/delete_module/dummy_del_mod_dep.c:32:./arch/x86/include/asm/arch_hweight.h: In function ?__arch_hweight64?:./arch/x86/include/asm/arch_hweight.h:56:42: error: expected ?:? or ?)? before ?POPCNT64?
asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
^
./arch/x86/include/asm/alternative.h:131:28: note: in definition of macro ?ALTINSTR_REPLACEMENT?
b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n\t"
^And then lots and lots of errors about arch/x86 related headers. And indeed, my kernel is configured/built for ARM.
So maybe it worked if you tested for a x86 target, but I'm a bit confused since I know you're working on ARM stuff. Maybe you have ARCH=arm defined globally in your environment and therefore it makes things work?
Could you look into this and send an updated patch?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 ltp-testsuite: build kernel modules when appropriate
Quoted 17 lines · Thomas Petazzoni
package/ltp-testsuite/ltp-testsuite.mk LTP_TESTSUITE_CONF_OPTS += \ · line 21
Quoted 6 lines · Mason
package/ltp-testsuite/ltp-testsuite.mk +6
-0+ifeq ($(BR2_LINUX_KERNEL),y) +LTP_TESTSUITE_DEPENDENCIES += linux +LTP_TESTSUITE_CONF_OPTS += --with-linux-dir=$(LINUX_DIR) +else +LTP_TESTSUITE_CONF_OPTS += --without-modules +endifIt looks good in principle, but unfortunately in practice it doesn't work. Try to build the following configuration: [snip]
And you will see that the LTP kernel modules are not built. And the reason is that it tries to build them without passing the appropriate ARCH= variable, so it falls back to x86, and therefore fails to build them. Here is what I see: [snip]
Quoted 7 lines
And then lots and lots of errors about
arch/x86related headers. And indeed, my kernel is configured/built for ARM.So maybe it worked if you tested for a x86 target, but I'm a bit confused since I know you're working on ARM stuff. Maybe you have ARCH=arm defined globally in your environment and therefore it makes things work?
Yes, you hit the nail on the head. Since I work exclusively with ARM platforms, I have ARCH=arm exported in my environment.
Quoted 1 line
Could you look into this and send an updated patch?
I'm not sure what the correct solution is. We discussed the issue a few days ago, and you mentioned KERNEL_ARCH.
Should I just export ARCH=$(KERNEL_ARCH) in the environment?
But I'm not sure how to do it globally, or whether that is the appropriate solution... Could someone provide some guidance?
Regards.
PATCH 1/1 ltp-testsuite: build kernel modules when appropriate
Quoted 32 lines · Mason
Quoted 17 lines · Thomas Petazzoni
package/ltp-testsuite/ltp-testsuite.mk LTP_TESTSUITE_CONF_OPTS += \ · line 21
Quoted 6 lines · Mason
package/ltp-testsuite/ltp-testsuite.mk +6
-0+ifeq ($(BR2_LINUX_KERNEL),y) +LTP_TESTSUITE_DEPENDENCIES += linux +LTP_TESTSUITE_CONF_OPTS += --with-linux-dir=$(LINUX_DIR) +else +LTP_TESTSUITE_CONF_OPTS += --without-modules +endifIt looks good in principle, but unfortunately in practice it doesn't work. Try to build the following configuration: [snip]
And you will see that the LTP kernel modules are not built. And the reason is that it tries to build them without passing the appropriate ARCH= variable, so it falls back to x86, and therefore fails to build them. Here is what I see: [snip]
Quoted 7 lines
And then lots and lots of errors about
arch/x86related headers. And indeed, my kernel is configured/built for ARM.So maybe it worked if you tested for a x86 target, but I'm a bit confused since I know you're working on ARM stuff. Maybe you have ARCH=arm defined globally in your environment and therefore it makes things work?
Yes, you hit the nail on the head. Since I work exclusively with ARM platforms, I have ARCH=arm exported in my environment.
Quoted 1 line
Could you look into this and send an updated patch?
Quoted 7 lines
I'm not sure what the correct solution is. We discussed the issue a few days ago, and you mentioned
KERNEL_ARCH.Should I just export ARCH=$(KERNEL_ARCH) in the environment?
But I'm not sure how to do it globally, or whether that is the appropriate solution... Could someone provide some guidance?
You need to add that to LTP_TESTSUITE_MAKE_ENV:
LTP_TESTSUITE_MAKE_ENV = ARCH=$(KERNEL_ARCH)
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v2 1/1 ltp-testsuite: build kernel modules when appropriate
From: Marc Gonzalez <[email protected]>
If we're building a kernel, we can also build LTP's test modules.
--- package/ltp-testsuite/ltp-testsuite.mk | 8 ++++++++ 1 file changed, 8 insertions(+)
package/ltp-testsuite/ltp-testsuite.mk +8 -0
@@ -13,6 +13,14 @@ LTP_TESTSUITE_CONF_OPTS += \ --with-power-management-testsuite \ --with-realtime-testsuite +ifeq ($(BR2_LINUX_KERNEL),y) +LTP_TESTSUITE_DEPENDENCIES += linux +LTP_TESTSUITE_MAKE_ENV = ARCH=$(KERNEL_ARCH) +LTP_TESTSUITE_CONF_OPTS += --with-linux-dir=$(LINUX_DIR) +else +LTP_TESTSUITE_CONF_OPTS += --without-modules +endif + # Needs libcap with file attrs which needs attr, so both required ifeq ($(BR2_PACKAGE_LIBCAP)$(BR2_PACKAGE_ATTR),yy) LTP_TESTSUITE_DEPENDENCIES += libcap
Signature · 1 line
2.8.0
PATCH v2 1/1 ltp-testsuite: build kernel modules when appropriate
Quoted 14 lines · Mason
From: Marc Gonzalez <[email protected]>
If we're building a kernel, we can also build LTP's test modules.
Signed-off-by Marc Gonzalez <[email protected]>--- package/ltp-testsuite/ltp-testsuite.mk | 8 ++++++++ 1 file changed, 8 insertions(+)package/ltp-testsuite/ltp-testsuite.mk +0
-0
package/ltp-testsuite/ltp-testsuite.mk LTP_TESTSUITE_CONF_OPTS += \ · line 18
Quoted 6 lines
package/ltp-testsuite/ltp-testsuite.mk +3
-0@@ -13,6 +13,14 @@ LTP_TESTSUITE_CONF_OPTS += \ --with-power-management-testsuite \ --with-realtime-testsuite +ifeq ($(BR2_LINUX_KERNEL),y) +LTP_TESTSUITE_DEPENDENCIES += linux +LTP_TESTSUITE_MAKE_ENV = ARCH=$(KERNEL_ARCH)
Have you actually tested the defconfig that Thomas suggested? This still
doesn't work, because it tries to build with host gcc instead of cross-gcc:
Building modules: ltp_block_dev.c/usr/bin/make -C /home/arnout/src/buildroot/out/wandboard/build/linux-86429847b5152f040f190015faedcac49b243328 M=output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel make[7]: Entering directory
'output/build/linux-86429847b5152f040f190015faedcac49b243328'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo; \
echo " ERROR: Kernel configuration is invalid."; \
echo " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo; \/bin/false)
mkdir -p output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/.tmp_versions ; rm -f output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/.tmp_versions/* /usr/bin/make -f scripts/Makefile.build obj=output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel (cat /dev/null; echo kernel/output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.ko;)
Quoted 1 line
output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/modules.order gcc -Wp,-MD,output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/.ltp_block_dev.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/5/include -Ioutput/build/linux-86429847b5152f040f190015faedcac49b243328/arch/arm/include -Iarch/arm/include/generated -Iinclude -include include/generated/autoconf.h
-D__KERNEL__ -mlittle-endian -Iarch/arm/mach-mx6/include
-Iarch/arm/plat-mxc/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
-Wno-format-security -fno-delete-null-pointer-checks -Os -fno-dwarf2-cfi-asm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=aapcs-linux
-mno-thumb-interwork -D__LINUX_ARM_ARCH__=7 -march=armv5t -Wa,-march=armv7-a
-msoft-float -Uarm -fno-omit-frame-pointer -fno-optimize-sibling-calls
-DCC_HAVE_ASM_GOTO -DMODULE -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(ltp_block_dev)"
-D"KBUILD_MODNAME=KBUILD_STR(ltp_block_dev)" -c -o output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/.tmp_ltp_block_dev.o output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c rm -f output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/built-in.o; ar rcsD output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/built-in.o
gcc: error: unrecognized argument in option '-mabi=aapcs-linux'
gcc: note: valid arguments to '-mabi=' are: ms sysv
gcc: error: unrecognized command line option '-mlittle-endian'
gcc: error: unrecognized command line option '-mapcs'
gcc: error: unrecognized command line option '-mno-sched-prolog'
gcc: error: unrecognized command line option '-mno-thumb-interwork'scripts/Makefile.build:311: recipe for target 'output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.o' failed
make[8]: *** [output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.o] Error 1
make[8]: *** Waiting for unfinished jobs....
Makefile:1360: recipe for target '_module_output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel' failed
make[7]: *** [_module_output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel] Error 2
make[7]: Leaving directory
'output/build/linux-86429847b5152f040f190015faedcac49b243328' ../../../../../include/mk/module.mk:59: recipe for target '.dep_modules' failed
make[6]: [.dep_modules] Error 2 (ignored)
Can you try instead to set
LTP_TESTSUITE_MAKE_ENV = $(LINUX_MAKE_FLAGS)
The problem is that autotools sets CC and CROSS_COMPILE correctly for its own
Makefiles, but doesn't export them so they are not used for the kernel build system.
Regards,
Arnout
Quoted 9 lines
package/ltp-testsuite/ltp-testsuite.mk +5
-0+LTP_TESTSUITE_CONF_OPTS += --with-linux-dir=$(LINUX_DIR) +else +LTP_TESTSUITE_CONF_OPTS += --without-modules +endif + # Needs libcap with file attrs which needs attr, so both required ifeq ($(BR2_PACKAGE_LIBCAP)$(BR2_PACKAGE_ATTR),yy) LTP_TESTSUITE_DEPENDENCIES += libcap
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v3 1/1 ltp-testsuite: build kernel modules when appropriate
From: Marc Gonzalez <[email protected]>
If we're building a kernel, we can also build LTP's test modules.
---
Tested using the defconfig provided by Thomas Petazzoni.
$ find output/build/ltp-testsuite-20160126 -name *.ko output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/uaccess/ltp_uaccess.ko output/build/ltp-testsuite-20160126/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.ko output/build/ltp-testsuite-20160126/testcases/kernel/module/delete_module/dummy_del_mod.ko output/build/ltp-testsuite-20160126/testcases/kernel/module/delete_module/dummy_del_mod_dep.ko output/build/ltp-testsuite-20160126/testcases/kernel/firmware/fw_load_kernel/ltp_fw_load.ko
Three modules still fail to build, but I think this depends on the kernel config.
Building modules: ltp_acpi_cmds.c
Building modules: ltp_tpci.c
Building modules: ltp_tbio.c
--- package/ltp-testsuite/ltp-testsuite.mk | 8 ++++++++ 1 file changed, 8 insertions(+)
package/ltp-testsuite/ltp-testsuite.mk +8 -0
@@ -13,6 +13,14 @@ LTP_TESTSUITE_CONF_OPTS += \ --with-power-management-testsuite \ --with-realtime-testsuite +ifeq ($(BR2_LINUX_KERNEL),y) +LTP_TESTSUITE_DEPENDENCIES += linux +LTP_TESTSUITE_MAKE_ENV = $(LINUX_MAKE_FLAGS) +LTP_TESTSUITE_CONF_OPTS += --with-linux-dir=$(LINUX_DIR) +else +LTP_TESTSUITE_CONF_OPTS += --without-modules +endif + # Needs libcap with file attrs which needs attr, so both required ifeq ($(BR2_PACKAGE_LIBCAP)$(BR2_PACKAGE_ATTR),yy) LTP_TESTSUITE_DEPENDENCIES += libcap
Signature · 1 line
2.8.1
PATCH v3 1/1 ltp-testsuite: build kernel modules when appropriate
Quoted 4 lines · Mason
If we're building a kernel, we can also build LTP's test modules.
--- package/ltp-testsuite/ltp-testsuite.mk | 8 ++++++++ 1 file changed, 8 insertions(+)
Are there remaining issues with this patch?
Regards.
PATCH v3 1/1 ltp-testsuite: build kernel modules when appropriate
In reply to MasonHello,
package/ltp-testsuite/ltp-testsuite.mk LTP_TESTSUITE_CONF_OPTS += \ · line 18
Quoted 3 lines · Mason
package/ltp-testsuite/ltp-testsuite.mk +3
-0+ifeq ($(BR2_LINUX_KERNEL),y) +LTP_TESTSUITE_DEPENDENCIES += linux +LTP_TESTSUITE_MAKE_ENV = $(LINUX_MAKE_FLAGS)
This should use += instead of = since we're in a conditional block. While this is not needed right now, it is a bit more logical and future proof.
Applied with this fixed!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v3 1/1 ltp-testsuite: build kernel modules when appropriate
Quoted 12 lines · Thomas Petazzoni
Hello,
package/ltp-testsuite/ltp-testsuite.mk LTP_TESTSUITE_CONF_OPTS += \ · line 18
Quoted 3 lines · Mason
package/ltp-testsuite/ltp-testsuite.mk +3
-0+ifeq ($(BR2_LINUX_KERNEL),y) +LTP_TESTSUITE_DEPENDENCIES += linux +LTP_TESTSUITE_MAKE_ENV = $(LINUX_MAKE_FLAGS)This should use += instead of = since we're in a conditional block. While this is not needed right now, it is a bit more logical and future proof.
Quoted 3 lines
Applied with this fixed!
Thomas
Thanks!