Re-flashing the core of the android device. Overview of the features of the core of android 3.10 65 kernel version

On Sunday evening, Linus Torvalds, the parent of Linux and the developer of the operating system kernel, after two months of work, announced the release of a new version of the Linux kernel 3.10.

According to the developer himself, this core turned out to be the largest in terms of volume of innovations over the past few years.

Linus admitted that at first he intended to release another release candidate, but after hesitating, he inclined to release the final release at once under number 3.10. Also Torvalds in his message, he noticed that the new kernel, like version 3.9, is completely ready for everyday use.

In addition, in the announcement of the RC version of the kernel, Linus Torvalds wrote that earlier he always included a list of the names of people who sent certain parts of the code, but this time this list would be so large that it could not be given in its entirety in one sheet. mailings.

A list of the main changes made to the 3.10 kernel:

  • Now it is possible to prohibit execution of scripts as programs - the functionality of launching scripts containing the path to the interpreter in the header "#!" Can now be compiled as a kernel module;
  • The Bcache system developed and used by Google has been integrated. Bcache allows you to organize caching of access to slow hard drives on fast SSD-drives; in this case, caching is carried out at the level of a block device - and this allows you to speed up access to the drive, and regardless of the file systems used on the device;
  • The kernel can be built with the Clang compiler thanks to the patches prepared by the LLVMLinux project;
  • A dynamic control system for the generation of interrupts by the timer has appeared. Now, depending on the current state, you can change interrupts in the range from thousands of ticks per second to one interrupt per second - this allows you to minimize the load on the CPU when processing interrupts in case of system inactivity. Now this feature is used for real-time systems and HPC (high performance computing), but in the next kernel releases it will be used for desktop systems too;
  • Now it is possible to generate an event notifying the application about the approach to the exhaustion of the memory available to the process / system (in cgroups);
  • For the perf command, memory access profiling is now available;
  • Added support for the RDMA protocol (iSER) to the iSCSI subsystem;
  • There is a new driver "sync" (experimental). It was developed within the Android platform and is used for synchronization between other drivers;
  • The QXL virtual graphics card driver was integrated (used in virtualization systems for accelerated graphics output using the SPICE protocol);
  • New power management features introduced in AMD 16h ("Jaguar") processor families are now supported;
  • Support for accelerating video decoding using the hardware UVD decoder built into modern AMD GPUs has been added to the Radeon DRM module;
  • A driver for Microsoft Hyper-V virtual video adapters has appeared (there are also improvements for Hyper-V in general);
  • The execution of cryptographic functions (sha256, sha512, blowfish, twofish, serpent and camellia) is optimized using AVX / AVX2 and SSE instructions.

Users of mobile devices are not always satisfied with the work and capabilities of their gadgets. For this reason, users are looking for the best way to flash the kernel of the Android operating system. On the one hand, this action can be easily done with your tablet or smartphone. Thousands of users have successfully flashed the kernel without any complications or problems. But, on the other hand, any mistake during this process can lead to, among which is the failure of the gadget and the need for expensive service. At different stages, there is a risk of choosing the wrong version of the kernel firmware, which was created by unqualified developers, or does not fit your mobile device. We recommend that you be extremely careful when carrying out any actions that make changes to the software part of the device at a low level. After successfully flashing the kernel, many have the feeling that they are holding a completely new device in their hands. Advanced users can thus customize the gadget to suit their needs and preferences, while gaining new knowledge and experience about modern mobile technologies.

The core of the Android operating system and its firmware

What is the core of a mobile device?

The operating system kernel is the backbone of the software that manages the hardware of the device. The main parameters of any gadget depend on it. It should be noted that it consists of three interconnected components - the Linux kernel, the vertical Dalvik machine, and various low-level services and libraries. If we are talking about custom firmware, then only two components are affected, which allow you to add new system services, optimize existing parameters and change the graphical shell.

