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 libidn11

apt install bison
apt install flex

常见错误

code model kernel does not support PIC mode

Linux内核编译

解决方法

修改内核源码中的Makefile文件,添加 -fno-pie

Linux内核编译

openssl/opensslv.h: No such file or directory

Linux内核编译

解决措施

下载 libssl-dev

Linux内核编译

Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev or elfutils-libelf-devel

Linux内核编译

解决方案

下载 libelf-dev

Linux内核编译

fatal error: linux/compiler-gcc6.h: No such file or directory

Linux内核编译

解决策略:

wu

Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel

Linux内核编译

解决策略:

apt install libelf-dev

apt install libssl-dev

Linux内核编译

上一篇:用了这么久的linux,man的1-8部分代表啥?


下一篇:guava之cache