root@ubuntu:/home/steven/Downloads# make
make -C /lib/modules/`uname -r`/build M=/home/steven/Downloads modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-29-generic'
CC [M] /home/steven/Downloads/hello.o
**cc1: error: code model kernel does not support PIC mode**
scripts/Makefile.build:332: recipe for target '/home/steven/Downloads/hello.o' failed
make[2]: *** [/home/steven/Downloads/hello.o] Error 1
Makefile:1552: recipe for target '_module_/home/steven/Downloads' failed
make[1]: *** [_module_/home/steven/Downloads] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-29-generic'
Makefile:13: recipe for target 'modules' failed
make: *** [modules] Error 2
ifneq ($(KERNELRELEASE),)
MODULE_NAME = hellomodule
$(MODULE_NAME)-objs := hello.o
obj-m := $(MODULE_NAME).o
else
KERNEL_DIR = /lib/modules/`uname -r`/build
MODULEDIR := $(shell pwd)
.PHONY: modules
default: modules
modules:
make -C $(KERNEL_DIR) M=$(MODULEDIR) modules
clean distclean:
rm -f *.o *.mod.c .*.*.cmd *.ko
rm -rf .tmp_versions
endif
有人可以帮我解决这个问题吗?