Those wishing to install a kernel on Android should understand that there is a difference between the concepts of custom kernel and custom firmware. The latter is an unofficial version of the software. Custom firmware was developed by a team of specialists for specific devices. The custom kernel is based on the Linux kernel and is an unofficial version of it. Often a custom kernel comes bundled with the firmware. But it can be installed separately after changing the firmware. In fact, it does not replace the native core of a mobile device, which is the ultimate goal of such an operation.

Android kernel firmware is mainly done to increase device runtime by several hours by adjusting power settings. Perhaps this is the main reason why users carry out complex software transformations of their gadgets. The firmware will allow you to change the video chip without affecting your smartphone or tablet. Advanced users in this way customize the work of the screen, changing its color rendition, sensitivity. Kernel firmware allows you to improve the sound of the device, update drivers and implement support for non-standard external gadgets.

Before flashing the kernel, we recommend that you make sure that you have chosen a good version, which was created by experienced developers. In addition, it is important to make sure that it matches your Android firmware version. It is advisable to read the reviews of people who managed to install a suitable version of the kernel on their mobile phone. Reviews may contain important information about problems that may arise at the stage of firmware or further operation of the device.

Gadget firmware via Fastboot

You can reflash your Android device via Fastboot. But first, you need to install the utility on your gadget. There are two versions of this program. The first involves downloading Fastboot in conjunction with the official Android SDK program. The second version involves downloading the utility separately.

We recommend checking if your mobile device sees a laptop or a computer. To do this, you need to execute. After downloading and installing on a computer, laptop running on the Windows operating system, the Fastboot utility and connecting the smartphone, you must open the command line. To do this, open Search. In Windows 8, all you need to do is move the mouse cursor to the right side of the screen and select the appropriate section. In the Search, you must enter "cmd", after which a command line will appear in front of you. The device should be put into firmware mode. Next, enter a command that will test the interaction between the computer and the mobile device:

fastboot devices

If everything works, you need to load the correct version of the kernel firmware boot.img. We do not recommend reflashing the original firmware kernel, as this can lead to problems in the smartphone's operation. The file should be saved to a previously created partition on the C drive called "Android". After that, you need to load your mobile device into Fastboot and connect it to your computer. The message “Fastboot USB” will appear on the screen.

  • cd C: \ Android.
  • fastboot flash boot boot.img.
  • fastboot erase cache.
  • fastboot reboot.

It is very important to enter all words correctly, taking into account case and spaces. The cd command opens the required folder containing the required files. After that, a flashing occurs. The fastboot erase cache command deletes the Cache partition. The last command is fastboot reboot, which reboots the device from firmware mode to normal. If you performed all the indicated actions correctly, then the process will be successful.

Firmware with ClockworkMod Recovery

ClockworkMod Recovery (or CWM for short) is a recovery system that is used instead of the original factory Recovery. CWM allows you to install new firmware on a mobile device, flash the kernel, back up files and restore the shell. Such a system is able to work with firmware update files in a zip format. ClockworkMod is installed in, replacing the factory Recovery. To launch CWM, you need to know the key combination that suits your gadget. In most cases, this is a combination of volume down and power on buttons that should be pressed while the device boots up.

To flash the kernel, download the archive with the zip extension. It must contain the META-INF folder. Then there are two options. In the first case, you need to specify the firmware file. The second option involves placing the firmware file in the / sdcard folder. After that, you should activate ClockworkMod Recovery, find the Apply update from sdcard function there and specify the required file.

It should be noted that the ClockworkMod Recovery menu is convenient and understandable for most users. In addition to such a recovery system for firmware, you can use TWRP Recovery. This tool is convenient and popular among Android users. The main thing is to choose the correct firmware file.

Android kernel firmware is a procedure that we do not recommend resorting to if you are completely satisfied with the work of the gadget. Such actions are driven by the desire to improve the performance of a mobile phone or tablet. Advanced users get the ability to set parameters at a lower level. But without certain knowledge and objective reasons, it is better not to change the software part of the mobile device, since this is associated with risk and failures in its operation.

