1, complete the following practical work, and screenshots Instructions practice steps: 1) Install the virtual machine VMware workstation;2) in the virtual machine installed linux2.x; 3) upgrade the Linux 2.x kernel to Linux 3.x by self-compiling.
1) Install the VMware Workstation 11.1.0.
2) Install Ubuntu 10.04 LTS (Ubuntu-10.04-desktop-i386.iso) in the virtual machine with a Linux kernel version of 2.6.32.
3) Download the new 3.0.0 kernel from kernel.org and install it on Ubuntu10.04 to upgrade to the 3.0.0 kernel.
2, to 1 questions 3) at the same time, to answer the following questions:
1) What is the main source code directory of the kernel, and what is the main implementation of the management in each directory?
/arch: The directory includes all the core code related to the architecture. Each of the subdirectories below represents a Linux-supported architecture, such as i386, a subdirectory of the Intel CPU and its compatible architecture. PC machines are generally based on this directory.
/documentation: The directory is a few documents, no kernel code, unfortunately are Chinese, is the role of each directory specific instructions.
/drivers: All device drivers in the system are in the directory. It is further divided into several types of device drivers, each with a corresponding subdirectory, such as the driver for the sound card corresponding to the/drivers/sound;block block device driver, such as the IDE (IDE.C). If you want to see how all the devices that might contain the file system are initialized, you can look at the Device_setup () in/DRIVERS/BLOCK/GENHD.C. It not only initializes the hard disk, but also initializes it because the network is required to install the NFS file system. Other: For example, Lib places the core library code; NET, core and network-related code; IPC, this directory contains the code for the core interprocess communication; Fs, all file system code and various types of file operation code, each of its subdirectories supports a file system, such as fat and ext2.
/fs: Directory holds Linux supported file system code and various types of file manipulation codes. Each subdirectory supports a file system, such as the ext3 file system that corresponds to the ext3 subdirectory
/include: The directory includes most of the header files needed to compile the core, such as the platform-related header files under the/include/linux subdirectory, the Intel CPU-related header files under the/include/asm-i386 subdirectory, and/include/ The SCSI directory is the header file directory for the SCSI device.
/init: The directory contains the core initialization code (not the system's boot code), there are main.c and version.c two files. This is a good starting point for studying how the core works.
/IPC: The directory contains the communication code between the core processes.
/kernel: Kernel Management Core Code, the file in this directory implements the kernel functions of most Linux systems, the most important of which is SCHED.C, and the processor structure-related code is placed in the/arch/*/kernel directory.
/lib: The directory contains the core library code, but the library code associated with the processor structure is placed in the/arch/*/lib/directory.
/MM: The directory contains all the memory management code that is independent of the CPU architecture, such as the allocation and deallocation of page storage management memory. The memory management code associated with the specific hardware architecture is located in the/arch/*/mm directory, such as/ARCH/I386/MM/FAULT.C.
/net: The directory is the core of the network part of the Code, the implementation of a variety of common network protocols, each of its subdirectories corresponds to one aspect of the network.
/scripts: directory contains script files for configuration core, etc.
/block: Block device driver I/O scheduling.
/crypto: Commonly used encryption and hashing algorithms (such as Aes,sha, etc.), there are some compression and CRC check algorithms.
/security: mainly includes SELinux module.
Drive core code and common device drivers for/sound:alsa,oss audio devices.
/usr: Cpio for packaging and compression are implemented.
2) What are the necessary packages required for kernel upgrade?
Compiled kernel used: gcc, Libncurses5-dev
Download the kernel file for: wget
Unzip the kernel source code using: Tar
3) What are the steps to compile the kernel?
First step: Configure
sudo make Menuconfig
The above command is used to configure the Linux kernel, once the command is executed, the screen will pop up a window, which is a list of menus, we can choose the new configuration options, if not familiar with the configuration, we only need to enter the file Systems menu item to confirm that the EXT4 filesystem is selected, If it is not selected, select it and save the configuration.
Step Two: Compile
sudo make
The above command is used to compile the Linux kernel, this step takes time, about 40-50 minutes.
Step Three: Install
sudo make Modules_install install
The above command is used to install the Linux3.0 kernel into the system, the command will create some files in the/boot/directory, and will establish a startup item in the Grub.cfg file, we can check whether the startup item is created correctly, the file under the/boot/directory is as follows:
system.map-3.0.0
vmlinuz-3.0.0
initrd.img-3.0.0
config-3.0.0
Reboot the system and we will enter the new Linux3.0 core Ubuntu system.
4) What are the common problems encountered during the compilation process, and what are the workarounds?
Issue 1: Not enough permissions, this is due to insufficient current user rights, on Ubuntu can be by adding sudo in front of the command to follow the root permission to execute the command.
Issue 2: Installation package failed, this is due to the official Ubuntu website abroad, the domestic generally not easy to connect successfully, this can be resolved by replacing the Ubuntu source, the source configuration file is/etc/apt/ Sources.list, replace the contents of this file with the domestic source address. The source of the replacement in this article is NetEase Ubuntu10.04 Source:
Deb Http://mirrors.163.com/ubuntu/lucid main Universe restricted multiverse de B-SRC http://mirrors.163.com/ubuntu/lucid main Universe restricted multiverse Deb http://mirrors.163.com/ Ubuntu/lucid-security Universe main Multiverse restricted 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 actually encountered during the compilation process, and what are the final solutions? What is the harvest?
Issue 1: Download kernel command: wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.bz2, often down to half of the connection is interrupted.
My solution is to use the Thunder software under Windows to download the kernel, and then share the kernel files with the Samba file system in Ubuntu.
Issue 2: Kernel compilation speed is slow.
My solution is to allocate 6 CPU cores and 3GB of memory to the virtual machine in VMware, so that the virtual machine can be compiled with 6 threads together for a significant speed increase.
Harvest:
After the Linux kernel upgrade experiment, I have a better understanding of the Linux kernel compiling and working mechanism, and provide effective guidance for our future security hardening project of Android kernel.
Upgrade Ubuntu 10.04 with 2.6.32 kernel to 3.0 kernel graphics tutorial