Originally I was trying to include linux/config.h
to compile an old driver from source originated from the 2.6 kernel on the latest 5.8 kernel.
And here's the include part of this driver:
#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h> /* printk() */
#include <linux/fs.h> /* everything... */
#include <linux/types.h> /* size_t */
#include <asm/uaccess.h>
And as per requested, I'm posting the Makefile here:
ifeq ($(KERNELRELEASE),)
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
.PHONY: modules modules_install clean
else
obj-m := my_driver.o
endif
While I tried to compile this driver via gcc the compiler told me that linux/config.h
could not been found.
I was told from the web to use linux/autoconf.h
to replace linux/config.h
but failed.
So I just wanna to know which file should I replace linux/config.h
with to make this driver compiled and run.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…