从官方下载了Linux kernel源码进行编译,遇到如下错误:
cc1: error: code model kernel does not support PIC mode
解决办法:在参数处添加 -fno-pie
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-gnueabihf-
# Architecture as present in compile.h
UTS_MACHINE := $(ARCH)
SRCARCH := $(ARCH)
和
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
-std=gnu89 -fno-pie