“And I… wash the carburetor!”
Joke

Introduction

In kindergarten, we with like-minded people dissected grasshoppers in the hope of understanding their structure. At school, the radio receiver "Russia" was soldered. At the institute, the turn came to cars, the nuts of which were repeatedly rearranged. Interests have changed, but the desire to “disassemble” sometimes wakes up, and today it is directed towards Android.

How many times have you been rescued by the availability of Android sources? Me - no longer count. Android is an open source project, but unfortunately we only have the ability to read; it is almost impossible to edit Android code without being a Google employee. Let's be sad about this moment and download the repository. How to do this is perfectly described on the official website.


General architecture

The architecture of Android can be schematically depicted as follows:

Desktop computers and laptops have a well-established system of energy modes (x86 processors have several): the computer runs "at full speed" when something is done, and goes into energy efficient mode when the system is idle. Going into "sleep" mode occurs either after a fairly long period of inactivity, or manually, for example, when closing the laptop lid.

On phones, a different mechanism was required: the main state of the system is “hibernation”, the exit from it is carried out only in cases of need. Thus, the system can fall asleep, even if some application is active. In Android, a wakelock mechanism was implemented: if an application (or a driver) does something important that must reach its logical conclusion, it “captures” the wakelock, preventing the device from falling asleep.

Attempts to port the wakelock mechanism to the kernel have met with resistance from many developers. Android programmers solved a specific problem, the solution of which was a certain mechanism. The conditions of the problem were very narrow. The target platform is ARM, so its features were used: ARM processors initially assume frequent changes in the "sleep" and "wakeful" modes of operation, in contrast to x86. In Android, applications communicate with the power management system through PowerManager, but what should Linux client applications do?

The Android developers did not even try to find a common solution “for the future”, which would then be merged into the main kernel without any problems, they did not consult the Linux kernel community on this issue. Can you blame them for this? Despite all the problems and discussions, as mentioned above, an API with identical autosleep functionality appeared in the core.

Programmers of applications for Android rarely have to deal with wakelocks, since the platform and drivers process the obligations assigned to them, taking into account the "sleep" mode. However, the familiar PowerManager will help intervene in this process. By the way, only one scenario comes to mind to the author: to prevent the phone from falling asleep when starting the service from the BroadcastReceiver, which is solved by the auxiliary class from the Android Support Library WakefulBroadcastReceiver.

Low memory killer

The standard Linux kernel has Out of Memory Killer, which, based on the badness parameter, determines the process to be killed:

Badness_for_task = total_vm_for_task / (sqrt (cpu_time_in_seconds) *
sqrt (sqrt (cpu_time_in_minutes)))

Thus, the more the process consumes memory and the less it lives, the less lucky it will be.

The diagram shows the general Android logging system. The log driver provides access to each buffer via / dev / log / *. Applications do not access them directly, but through the liblog library. The classes Log, Slog, and EventLog communicate with the liblog library. The adb logcat command shows the contents of the “main” buffer.

Conclusion

In this post, we briefly reviewed some of the features of Android as a Linux system. Some other parts (pmem, RAM console, etc.), as well as such important aspects of the platform as a whole, such as System Service, the process of starting the system, and others, remained outside the brackets. If this topic is interesting, we will consider them in the following articles.

We have already written about custom firmwares, root applications and alternative boot menus. All these are standard topics in the Android hacker community, however, in addition to all of the above, there is also such a thing as a "custom kernel", which can give almost limitless possibilities to control the smartphone and its hardware at the lowest level. In this article I will tell you what it is, why you need it and how to choose the right custom kernel.

Custom kernel?

