Upgrade Linux Kernel
Directly on a device with a compilation environment, it is easy to compile and upgrade the kernel.
Make menuconfig
Or
Copy the. config file of the existing system
Modify the. config file CONFIG_DEBUG_INFO = n (avoid generating excessive files during compilation)
Make oldconfig
Make all-j4
Make modules_install
Make install
Create a Linux kernel installation package
Sometimes you need to compile the kernel on the Virtual Machine and install it on another device. However, the device has limited work and there is no compilation and development environment. One way is to mount the file through nfs, directly make modules_install on the device, and then make install.
Another method is to manually copy and install the SDK. The following describes how to create a kernel installation package, which can be directly installed on the device. The following is an example of INCORE 3.5.3.
1. Compile
Make all-j4
2. Prepare various directories and files
New folder kernel-3.5.3
Export INSTALL_MOD_PATH = kernel-3.5.3
Run make modules_install to install the module in the kernel-3.5.3 folder.
Copy depmod. sh in scripts to kernel-3.5.3 In the source code directory.
Copy arch/x86/boot/bzImage from the source code directory to kernel-3.5.3.
Copy System. map in the source code directory to kernel-3.5.3.
Copy arch/x86/boot/install. sh to kernel-3.5.3 In the source code directory.
All files are ready
Kernel-3.5.3
-- Lib
-- Firmware
-- Modules
-- 3.5.3
-- BzImage
-- Depmod. sh
-- Install. sh
-- System. map
3. Write the installation script
Before that, modify the install. sh script.
Add variable definitions to the proper position of the file
INSTALLKERNEL = installkernel
Then write the installation script install_kernel.sh.
#!/bin/bashPROGRAM=install_kernel.shif [ "$0" != "${PROGRAM}" ]; thenif [ "$0" != "./""${PROGRAM}" ]; thenecho "ERROR: ****** !"exitfifiecho "0%..."/bin/cp -rf lib/modules/3.5.3 /lib/modules/echo "30%..."/bin/sh depmod.sh /sbin/depmod 3.5.3echo "60%..."sh install.sh 3.5.3 bzImage System.map "/boot"echo "100%"echo "install success !"
4. Package the contents in the kernel-3.5.3 folder.
After the installation is complete, obtain the device, decompress the package, and run install_kernel.sh to install the kernel.
Create a linux module compiling environment
Now you have created a kernel installation package. Now someone wants to re-compile the previous driver to adapt to this new kernel. You can't pack your compiled source code to him. It's too big.
In fact, you only need to copy a few necessary directories. The following uses 3.5.3 as an example to create an installation package for the module compiling environment.
New folder kernel-3.5.3-devel
Create usr/src/kernel/3.5.3 directory under kernel-3.5.3-devel
Copy arch/x86 to 3.5.3/arch under the source code directory (you can delete the boot folder to save space)
Copy the source code directory and include it to 3.5.3.
Copy the scripts from the source code directory to 3.5.3.
Copy usr from the source code directory to 3.5.3.
Copy. config Kbuild Kconfig Makefile Module. symvers modules. builtin modules. order System. map to 3.5.3 under the source code directory.
Create directory lib/modules/3.5.3 In Kernel-3.5.3
Then, in lib/modules/3.5.3, create a build connection file to connect to.../usr/src/kernel/3.5.3.
Good, package the files and directories under the kernel-3.5.3-devel folder, a compilation environment of the installation package, the user first use the kernel installation package to install the kernel, and then use the installation package, decompress the package directly to the root directory of your device. Restart and switch to the 3.5.3 kernel to develop and compile the module.