Linux kernel Upgrade

Source: Internet
Author: User

I. Linux kernel overview
Linux is an integrated kernel (monolithic kernel) system.
The device driver has full access to the hardware.
Device drivers within Linux can be conveniently set up in a modular (modularize) format and can be mounted or unloaded directly while the system is running.

1. Linux kernel
The Linux operating system is a low-level support software used to deal with hardware and provide a limited set of services for user programs.
A computer system is a kind of hardware and software symbiosis, they depend on each other, inseparable.
A computer's hardware that contains peripherals, processors, memory, hard disks, and other electronic devices that compose a computer's engine.
But there is no software to operate and control it, itself is not working.
The software that completes this control is called the operating system, which is called the "kernel" in the terminology of Linux, and can also be called "core".

The main modules (or components) of the Linux kernel are divided into the following sections:
. Progress management (Process management)
. Timers (timer)
. Interrupt Management (Interrupt management)
. Memory Management (Management)
. Module management (Modules management)
. Virtual file System interface (VFS layer)
. FileSystem (File System)
. Device drivers (Devices driver)
. interprocess communication (inter-process communication)
. Network Management (Management
. Implementation of operating system functions such as System init.

2. Linux kernel version number
The Linux kernel uses three different version numbering methods.
. The first method is used before the 1.0 version (including 1.0).
The first version is 0.01, followed by 0.02, 0.03, 0.10, 0.11, 0.12, 0.95, 0.96, 0.97, 0.98, 0.99, and after 1.0.
.The second method is used after 1.0 to 2.6, the number consists of three parts "A.B.C", A represents the major version number, B represents the minor major version number, and C represents the minor last version number。
Only when the kernel has changed greatly (historically only two times, 1994 of 1.0, 1996 2.0), a has changed.
The number B can be used to determine whether Linux is stable, even b for the stable version, and the odd B for the development version. C for some bug fixes, security updates, new features and number of drives。
In version 2.4.0, for example, 2 represents the major version number, 4 represents the minor version number, and 0 represents a minor change in the last version number.
In the version number, the second digit of the ordinal is an even version indicating that this is a stable version that can be used, such as 2.2.5;
The second odd version of the ordinal is usually a few new things to join, it is not necessarily a stable test version, such as 2.3.1.
This stable version is derived from the previous beta upgrade version number, and a stable version is not developed until it is fully mature.
. The third way, starting with the 2.6.0 version of 2004, is to use a "time-based" approach.
Prior to version 3.0, it was a "a.b.c.d" format.
In seven years, the first two digits a.b namely "2.6" remain unchanged, c with the release of the new version of the increase, d for some bug fixes, security updates, add new features and the number of drivers.
After version 3.0 is the "A.B.C" format, B increases with the release of the new version, and C represents some bug fixes, security updates, new features, and number of drives.
The third method does not use even numbers for stable version, odd for the development version of the naming method.
For example: 3.7.0 is not a development version, but a stable version!


Second, the kernel upgrade strategy
1. View the Linux kernel version:
# Uname-r
2.6.18-194.el5

2. Download the new kernel version:
Go to the official website to download the latest kernel version and corresponding patches:
https://www.kernel.org/
I chose Linux-3.10.99.tar.xz.
# Wget-c https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.10.99.tar.xz

3. Unzip
Copy the required files to the/USR/SRC and unzip them.
( Note: If there is not enough space under the/USR/SRC, the source file will be the same in the other directory )

Unzip the file to/usr/src/kernels
# TAR-XVF linux-3.10.99.tar.gz-c/usr/src/kernels

4. Upgrade ncurses

# Yum install-y ncurses-devel

# Yum install-y BC

5. Configure the kernel via Menu mode

# cd/usr/src/kernels/linux-3.10.99

# Make menuconfig

Be sure to tick (enter Y to select, m to compile as module)
A, general setup→[*] enable deprecated SYSFS features to support old userspace tools
B, Processor type and features→highmemory support.
C. Locate the following check options and select:
Networking support→networking Options→network Packet filtering framework (NetFilter)
(1) Corenetfilter Configuration
. Tick "NetFilter Connection tracking support"-m state related module is dependent on it, not selected.
. The NetBIOS Name Service protocal support (new) is compiled into a module, otherwise an error occurs when the iptables is started after the upgrade
. Tick "NetFilter xtables support (required for ip_tables)"

(2) Ip:netfilter Configuration
. Compile "IPV4 connection tracking support (require for NAT)" into a module.
. Ching IP Tables Support (required for filtering/masq/nat).
. Compile "Masquerade target support" and "REDIRECT target" into modules under "full NAT"

6. Compiling and installing the kernel
# Make clean//clear the target file under kernel compilation
# make Bzimage//Generate kernel files
# make modules//encoding module
# make Modules_install//install module
# make install//install

7. Edit boot menu Options Grub file

Change Default=1 to Default=0

Then, after restarting the machine, verify that the upgrade was successful.

Iii. Errors encountered in kernel compilation and solutions
error One,Error message at compile time
In file included From/usr/include/sys/time.h:31,
From/usr/include/linux/input.h:12,
From samples/hidraw/hid-example.c:14:
/usr/include/sys/select.h:78:error:conflicting types for ' fd_set '
/usr/include/linux/types.h:12:error:previous declaration of ' Fd_set ' is here
In file included From/usr/include/linux/input.h:14,
From samples/hidraw/hid-example.c:14:
/usr/include/sys/types.h:46:error:conflicting types for ' loff_t '
/usr/include/linux/types.h:30:error:previous declaration of ' loff_t ' is here
/usr/include/sys/types.h:62:error:conflicting types for ' dev_t '
/usr/include/linux/types.h:13:error:previous declaration of ' dev_t ' is here
In file included from/usr/include/sys/types.h:133,
From/usr/include/linux/input.h:14,
From samples/hidraw/hid-example.c:14:
/usr/include/time.h:105:error:conflicting types for ' timer_t '
/usr/include/linux/types.h:22:error:previous declaration of ' timer_t ' is here
In file included From/usr/include/linux/input.h:14,
From samples/hidraw/hid-example.c:14:
/usr/include/sys/types.h:198:error:conflicting types for ' int64_t '
/usr/include/linux/types.h:98:error:previous declaration of ' int64_t ' is here
/usr/include/sys/types.h:204:error:conflicting types for ' u_int64_t '
/usr/include/linux/types.h:97:error:previous declaration of ' u_int64_t ' is here
In file included From/usr/include/linux/input.h:14,
From samples/hidraw/hid-example.c:14:
/usr/include/sys/types.h:235:error:conflicting types for ' blkcnt_t '
/usr/include/linux/types.h:114:error:previous declaration of ' blkcnt_t ' is here
Samples/hidraw/hid-example.c:15:26:error:linux/hidraw.h:no such file or directory
samples/hidraw/hid-example.c:in function ' main ':
Samples/hidraw/hid-example.c:48:error:storage size of ' rpt_desc ' isn ' t known
Samples/hidraw/hid-example.c:49:error:storage size of ' info ' isn ' t known
Samples/hidraw/hid-example.c:65:error: ' Hidiocgrdescsize ' undeclared (first use of this function)
Samples/hidraw/hid-example.c:65:error: (Each undeclared identifier was reported only once
Samples/hidraw/hid-example.c:65:error:for each function it appears in.)
Samples/hidraw/hid-example.c:73:error: ' Hidiocgrdesc ' undeclared (first use of this function)
Samples/hidraw/hid-example.c:84:warning:implicit declaration of function ' Hidiocgrawname '
Samples/hidraw/hid-example.c:91:warning:implicit declaration of function ' Hidiocgrawphys '
Samples/hidraw/hid-example.c:98:error: ' Hidiocgrawinfo ' undeclared (first use of this function)
samples/hidraw/hid-example.c:49:warning:unused variable ' info '
samples/hidraw/hid-example.c:48:warning:unused variable ' rpt_desc '
samples/hidraw/hid-example.c:in function ' bus_str ':
Samples/hidraw/hid-example.c:171:error: ' Bus_virtual ' undeclared (first use of this function)
MAKE[2]: * * * [samples/hidraw/hid-example] Error 1
MAKE[1]: * * * [Samples/hidraw] Error 2
Make: * * * [vmlinux] Error 2

Solution:
# CP include/linux/hidraw.h/usr/include/linux/
# CP include/linux/hid.h/usr/include/linux/
# vim Samples/hidraw/hid-example.c
(under Linux, the compiler sometimes encounters this problem, which seems to be a legacy of Linux history:
Bring all of the # include <sys/xxx.h> to the front, put the inclusion of # include <linux/xxx.h> behind, and you can compile and pass,
The problem with polygons is that there are circular references. )
Move the following 3 lines of 13-15 rows to 33 rows later.
#include <linux/types.h>
#include <linux/input.h>
#include <linux/hidraw.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
"Save and Exit"

#vim/usr/include/linux/input.h
Line 647
#define BUS_PCI 0x01
#define BUS_ISAPNP 0x02
#define BUS_USB 0x03
#define Bus_hil 0x04
#define Bus_bluetooth 0x05
/* The following behavior is new */
#define Bus_virtual 0x06
#define BUS_ISA 0x10
#define BUS_I8042 0x11
#define BUS_XTKBD 0x12
#define BUS_RS232 0x13
#define Bus_gameport 0x14
#define Bus_parport 0x15
#define Bus_amiga 0x16
#define BUS_ADB 0x17
#define BUS_I2C 0x18
#define Bus_host 0x19
#define BUS_GSC 0x1A

/* The following two behaviors are added */
#define Bus_atari 0x1B
#define BUS_SPI 0x1C
"Save and Exit"
re-compile;

Error Two:
Error tip: Kernel Panic-not syncing:vfs:unable to mount Root fs on Unkown-block (0,0)
Error Analysis: The initrd-*.*.img file has a problem; the real root filesystem was not mounted successfully.
WORKAROUND: Please confirm that the make install command was executed and I wasted a week for not executing this command

Error Three:
Error message: Create root device mkrootdev:label/not found
Mountingrootfilesystem
Mount:error2 mounting ext3
Mount:error 2mountingnone
Switch Root Mount Failed:22
Umount/initrd/dev Failed:2
Kernel panic-not synicncing:attempted to kill Init.
(the error is not a bit long, seemingly wrong many oh, in fact, may be caused by a cause)
Error Analysis:
1. root file system cannot find mount point, modify grub.conf file to root=/dev/*
2, hard drive can not be found, please see your machine's hard disk is the SATA disk, is the same congratulations to you this article is helpful.

Error Resolution:
1., modify the grub.conf file to try, the specific modification point
root=/dev/*
* refers to the mount point of the original system/partition. After the modification, reboot into the new kernel system, it is estimated that the following error will be encountered in nine days:
Mounting root filesystem
MOUNT:ERROR6 mounting ext3
Mount:error 2 Mountingnone
Switchroot Mount Failed:22
Umount/initrd/dev Failed:2
Kernel panic-not synicncing:attempted Tokil linit.
If the misfortune is in my words, please look down.
2, hard drive failed to find, SCSI driver has a problem.
I encountered this problem in the kernel compilation upgrade, the kernel option is selected and selected, the method tried many kinds, the error is still.
Finally, I accidentally chose the correct option to successfully upgrade the kernel.
The specific options are:
Device Drivers--------SCSI
Device Support------SCSI
Low-level drivers----Serial ATA (SATA) support is selected as M,
Then select the appropriate sub-options, I selected the Intel Piix/ich SATA Support (new) after the machine started successfully.

Error Four:
Error TIP: Enforcing mode requested but no policy loaded. Halting now.
Kernel panic-not syncing:attenpted to kill init!
Error Analysis: SELinux is enabled in the original kernel, the new kernel does not have the option to select SELinux and does not start successfully.
Workaround: Modify the grub.conf file and add the enforcing=0 after root=label=/

Error Five:
After compiling the reboot, it appears:
Switchroot:mount failed:22
Umount/initrd/dev Failed:2
Kernel panic-not symcing:attempted to kill init!
The error,

Workaround:
Re-make Menuconfig so config_sysfs_deprecated_v2=y
You can also open the file. config for modification and validation;
Re-execution:
# Make Bzimage
# Make Modules
# Make Modules_install
# make Install
# shutdown-r "Now"

Linux kernel Upgrade

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.