What is a custom kernel? As we all know, Android is a pie made up of three basic layers: the Linux kernel, a set of low-level libraries and services, and the Dalvik virtual machine, on top of which runs a graphical shell, high-level tools and services, as well as almost all applications installed from the market. The creators of most alternative custom firmware usually only work with the top two layers, adding functions to the graphical shell (for example, buttons in the curtain), changing it (the theme engine in CyanogenMod), as well as adding new system services (equalizer in CyanogenMod) and optimizing existing ones.

The authors of popular firmware also, as far as possible, make changes to the Linux kernel: they optimize (build with more aggressive compiler optimization flags), include new functionality (for example, support for the Windows ball), and also make other changes, such as the ability to raise the processor frequency higher than that provided by the manufacturer ... Often, all this remains behind the scenes, and many users of custom firmware are not even aware of these capabilities, especially since the same CyanogenMod comes with a custom kernel only for a limited range of devices for which both the source code of the native kernel and the possibility of replacing it are available. For example, almost all CyanogenMod firmware for Motorola smartphones use a standard kernel - it is impossible to replace it with your own due to the impenetrable protection of the bootloader.

However, the kernel in smartphones with an unlocked bootloader can be replaced separately from the main firmware. And it's not easy to replace, but to install a kernel with a huge number of different functions that require certain technical knowledge to manage, and therefore are usually not built into the kernels of popular firmware, such as CyanogenMod, AOKP and MIUI. Among these features you can find support for high processor frequencies, screen gamma control, power saving modes, highly efficient power managers and a huge number of other features.

In this article we will talk about what the creators of custom kernels can offer us, consider the main custom kernels for various devices, and also try to install the kernel regardless of the main firmware and check everything on our own skin. So what do alternative kernel developers usually suggest?

Smart traffic controller

The OMAP35XX SoCs used in the Galaxy S II and Galaxy Nexus, for example, have a SmartReflex function that acts as a smart system for adjusting the voltage when the processor load changes. In fact, it eliminates the need for fine tuning of the voltage by the user.


Optimization

Often the main goal of building a custom kernel is to optimize performance. Usually, a mobile technology vendor tries to maintain a balance between performance and stability, so even good optimization techniques that can significantly increase the speed of a device can be rejected by the manufacturer only on the basis that after using them, some applications began to crash every tenth launch. Of course, enthusiasts are not embarrassed by such trifles, and many of them are ready to apply any compiler options, power saving algorithms to the kernel of their own assembly and raise the processor frequency as high as the device can handle. Among all optimization techniques, four are most common:



Another type of optimization: changing the standard I / O scheduler. The situation in this field is even more interesting, since instead of understanding how schedulers work, some kernel builders simply read documents on I / O schedulers for Linux on the Web and draw conclusions. This approach is even more prevalent among users. In fact, almost all the most powerful and smartest Linux schedulers are completely unsuitable for Android: they are designed for use with mechanical data stores, in which the speed of data access varies depending on the position of the head. The scheduler uses different schemes for combining queries depending on the physical location of the data, so queries to data that are close to the current head position will receive higher priority. This is completely illogical in the case of solid-state memory, which guarantees the same speed of access to all cells. Advanced planners will do more harm than good on a smartphone, and the most clumsy and primitive will show the best results. Linux has three such schedulers:

  • Noop (No operation)- the so-called non-scheduler. A simple FIFO queue of requests, the first request will be processed first, the second second, and so on. Well suited for solid-state memory and allows you to fairly prioritize applications for access to the drive. An additional plus: low processor load due to a very simple operating principle. Disadvantage: no consideration of the specifics of the device's operation, which may lead to performance failures.
  • SIO (Simple I / O)- an analogue of the Deadline scheduler without taking into account the proximity of sectors to each other, that is, designed specifically for solid-state memory. There are two main highlights: the priority of read operations over write operations and grouping of operations by processes with the allocation of a slice of time for each process to perform operations. In smartphones, where the speed of the current application is important and the predominance of read operations over write, it shows very good performance. Available in Leankernel, Matr1x core for Nexus 4 and SiyahKernel.
  • ROW (READ Over WRITE)- a scheduler specially designed for mobile devices and added to the kernel just a few months ago. Primary challenge: processing read requests first, but fair timing for write requests as well. Considered the best NAND scheduler at the moment, it is used by default in Leankernel and Matr1x.

