Linux内核编译
Linux内核编译
国内源下载链接:
http://ftp.sjtu.edu.cn/sites/ftp.kernel.org/pub/linux/kernel/
基本步骤
-
make mrproper
-
make clean
-
make oldconfig
-
make bzImage
-
make modules
-
make modules_install
可选参数: -j4 -> 使用4核编译
可事先安装几个工具包:
sudo apt-get install libncurses5-dev libssl-dev
sudo apt-get install build-essential openssl
sudo apt-get install zlibc minizip
sudo apt-get install libidn11-dev libidn11apt install bison
apt install flex
常见错误
code model kernel does not support PIC mode
解决方法
修改内核源码中的Makefile文件,添加 -fno-pie
openssl/opensslv.h: No such file or directory
解决措施
下载 libssl-dev
Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev or elfutils-libelf-devel
解决方案
下载 libelf-dev
fatal error: linux/compiler-gcc6.h: No such file or directory
解决策略:
wu
Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel
解决策略:
apt install libelf-dev
apt install libssl-dev