【P1010】 How to compile kernel module

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

【P1010】 How to compile kernel module

跳至解决方案
2,692 次查看
luyufan498
Contributor I

make -C /home/yflu/linux-3.10.48 M=/home/yflu/hello modules ARCH=powerpc CROSS_COMPILE=powerpc-fsl-linux-gnuspe-

make[1]: Entering directory `/home/yflu/linux-3.10.48'

  Building modules, stage 2.

  MODPOST 1 modules

  LD [M]  /home/yflu/hello/mo.ko

powerpc-fsl-linux-gnuspe-ld: unrecognized option '-Wl,-O1'

powerpc-fsl-linux-gnuspe-ld: use the --help option for usage information

make[2]: *** [/home/yflu/hello/mo.ko] Error 1

make[1]: *** [modules] Error 2

make[1]: Leaving directory `/home/yflu/linux-3.10.48'

make: *** [all] Error 2

0 项奖励
回复
1 解答
2,430 次查看
bpe
NXP Employee
NXP Employee

Your linker for some reason receives options that should rather be interpreted by GCC. This may happen

due to wrong makefiles or environment variables. Suggestions:

1. Check the Makefile or Kbuild in your module source directory. One of them must be present. See Section 3 of this:

https://www.kernel.org/doc/Documentation/kbuild/modules.txt

2. Use the kernel and the toolchain from QorIQ SDK.

3. Make sure you successfully built the kernel for the selected target before attempting to build an external module.

4. Refer to the following links for general information:

https://www.kernel.org/doc/Documentation/kbuild/modules.txt

Compiling Kernel Modules


Have a great day,
Platon

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
1 回复
2,431 次查看
bpe
NXP Employee
NXP Employee

Your linker for some reason receives options that should rather be interpreted by GCC. This may happen

due to wrong makefiles or environment variables. Suggestions:

1. Check the Makefile or Kbuild in your module source directory. One of them must be present. See Section 3 of this:

https://www.kernel.org/doc/Documentation/kbuild/modules.txt

2. Use the kernel and the toolchain from QorIQ SDK.

3. Make sure you successfully built the kernel for the selected target before attempting to build an external module.

4. Refer to the following links for general information:

https://www.kernel.org/doc/Documentation/kbuild/modules.txt

Compiling Kernel Modules


Have a great day,
Platon

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复