It is worth saying that almost all standard firmware and half of the custom ones still use the kernel with the standard Linux CFQ scheduler, which, however, is not so bad, since it knows how to work correctly with solid-state drives. On the other hand, it is too complex, creates a greater load on the processor (and therefore the battery) and does not take into account the specifics of the mobile OS. Another popular choice is the Deadline Scheduler, which is as good as SIO but redundant. You can view the list of available schedulers using the following command:

# cat / sys / block / * / queue / scheduler

To change, apply the following (where row is the name of the scheduler):

# for i in / sys / block / * / queue / scheduler; do echo row> $ 1; done

Some kernel builders use a different kind of I / O optimization as well. This disables the fsync system call, which is used to force the changed contents of open files to be flushed to disk. It is believed that without fsync, the system will access the drive less often and thus save CPU time and battery power. A rather controversial statement: fsync is not used very often in applications and only to save really important information, but disabling it can lead to the loss of this information in the event of an operating system crash or other problems. The ability to disable fsync is available in the franco.Kernel and GLaDOS kernels, and the file / sys / module / sync / parameters / fsync_enabled is used for control, in which you should write 0 to disable or 1 to enable. Again, this feature is not recommended.

Adding new functions to the core

Of course, in addition to optimizations, tweaks and various advanced hardware management systems, you can also find completely new functionality in custom kernels that is not in standard kernels, but which can be useful to users.

These are mainly various drivers and file systems. For example, some kernels include support for the CIFS module to mount Windows balls. Such a module is in the Matr1x kernel for Nexus S, faux123 for Nexus 7, SiyahKernel and GLaDOS. By itself, it is useless, but there are several applications in the market that allow you to use its capabilities.

Another usefulness is the inclusion of the ntfs-3g driver in the kernel (more precisely, in the package with the kernel, the driver itself works as a Linux application), which is necessary to mount flash drives formatted in the NTFS file system. This driver is available in the faux123 and SiyahKernel kernels. Usually it is activated automatically, but if this does not happen, you can use the StickMount application from the market.

Many kernels also include support for the so-called zram technology, which allows you to reserve a small amount of RAM (usually 10%) and use it as a compressed swap area. As a result, there is a kind of expansion of the amount of memory, without any serious consequences for performance. Available in Leankernel, enabled with Trickster MOD or zram enable command.

The last two interesting features are Fast USB charge and Sweep2wake. The first is nothing more than the forced inclusion of the "fast charging" mode, even if the smartphone is connected to the USB port of the computer. Fast charging mode is available in all more or less new smartphones, however, due to technical limitations, it cannot be enabled simultaneously with access to the memory card. The Fast USB charge function allows you to always enable this mode, while disabling access to the drive.

Sweep2wake is a new way to wake up a device, invented by the author of Breaked-kernel. Its meaning is to turn on the smartphone by swiping your finger over the navigation keys located below the screen, or on the screen itself. This is a really handy feature, but as a result of its activation, the sensor will remain active even when the device is sleeping, which can significantly drain the battery.

Overclocking, voltage and power saving

Overclocking is popular not only among owners of stationary computers and laptops, but also among enthusiasts of mobile technology. Like the stones of the x86 architecture, the processors and graphics cores of mobile technology are great at chasing. However, the overclocking method itself and the steps taken to implement it are somewhat different here. The fact is that the standard drivers for SoCs, which are responsible for energy saving and changing the processor frequency, are usually locked at standard frequencies, so for fine tuning you have to install either an alternative driver or a custom kernel.

