Fixed
Created: Mar 11, 2016
Updated: Dec 3, 2018
Resolved Date: Apr 15, 2016
Found In Version: 8.0.0.2
Fix Version: 8.0.0.5
Severity: Standard
Applicable for: Wind River Linux 8
Component/s: Build & Config
Back in WRL5 we raised an enhancement request to have the SDK installer run "make scripts" in the kernel source after installation.
This is required in order to build out-of-tree kernel modules using the SDK.
We were told this was implemented in Yocto 1.5 and therefore would be included in WRL8, but it seems not the case.
Manually build the scripts after installing the SDK.
If you build with --enable-rm-work=yes --enable-rm-oldimgs=yes, the kernel scripts in SDK can't be created, so removing the 2 option if you needs the kernel scripts.
$ configure --enable-board=intel_x86_64 --enable-rootfs=glibc_std --enable-kernel=standard --with-layer=wr-kernel/kernel-dev --enable-rm-work=yes --enable-rm-oldimgs=yes
$ make fs
$ make export-sdk
Install the SDK with:
$ ./export/wrlinux-8.0.0.2-glibc-x86_64-intel_x86_64-wrlinux-image-glibc-std-sdk.sh
Attempt to build a trivial kernel module using the SDK:
$ cd /path/to/sdk
$ . env.sh
$ cd /path/to/module/source
$ make KDIR=/opt/windriver/intel_x86_64-glibc_std-standard-80p2/sysroots/corei7-64-wrs-linux/usr/src/kernel/
make -C /opt/windriver/intel_x86_64-glibc_std-standard-80p2/sysroots/corei7-64-wrs-linux/usr/src/kernel/ M=/usr/work/src/dummy_lkm CROSS_COMPILE=x86_64-wrs-linux- modules
make[1]: Entering directory `/opt/windriver/intel_x86_64-glibc_std-standard-80p2/sysroots/corei7-64-wrs-linux/usr/src/kernel'
CC [M] /usr/work/src/dummy_lkm/dummy.o
/bin/sh: ./scripts/recordmcount: No such file or directory
make[2]: *** [/usr/work/src/dummy_lkm/dummy.o] Error 1
make[1]: *** [_module_/usr/work/src/dummy_lkm] Error 2
make[1]: Leaving directory `/opt/windriver/intel_x86_64-glibc_std-standard-80p2/sysroots/corei7-64-wrs-linux/usr/src/kernel'
make: *** [all] Error 2
Build fails, manually build the scripts:
$ cd /opt/windriver/intel_x86_64-glibc_std-standard-80p2/sysroots/corei7-64-wrs-linux/usr/src/kernel/
$ make CROSS_COMPILE=$TARGET_PREFIX scripts
Makefile:1190: target `_clean_samples' given more than once in the same rule.
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/bin2c
CC scripts/mod/empty.o
HOSTCC scripts/mod/mk_elfconfig
MKELF scripts/mod/elfconfig.h
HOSTCC scripts/mod/modpost.o
CC scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
HOSTCC scripts/mod/sumversion.o
HOSTLD scripts/mod/modpost
HOSTCC scripts/kallsyms
HOSTCC scripts/conmakehash
HOSTCC scripts/recordmcount
HOSTCC scripts/sortextable
Now try to build the module again:
$ cd -
/home/Work/src/dummy_lkm
$ make KDIR=/opt/windriver/intel_x86_64-glibc_std-standard-80p2/sysroots/corei7-64-wrs-linux/usr/src/kernel/
make -C /opt/windriver/intel_x86_64-glibc_std-standard-80p2/sysroots/corei7-64-wrs-linux/usr/src/kernel/ M=/usr/work/src/dummy_lkm CROSS_COMPILE=x86_64-wrs-linux- modules
make[1]: Entering directory `/opt/windriver/intel_x86_64-glibc_std-standard-80p2/sysroots/corei7-64-wrs-linux/usr/src/kernel'
CC [M] /usr/work/src/dummy_lkm/dummy.o
Building modules, stage 2.
MODPOST 1 modules
CC /usr/work/src/dummy_lkm/dummy.mod.o
LD [M] /usr/work/src/dummy_lkm/dummy.ko
make[1]: Leaving directory `/opt/windriver/intel_x86_64-glibc_std-standard-80p2/sysroots/corei7-64-wrs-linux/usr/src/kernel'
success.