问题描述
我想重定向模块构建的输出,以将工件与源代码分开.
I'd like to redirect the output of my module build to segregate the artifacts from the source.
我的makefile如下:
My makefile looks like:
obj-m += hello-1.o
all:
make ARCH=arm CROSS_COMPILE=arm-eabi- -C /work/TI-Android-ICS-4.0.3_AM37x_3.0.0/kernel M=$(PWD) modules
clean:
make ARCH=arm CROSS_COMPILE=arm-eabi- -C /work/TI-Android-ICS-4.0.3_AM37x_3.0.0/kernel M=$(PWD) clean
这正常工作,除了模块输出恰好在我的源目录中.我尝试在每行中添加O = {我的输出目录的路径},但后来却无法通过类似...的方式构建.
This works correctly, except that the module output happens to be in my source directory. I tried adding O={path to my output dirctory} in each line, but then it failed to build with something like...
警告:符号版本转储 /work/development/linux/driver/blah/Module.symvers 不见了;模块将没有依赖关系和modversions.
WARNING: Symbol version dump /work/development/linux/driver/blah/Module.symvers is missing; modules will have no dependencies and modversions.
我认为这是基于以下事实:模块构建中使用了内核构建中的一些输出文件,并使用"O =更改了输出目录.
I assume this stems from the fact that there is some output file from the kernel build that's used in the module build, and changing the output directory with "O=" collides with that.
是否有一种方法可以使用现有的构建基础架构来完成此任务?
Is there a method for accomplishing this using the existing build infrastructure?
推荐答案
此Makefile将解决您的查询
This Makefile will solve your query
obj-m += hello-1.o
all:
make ARCH=arm CROSS_COMPILE=arm-eabi- -C /work/TI-Android-ICS-4.0.3_AM37x_3.0.0/kernel M=$(PWD) modules_install INSTALL_MOD_PATH=<output directory for modules>
clean:
make ARCH=arm CROSS_COMPILE=arm-eabi- -C /work/TI-Android-ICS-4.0.3_AM37x_3.0.0/kernel M=$(PWD) clean
这篇关于重定向linux模块构建的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!