Almost all more or less high-quality and popular custom kernels already include unlocked drivers, so after installing them, the possibilities for controlling the "power" of the processor are significantly expanded. Typically, custom kernel builders do two things that affect frequency selection. This is an extension of the frequency range beyond the initially specified - you can set both a higher processor frequency and a very low one, which allows you to save the battery and increase the frequency gradation, for example, instead of three possible frequencies, a choice of six is ​​offered. The second is the addition of the ability to adjust the voltage of the processor, so that you can lower the processor voltage at low frequencies to conserve battery power and increase at high frequencies to increase stability.

All this can be controlled using the well-known paid utility SetCPU or the free Trickster MOD. Management recommendations are the same as for desktop systems. It is better to set the lower processor frequency to the minimum, but not lower than 200 MHz (in order to avoid lags), the upper threshold rises gradually with testing the stability of operation, when it drops, it is recommended to slightly raise the voltage for this frequency. There are no recommendations for voltage, since each processor is unique and the values ​​will be different for everyone.

In addition to changing frequencies, assemblers often add new power saving control algorithms (automatic control of the processor frequency) to the core, which, in their opinion, can show better results in comparison with the standard ones. Almost all of them are based on the Interactive algorithm used by default in new versions of Android, the essence of which is to sharply raise the processor frequency to the maximum in case of an increase in the load, and then gradually reduce it to the minimum. It replaces the previously used OnDemand algorithm, which smoothly adjusts the frequency in both directions in proportion to the load, and makes the system more responsive. Collectors of alternative kernels offer the following algorithms to replace Interactive:

  • SmartAssV2- rethinking the Interactive algorithm with a focus on saving battery. The main difference is not to jerk the processor to high frequencies in the event of short bursts of load, for which low processor performance will suffice. The default is used in the Matr1x kernel.
  • InteractiveX- tuned Interactive algorithm, the main feature of which is the processor lock at the minimum frequency specified by the user and the de-energization of the second processor core when the screen is turned off. The default is used in Leankernel.
  • LulzactiveV2 is essentially a re-invented OnDemand. When the load on the processor exceeds the specified one (by default 60%), the algorithm raises the frequency by a certain number of divisions (by default 1), when the load decreases, it lowers it. Of particular interest is that it allows you to independently set the operating parameters, therefore it is suitable for hard-core geeks.

In general, kernel collectors are very fond of coming up with new energy saving algorithms due to the simplicity of their implementation, so you can find a dozen more. Most of them are complete slag, and when choosing a scheduler, you should be guided by the rule: either one of the three described above, or the standard Interactive, which, by the way, is very good. You can make a choice using the same Trickster MOD.

Management interfaces

Most of the popular custom kernels include several mechanisms for fine-tuning various driver parameters, the most common of which are ColorControl, GammaControl, SoundControl, and TempControl.

The first two interfaces are available almost everywhere, including the CyanogenMod kernels, the second two are available in Leankernel and maybe others. One way or another, all of them can be controlled with the Trickster MOD.

Kernels

