我正在尝试构建linux外部模块。该模块可以使用禁止的警告(即带有编译器标志-Wno-pointer-sign
和-Wno-unused-but-set-variable
)编译正常,但是modpost失败(显然是因为有警告),并显示以下消息:
Building modules, stage 2.
MODPOST 1 modules
CC ../../../vendor/qcom/opensource/wlan/qcacld-2.0/wlan.mod.o
In file included from /lineage/kernel/samsung/universal7880/include/linux/kobject.h:21:0,
from /lineage/kernel/samsung/universal7880/include/linux/module.h:16,
from ../../../vendor/qcom/opensource/wlan/qcacld-2.0/wlan.mod.c:1:
/lineage/kernel/samsung/universal7880/include/linux/sysfs.h: In function 'sysfs_get_dirent':
/lineage/kernel/samsung/universal7880/include/linux/sysfs.h:457:37: error: pointer targets in passing argument 2 of 'kernfs_find_and_get' differ in signedness [-Werror=pointer-sign]
return kernfs_find_and_get(parent, name);
^
In file included from /lineage/kernel/samsung/universal7880/include/linux/sysfs.h:15:0,
from /lineage/kernel/samsung/universal7880/include/linux/kobject.h:21,
from /lineage/kernel/samsung/universal7880/include/linux/module.h:16,
from ../../../vendor/qcom/opensource/wlan/qcacld-2.0/wlan.mod.c:1:
/lineage/kernel/samsung/universal7880/include/linux/kernfs.h:411:1: note: expected 'const char *' but argument is of type 'const unsigned char *'
kernfs_find_and_get(struct kernfs_node *kn, const char *name)
^
cc1: all warnings being treated as errors
/lineage/kernel/samsung/universal7880/scripts/Makefile.modpost:113: recipe for target '../../../vendor/qcom/opensource/wlan/qcacld-2.0/wlan.mod.o' failed
make[2]: *** [../../../vendor/qcom/opensource/wlan/qcacld-2.0/wlan.mod.o] Error 1
/lineage/kernel/samsung/universal7880/Makefile:1437: recipe for target 'modules' failed
make[1]: *** [modules] Error 2
make[1]: Leaving directory '/lineage/out/target/product/a5y17lte/obj/KERNEL_OBJ'
Makefile:145: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
make: Leaving directory '/lineage/kernel/samsung/universal7880'
#### make failed to build some targets (02:46 (mm:ss)) ####
如何在modpost中禁止显示警告?