Upgrade Ubuntu 10.04 with 2.6.32 kernel to 3.0 kernel graphic tutorial, 10.042.6.32
1. Complete the following practical work and screenshot the practice steps: 1) download and install the Virtual Machine VMWare Workstation; 2) install Linux2.x on the virtual machine; 3) Compile the Linux 2. upgrade x Kernel to Linux 3.x.
1) install VMware Workstation 11.1.0.
2) install Ubuntu 10.04 LTS (ubuntu-10.04-desktop-i386.iso) in the virtual machine, whose Linux kernel version is 2.6.32.
3) download the new version 3.0.0 kernel from kernel.org, compile and install it on Ubuntu10.04, and then upgrade it to the 3.0.0 kernel.
2. answer the following questions when completing Question 3:
1) What are the main source code directories of the kernel and what are the main management functions under each directory?
/Arch: the directory contains all the core Code related to the architecture. Each subdirectory under it represents a Linux-supported architecture. For example, i386 is the subdirectory of the Intel cpu and its compatible architecture. Generally, PCs are based on this directory.
/Documentation: There are some documents in the directory without kernel code. Unfortunately, they are all in English, which is a detailed description of the role of each directory.
/Drivers: the directory contains all the device drivers in the system. It is further divided into several types of device drivers, each with corresponding sub-directories, such as the driver of the sound Card corresponding to/drivers/sound; the block is a block device driver, for example, ide (ide. c ). If you want to check how all devices that may contain a file system are initialized, you can check device_setup () in/drivers/block/genhd. c (). It not only initializes the hard disk, but also the network. Others: for example, Lib stores the core library code; Net, core and network-related code; Ipc, which contains the code for inter-process communication between the core; Fs, all File System Code and various types of file operation code. Each subdirectory of the Code supports a file system, such as fat and ext2.
/Fs: Directory stores the file system code supported by Linux and various types of file operation code. Each subdirectory supports a file system. For example, the ext3 file system corresponds to the ext3 subdirectory.
/Include: the directory contains most of the header files required for compiling the core. For example, if the header files related to the platform are in the/include/linux subdirectory, header files related to intel cpu are in the/include/asm-i386 subdirectory, while the/include/scsi directory is the header file directory for the scsi device.
/Init: the directory contains the core initialization Code (not the System Boot Code), including the main. c and Version. c files. This is a good starting point for studying how to work.
/Ipc: the directory contains the communication code between core processes.
/Kernel: Core code of Kernel management. The files in this directory implement Kernel functions of most linux systems. The most important files are sched. c. At the same time, the Code related to the processor structure is stored in the/arch/*/kernel directory.
/Lib: the directory contains the core library code, but the library Code related to the processor structure is stored in the/arch/*/lib/directory.
/Mm: The directory contains all memory management code independent of the cpu architecture, such as page-based storage management memory allocation and release. The Memory Management Code related to the specific hardware architecture is located in the/arch/*/mm directory, for example,/arch/i386/mm/Fault. c.
/Net: the directory contains the core network code and implements various common network protocols. Each subdirectory corresponds to one aspect of the network.
/Scripts: the directory contains the script files used to configure the core.
/Block: block Device Driver I/O scheduling.
/Crypto: Common encryption and hash algorithms (such as AES and SHA), as well as some compression and CRC verification algorithms.
/Security: mainly includes the SELinux module.
/Sound: the core driver code of ALSA, OSS audio device, and common device drivers.
/Usr: Implements cpio for packaging and compression.
2) What software packages are required for Kernel upgrade?
Compile the Kernel used: gcc, libncurses5-dev
Used to download the Kernel File: wget
Run tar to decompress the kernel source code.
3) how to compile the kernel?
Step 1: Configure
Sudo make menuconfig
The preceding command is used to configure the Linux kernel. Once the command is executed, a window is displayed, which contains a menu list. You can select the new configuration option. If you are not familiar with the configuration, you only need to go to the File systems menu to check whether the ext4 File system is selected. If not, select it and save the configuration.
Step 2: Compile
Sudo make
The above command is used to compile the Linux kernel. This step takes about 40-50 minutes.
Step 3: Install
Sudo make modules_install install
The above command is used to install the Linux kernel to the system. This command will create some files in the/boot/directory and run the grub command. create a startup item in the cfg file. Check whether the startup Item is correctly created. The files in the/boot/directory are as follows:
System. map-3.0.0
Vmlinuz-3.0.0
Initrd. img-3.0.0
Config-3.0.0
Restart the system and we will enter the new Ubuntu system with Linux kernel.
4) in the compilation process, what are the common problems and solutions?
Problem 1: you do not have sufficient permissions. This is due to the insufficient permissions of the current user. on Ubuntu, you can add sudo to the command to execute the command according to the root permission.
Problem 2: failed to install the software package. This is because the official ubuntu website is abroad and the connection is not easy in China. In this case, you can replace the Ubuntu source to solve the problem, the source configuration file is/etc/apt/sources. list, replace the content in this file with the domestic source address. The source replaced in this article is Netease Ubuntu10.04:
Deb http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse Deb-src http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse Deb http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted The deb-src http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted Deb http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted Deb http://mirrors.163.com/ubuntu/: lucid-proposed universe main multiverse restricted Deb-src http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted Deb http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted Deb-src http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted Deb-src http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted |
5) What problems have you encountered in the compilation process and the final solution? What are the gains?
Problem 1: the command for downloading the kernel is wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.bz2. The connection is interrupted when the kernel is down to half a day.
My solution is to use the thunder software in Windows to download the kernel, and then share the Kernel File to Ubuntu through the samba sharing file mechanism.
Problem 2: The kernel Compilation speed is slow.
My solution is to allocate 6 CPU cores and 3 GB memory to the Virtual Machine in VMware, so that the virtual machine can compile the kernel together with 6 threads, thus significantly accelerating the speed.
Gains:
After this Linux kernel upgrade experiment, I have a better understanding of the Linux kernel compilation and working mechanism, and provided effective guidance for our future Android kernel security reinforcement project.