一、安装 OpenSSL
参考 【错误记录】编译 Linux 内核报错 ( fatal error: openssl/opensslv.h: No such file or directory ) 博客 , 编译内核时 , 由于没有安装 OpenSSL 报错 ;
执行
sudo apt-get install libssl-dev
命令 , 安装 OpenSSL ;
安装过程如下 :
root@ubuntu:~/kernel/linux-5.6.14# sudo apt-get install libssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libssl-doc zlib1g-dev
The following NEW packages will be installed:
libssl-dev libssl-doc zlib1g-dev
0 upgraded, 3 newly installed, 0 to remove and 154 not upgraded.
Need to get 2,591 kB of archives.
After this operation, 10.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 zlib1g-dev amd64 1:1.2.8.dfsg-2ubuntu4.3 [167 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libssl-dev amd64 1.0.2g-1ubuntu4.20 [1,347 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libssl-doc all 1.0.2g-1ubuntu4.20 [1,077 kB]
Fetched 2,591 kB in 2s (867 kB/s)
Selecting previously unselected package zlib1g-dev:amd64.
(Reading database ... 212370 files and directories currently installed.)
Preparing to unpack .../zlib1g-dev_1%3a1.2.8.dfsg-2ubuntu4.3_amd64.deb ...
Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4.3) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../libssl-dev_1.0.2g-1ubuntu4.20_amd64.deb ...
Unpacking libssl-dev:amd64 (1.0.2g-1ubuntu4.20) ...
Selecting previously unselected package libssl-doc.
Preparing to unpack .../libssl-doc_1.0.2g-1ubuntu4.20_all.deb ...
Unpacking libssl-doc (1.0.2g-1ubuntu4.20) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4.3) ...
Setting up libssl-dev:amd64 (1.0.2g-1ubuntu4.20) ...
Setting up libssl-doc (1.0.2g-1ubuntu4.20) ...
root@ubuntu:~/kernel/linux-5.6.14#
二、安装其它依赖库
编译 Linux 内核还需要安装如下软件包或依赖库 :
- gcc
- libncurses5-dev
- build-essential
- kernel-package
- libssl-dev
- kernel-source-**
- libc6-dev tk8.*
- fakeroot
- bin86
执行
sudo apt-get install gcc libncurses5-dev build-essential kernel-package libssl-dev kernel-source-** libc6-dev tk8.* fakeroot bin86
命令 , 安装上述 9 9 9 个依赖库 ;
三、Linux 内核编译完成
在 Linux 内核源码根目录中 , 执行
sudo make
命令 , 等待几小时后 , 在最后打印出如下内容 , 期间没有报错 , 即表示编译完成 ;