linux内核编译

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux内核编译相关的知识,希望对你有一定的参考价值。

编译时,提示如下错误和警告,请问是什么原因,该如何才能解决呢?
/arm2410/kernel/include/linux/mtd/nand_ids.h:55: warning: `nand_smc_info' defined but not used
make[4]: *** [nand.o] Error 1
make[4]: Leaving directory `/arm2410/kernel/drivers/mtd/nand'
make[3]: *** [first_rule] Error 2
make[3]: Leaving directory `/arm2410/kernel/drivers/mtd/nand'
make[2]: *** [_subdir_nand] Error 2
make[2]: Leaving directory `/arm2410/kernel/drivers/mtd'
make[1]: *** [_subdir_mtd] Error 2
make[1]: Leaving directory `/arm2410/kernel/drivers'
make: *** [_dir_drivers] Error 2

错误已经给你指出来了那:
nand_ids.h:55: warning: `nand_smc_info\' defined but not used
“nand_smc_info”定义了,但不能使用。

你可以到nand_ids.h去看一下是不是定义错了
参考技术A warning 那句没什么问题,就是你定义了,没用上。就怕你写成这样,你用的时候不是这样,是不是书写失误啊!!!

Linux 内核编译 Linux 内核 ⑥ ( 安装 OpenSSL | 安装其它依赖库 | 内核编译完成 )

文章目录





一、安装 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

命令 , 等待几小时后 , 在最后打印出如下内容 , 期间没有报错 , 即表示编译完成 ;

以上是关于linux内核编译的主要内容,如果未能解决你的问题,请参考以下文章

linux编译内核步骤

Linux内核源码如何编译

编译linux内核问题

编译linux-2.6.18内核出错

Linux 内核编译 Linux 内核 ③ ( 安装 ncurses | 安装 flex | 安装 bison | 打开 Linux 内核编译配置菜单 )

如何重新编译linux内核