Which core should you choose? There is no single answer to this question, and not because “to each his own”, but because there are a huge number of Android devices in the world and almost as many different cores. However, there are several popular kernels that are being developed for multiple devices at once. One way or another, I mentioned many of them in the course of the story, here I will give a brief description of them.

  • Leankernel is the kernel for the Galaxy Nexus, Nexus 7 and Galaxy S III. The main focus of the development is on simplicity and speed of work. Power saving algorithm: InteractiveX V2, I / O: ROW scheduler, all of the above control interfaces, support for Fast USB charge, Swap and zram, flexible CPU and GPU overclocking options. One of the best kernels. Configurable with Trickster MOD.
  • Matr1x (http://goo.gl/FQLBI, goo.gl/ZcyvA) - Kernel for Nexus S and Nexus 4. Simple and non-overloaded kernel. Supports CPU and GPU overclocking, GammaControl, Fast USB Charge, Sweep2wake, I / O schedulers: SIO, ROW and FIOPS. Performance tweaks. Configurable with Trickster MOD.
  • Bricked-Kernel (http://goo.gl/kd5F4, goo.gl/eZkAV) - simple and non-overloaded kernel for Nexus 4 and HTC One X. Optimizations for Snapdragon S4 and NVIDIA Tegra 3, redesigned power saving mode for Tegra 3, the ability overclocking, power saving algorithm: tuned by OnDemand (Interactive is also available).
  • SiyahKernel is the core for Galaxy S II and S III. Flexible overclocking options, automatic battery calibration, improved touchscreen driver, power saving algorithms: smartassV2 and lulzactiveV2, I / O schedulers: noop, deadline, CFQ, BFQV3r2 (default), V (R), SIO. CIFS and NTFS drivers (auto-mount). Configurable using ExTweaks.
  • franco.Kernel is the kernel for Nexus S, Galaxy Nexus, Nexus 4, Nexus 7, Nexus 10, Galaxy S III, Galaxy Note, Optimus One and One X.

Kernel capabilities vary greatly from device to device, so you will have to look at the details on the spot. Nevertheless, by flashing this kernel, you will get overclocking, driver tuning, excellent performance, as well as support for various energy saving algorithms and schedulers. In fact, the kernel includes almost all the tweaks described in the article. Considered one of the best kernels available. There is an application for automatic updates franko.Kernel Updater. It can be configured using Trickster MOD.

How to install?

All kernels are distributed in standard Android ZIP archives, which should be flashed through the recovery console in the same way as alternative firmware. Usually kernels are compatible with any firmware, therefore, having chosen the required kernel, you can safely install it. The only thing to look out for is the version of Android with which the kernel is compatible. It can either fit all versions of Android available for the device, or work with only one (the developer usually says this explicitly). Before flashing, be sure to make a backup of the current firmware using the same recovery console. If something goes wrong, you can always roll back.

conclusions

As you can see, custom kernels have many advantages over kernels used in standard or third-party firmware. And more importantly, you don't need to know all the intricacies of Android to use them, just download and install the ZIP archive.

Recently, new versions of kernels have been released quite often. A stable release is released every few months. And unstable release candidates come out even more often. Linus Torvalds and many developers around the world are constantly working to improve new kernels and add more and more functionality to them.

With each new version, the Linux kernel adds support for several new devices, such as new processors, video cards, or even touch screens. Recently, support for new hardware has improved dramatically. Also, new file systems are included in the kernel, the network stack is improved, errors and bugs are fixed.

If you need more detailed information about changes in a particular kernel version, see its Changelog at kernel.org, and in this article we will look at updating the Linux kernel to the newest version. I will try not to bind the instruction to a specific kernel version, new kernels are released quite often and it will be relevant for each of them.

Consider updating the Ubuntu and CentOS kernels. First, let's take a look at how to upgrade the kernel on Ubuntu 16.04.

Let's first see which kernel you have installed. To do this, open a terminal and run:

For example, I currently have version 4.3 and can upgrade to the newest version. Ubuntu developers have already made sure that their users do not build the kernel manually and make deb packages of the new kernel version. They can be downloaded from the official Canonical website.

I could list the wget commands for downloading here if the kernel version was known, but in our case it would be better to use a browser. Go to http://kernel.ubuntu.com/~kernel-ppa/mainline/. This is where all the kernels compiled by the Ubuntu team are located. Kernels are built for specific distributions, with a distribution codename, as well as general ones. Moreover, kernels from Ubuntu 16.10 will most likely work in 16.04, but from 9.04 in Ubuntu 16.04 you should not install a kernel.

Scroll to the bottom, this is where the newer versions of the kernels are:

In addition, at the very top there is a daily / current folder, which contains the most recent, nightly builds of kernels. Select the correct kernel version and download the two linux-headers and linux-image files for your architecture:

After the download is complete, you can proceed to the installation. To do this, do the following in the terminal:

Go to the folder with the installation packages, for example ~ / Downloads:

Run the installation:

If this command did not work, you can go the other way. Install the gdebi utility:

sudo apt-get install gdebi

Then use it to install the kernel:

sudo gdebi linux-headers * .deb linux-image - *. deb

The kernel is installed, it remains to update the bootloader:

sudo update-grub

Now you can restart your computer and see what happens. After rebooting, make sure that the update of the Linux kernel to the newest version was successful:

As you can see, the kernel has been successfully installed and working. But do not rush to delete the old version of the kernel, it is recommended to have several versions of the kernel in the system so that in case of problems you can boot from the old working version.

Automatic Linux Kernel Updates in Ubuntu

Above we covered how to manually install the required kernel version. Ubuntu used to have a PPA for daily kernel builds, but it's now closed. Therefore, you can update the kernel only by downloading the deb package and installing it. But all this can be simplified with a special script.

Install the script:

cd / tmp
$ git clone git: //github.com/GM-Script-Writer-62850/Ubuntu-Mainline-Kernel-Updater
$ bash Ubuntu-Mainline-Kernel-Updater / install

Checking for updates:

KernelUpdateChecker -r yakkety

The -r option allows you to specify the branch of the distribution for which you want to search for kernels. For xenial, kernels are no longer built, but kernels from the next version will work fine here. In addition, the -no-rc option can tell the utility not to use release candidates, and the -v option specifies the exact version of the kernel to install. If you do not care for which distribution the kernel is, as long as the latest, use the --any-release option. The script will produce the following result:

Before installing the kernel, you can see the details by opening the file / tmp / kernel-update:

Here we can see that a search was performed for yakkety, and kernel version 4.7-rc6 is currently available. We can install:

sudo / tmp / kernel-update

The script will show us the version of the current kernel, as well as the version of the kernel that will be installed, its build date and other details. You will also be asked if you need to keep a log of changes. Next will be the installation:

Old kernels, just in case do not delete (n):

Done, updating the kernel to the newest version is complete, now restart your computer (y):

Check if the Ubuntu kernel update actually worked:

Moreover, the script was added to startup and will now check automatically for updates 60 seconds after logging in. The autoload shortcut is in the file:

vi ~ / .config / autostart / KernelUpdate.desktop

You can change it as you need or delete it. If you want to remove the script completely from the system, run:

rm ~ / .config / autostart / KernelUpdate.desktop
$ sudo rm / usr / local / bin / KernelUpdate (Checker, ScriptGenerator)

Is not downloading

If any errors occurred during installation, or the kernel was not updated correctly and the system now does not boot with the new kernel, you can use the old kernel. Also, the system may not start if you are using a proprietary driver for the NVIDIA video card, in this case do not rush to download the newest version of the kernel, use only stable kernels, as a rule, support for this module has already been added to them.

And to restore the system, select the item Advanced options for Ubuntu in the Grub menu:

And start the previous running kernel:

After booting, it remains to remove the incorrectly installed kernel and update Grub again, substitute the required kernel version instead of 4.7:

sudo apt remove linux-header-4.7 * linux-image-4.7 *

sudo update-grub

Your system is now back to its previous state. You can try installing an older kernel version or try again.

Upgrading Linux Kernel to 4.4 on CentOS

Now let's take a look at how to update the latest Linux kernel on CentOS. The instructions have been tested on CentOS 7, but will most likely work on RedHat 7, Fedora and other similar distributions.

As a rule, new kernels are not included in the official CentOS repositories, so in order to get the latest stable version we will need to add the ELRepo repository. This is a repository of Enterprise Linux Packages and is also supported by RedHat and Fedora.

Follow these steps to add a repository:

First you need to import the key:

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

Add the repository and required components to RHEL / Scientific Linux / CentOS-7:

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

yum install yum-plugin-fastestmirror

Fedora 22 and later: