【P1010】 How to compile kernel module

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

【P1010】 How to compile kernel module

Jump to solution
1,519 Views
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 Kudos
Reply
1 Solution
1,257 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
1 Reply
1,258 Views
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 Kudos
Reply