yocto 2.1 linux 4.1 (linux-fsl-imx) and driver lib.a file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

yocto 2.1 linux 4.1 (linux-fsl-imx) and driver lib.a file

944 Views
jayakumar2
Contributor V

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!

Labels (2)
Tags (1)
0 Kudos
2 Replies

538 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello Jaya Kumar,

Have you encountered the root cause for this issue?

I couldn’t find nothing definitive but it seems the problem may be what parameters are being used when executing from within bitbake that may change the final command to be run.

One thing that may be good to make sure is that the priorities are setup correctly as if there is redundancy the highest priority will be executed.

If you haven’t find the root cause maybe you can try the Community BSP mailing list. Perhaps a user has seen a similar behavior.

Regards,

0 Kudos

538 Views
jayakumar2
Contributor V

Hi,

Thanks for your reply. I wasn't able to figure out the root cause. I ended up adding a post-build script that packages up the modules from the manual compile build and populating the /lib/modules/-kern-ver- . Yup, very ugly but ran out of time on that project.

If I had some time, I would explore further whether there's any difference in the version of make and related scripts called by kbuild when in bitbake versus when in manual. That's where the difference in that .cmd file comes from. ie: in the manual compile, kbuild/make generates the .cmd containing:

< 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

whereas in the bitbake generated kbuild/make compile, it generates:

/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

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

Thanks.

0 Kudos