Summary of common errors in compiling Linux kernel under Ubuntu

Summary of common errors in compiling Linux kernel under Ubuntu

Recently, I am doing a major homework for the linux kernel analysis course. It involves the compilation of the kernel. I have encountered many problems. Here is a summary.

● When compiling the kernel and executing the make menuconfig command, it prompts an error fatal error: curses.h: there is no such file or directory

Reason : missing. Because there is a lack of ncurses devel in the ubuntu system, install this package to
solve the problem : execute the command sudo apt-get install libncurses5-dev libssl-dev

● When compiling the kernel and executing the make menuconfig command, it prompts an error fatal error: openssl/opensslv.h: there is no such file or directory

Reason : It is also because the corresponding ssl package is missing in the ubuntu system.
Solution : execute the command sudo apt-get install build-essential openssl

● When compiling the kernel and executing the make menuconfig command, it prompts an error /bin/sh: 1: flex: not found

Reason : flex and bison compilation tools are not installed.
Solution : execute the command sudo apt-get install flex bison

Such errors are due to the lack of various components, so it is recommended to execute the following commands before compiling the kernel to prepare for environment configuration.

sudo apt-get update

sudo apt-get install libncurses5-dev libssl-dev

sudo apt-get install build-essential openssl

sudo apt-get install flex bison

● Cannot copy or cut the folder to other directories, prompting no permission

Reason : There are many folders in the computer, and only the root user has the authority to operate them.
Solution : Use the nautilus file management tool to operate with root privileges.

sudo nautilus

● There is no modification authority to the kernel files, and the forced save command: wq! is also invalid

Reason : Lack of permission to read and write files.
Solution : Use the chmod command to modify the file permissions (666 means that all users have file read and write permissions).

sudo chmod 666 文件名

● When using the apt-get install command to install the software, it prompts "replace the medium, please insert the disk marked xxx into the drive and press the enter key"

Reason : Seeing the prompt should be lack of CD-ROM drive, I also suddenly appeared this error
solution : find the directory /etc/apt/sources.list in the computer, right-click to select other programs, open sources.list with a text editor, and comment out The first line (the beginning of deb cdrom:) is to add a # in front of it to become

#deb cdrom:…

● Error cc1: error: code model kernel does not support PIC mode when compiling the kernel

Reason : Seeing the prompt, it should be that the PIC model is not supported. I am not sure
about the solution : Find the Makefile under the kernel file, and add -fno-pie to the end of the KBUILD_CFLAGS part.
Insert picture description here

Guess you like

Origin blog.csdn.net/GGG_Yu/article/details/113640839