I work a lot with kernels because package them in my distro (Parabola), and sometimes some modifications make one single .c file fail to build. However I wanted to know if there's a way to test one of those single .c files to know if it will end up failing when building the whole kernel. For example, let's say that drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c fails to build, so if I manually do:
$ gcc drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
it fails with:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:23:10: fatal error: linux/moduleparam.h: No such file or directory
23 | #include <linux/moduleparam.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
most includes are under the includes
dir, but idk how to make it work. Is it possible to do what I want? and how?