Hi,
I'm working on porting my board to yocto 2.1 with linux 4.1 (using linux-fsl-imx). I have my kernel build working fine using manual compile (poky sdk build toolchain). I then wanted to get that packaged using the linux-fsl-imx recipe. So I added my complete patchset to the corresponding recipe. That worked fine and I'm happy with it.
But then I needed to add a binary-only driver specific lib.a from fsl. When I do that, it works fine within the manual compile but exact same code fails within the bitbake build. I narrowed down the difference to a generated kernel compilation record file. Here are the details:
a) compare between the working case (manual build) and failing case (bitbake build)
$ diff /home/test
/kernelwork/linux-4.1-1.0/drivers/video/fbdev/mxc/.mxc_epdc_eink.o.cmd /home/test/fsl-community-bsp/build/tmp/work/imx6slevk-poky-linux-gnueabi/linux-fslc-imx/4.1-1.0.x+gitAUTOINC+59b38c323b-r0/build/drivers/video/fbdev/mxc/.mxc_epdc_eink.o.cmd
1c1
< cmd_drivers/video/fbdev/mxc/mxc_epdc_eink.o := arm-poky-linux-gnueabi-ld -EL -r -o drivers/video/fbdev/mxc/mxc_epdc_eink.o drivers/video/fbdev/mxc/mxc_epdc_eink_module.o drivers/video/fbdev/mxc/lib.a
---
> cmd_drivers/video/fbdev/mxc/mxc_epdc_eink.o := arm-poky-linux-gnueabi-ld.bfd -r -o drivers/video/fbdev/mxc/mxc_epdc_eink.o drivers/video/fbdev/mxc/mxc_epdc_eink_module.o
The top line is the one that works. You can see it has the ld line which includes the object file drivers/video/fbdev/mxc/lib.a whereas the bottom one does not.
That's very surprising to me because the codebase is identical (as shown by diff). Both Makefiles have:
b) showing that the bitbake build also has the exact same lib.a dependency in the Makefile
$ egrep lib.a /ho
me/test/fsl-community-bsp/build/tmp/work/imx6slevk-poky-linux-gnueabi/linux-fslc-imx/4.1-1.0.x+gitAUTOINC+59b38c323b-r0/build/source/drivers/video/fbdev/mxc/Makefile
mxc_epdc_eink-objs := mxc_epdc_eink_module.o lib.a
If I manually modify /home/test/fsl-community-bsp/build/tmp/work/imx6slevk-poky-linux-gnueabi/linux-fslc-imx/4.1-1.0.x+gitAUTOINC+59b38c323b-r0/build/drivers/video/fbdev/mxc/.mxc_epdc_eink.o.cmd and add the lib.a line and then run $ bitbake linux-fslc-imx , then the above file gets re-generated and so the lib.a portion disappears and thus the build from within bitbake fails. I couldn't figure out what causes the lib.a portion to be missing.
c) error message due to the missing lib.a in the link line
| DEBUG: Executing shell function do_compile_kernelmodules
| NOTE: make -C /home/test/fsl-community-bsp/build/tmp/work/imx6slevk-poky-linux-gnueabi/linux-fslc-imx/4.1-1.0.x+gitAUTOINC+59b38c323b-r0/build -j 1 modules CC=arm-poky-linux-gnueabi-gcc -mno-thumb-interwork -marm -fuse-ld=bfd LD=arm-poky-linux-gnueabi-ld.bfd LOADADDR=0x80008000
| make: Entering directory `/home/test/fsl-community-bsp/build/tmp/work/imx6slevk-poky-linux-gnueabi/linux-fslc-imx/4.1-1.0.x+gitAUTOINC+59b38c323b-r0/build'
| CHK include/config/kernel.release
| Using /home/test/fsl-community-bsp/build/tmp/work-shared/imx6slevk/kernel-source as source for kernel
| GEN ./Makefile
| CHK include/generated/uapi/linux/version.h
| CHK include/generated/utsrelease.h
| make[3]: `include/generated/mach-types.h' is up to date.
| CHK include/generated/bounds.h
| CHK include/generated/asm-offsets.h
| CALL /home/test/fsl-community-bsp/build/tmp/work-shared/imx6slevk/kernel-source/scripts/checksyscalls.sh
| LD [M] drivers/video/fbdev/mxc/mxc_epdc_eink.o
| Building modules, stage 2.
| MODPOST 99 modules
...
| ERROR: "function_from_liba" [drivers/video/fbdev/mxc/mxc_epdc_eink.ko] undefined!
| make[3]: *** [__modpost] Error 1
| make[2]: *** [modules] Error 2
| make[1]: *** [sub-make] Error 2
| make: *** [__sub-make] Error 2
I'm stumped as to why there's a difference in the result when built from within bitbake. I would appreciate any advice/suggestions on what could be causing the lib.a to disappear from the kernel driver link line.
Thanks!