make module失败的原因cc1: error: unrecognized command line option "-m64"

时间:2022-08-30 00:06:03
[root@localhost 123]# make
make -C /work/cs/YL-9G45/linux-2.6.30  M=/work/rootfs/123 modules
make[1]: Entering directory `/work/cs/YL-9G45/linux-2.6.30'
  CC [M]  /work/rootfs/123/test.o
cc1: error: unrecognized command line option "-m64"
cc1: error: unrecognized command line option "-mno-red-zone"
cc1: error: unrecognized command line option "-mcmodel=kernel"
cc1: error: unrecognized command line option "-maccumulate-outgoing-args"
make[2]: *** [/work/rootfs/123/test.o] 错误 1
make[1]: *** [_module_/work/rootfs/123] 错误 2

make[1]: Leaving directory `/work/cs/YL-9G45/linux-2.6.30'


缺少编译的对象,需要加入ARCH=arm

[root@localhost 123]# make ARCH=arm
make -C /work/cs/YL-9G45/linux-2.6.30  M=/work/rootfs/123 modules
make[1]: Entering directory `/work/cs/YL-9G45/linux-2.6.30'
  CC [M]  /work/rootfs/123/test.o
/work/rootfs/123/test.c:45:7: warning: no newline at end of file
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /work/rootfs/123/test.mod.o
  LD [M]  /work/rootfs/123/test.ko
make[1]: Leaving directory `/work/cs/YL-9G45/linux-2.6.30'