• Linux


    For upgrading present kernel to linux-next kernel, we need to follow below steps.

    1. Check present kernel version:

    Check which kernel you have, by running the following command. This should print the version of the kernel that you are using

    uname -r

    Saving present kernel version in present-version.txt

    uname -r > present-version.txt

    2. Install required packages:  like "git, make, tar, gcc, bc, patch, dos2unix, wget, xz"

    Use below commands based on Linux distro.

    zypper --non-interactive install git make tar gcc bc patch dos2unix wget xz

    yum install -y git make tar gcc bc patch dos2unix wget xz flex bison openssl-devel elfutils-libelf-devel

    apt-get install -y git make tar gcc bc patch dos2unix wget libssl-dev flex bison

    3. Download linux-next kernel from git.

    git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

    It will download the code into linux-next directory.

    cd linux-next/

    4. Creating the .config file.

    Creating new .config file based on a previous .config file

    if you have an existing configuration from an older kernel, copy the old .config file in to linux-next directory as ".config"(recommended way)

    cp /boot/config-`uname -r` .config

    if old configuration file  not exists, you can create a .config file by running below command

    yes "" | make oldconfig

    5. Modifications in “.config” file:

    a. Enabling HyperV support:

    Recent changes to kernel requires setting “CONFIG_HYPERVISOR_GUEST” to enable all guest virtualization drivers. So we need to add CONFIG_HYPERVISOR_GUEST=y to .config file.

    CONFIG_HYPERVISOR_GUEST=y

    b. Enable Ext4 support:

    Ext3 is enabled by default, but in some distros Ext4 is not enable by default.

    CONFIG_EXT4_FS=y

    6. Configure the kernel options:

    This “oldconfig” process will carry over your previous settings, and prompt you if there are new features not covered by your earlier .config file

    yes "" | make oldconfig

    7. Build the kernel:

    Now compile the actual kernel. This can take more than 20 minutes to complete

    Based on the processor count, we can run make cmd

    make -j`nproc` (running “nproc” processes at a time)

    Check make command executed successfully or not.

    8. Following changes are needed on OpenSUSE, other distributions may not need this step:

    Removing any scsi_id references in /etc/default/grub and /etc/default/grub_installdevice files

    and then run "grub2-mkconfig"

    grub2-mkconfig

    9. Building the kernel modules:

    a. Make the modules: Modules are parts of the kernel that are loaded on the fly, as they are needed. They are stored in individual files

    make modules

    b. Install the modules: This will copy all the modules to a new directory, "/lib/modules/<kernel version>"

    make modules_install

    10. Installing the kernel:

    Now install linux-next kernel using below command.

    make install

    11. Grub Modification:

    Update grub.conf based on grub version, make new kernel as default kernel

    For grub V1 files, change default value to 0

    default=0

    For grub V2 files, run below commands

    grub2-mkconfig -o /boot/grub2/grub.cfg

    grub2-set-default 0

    12. Ensure eth0 is up and running

    Sometimes eth0 will not run after reboot, so we need to add below command to either rc.local or after.local based on distro

    ifup eth0 > /dev/null

    13. Reboot the VM

    Reboot the machine, you will be in the new kernel. Check the kernel using "uname -r"

    reboot [or] init 6

    uname -r

    Note: Before reboot check new kernel position in the grub.cfg [or] grub2.cfg with older one and make it as default.

    Issues we faced while installing new kernel:

    1. Facing errors in crypto/signature/ksign-publickey.c file: For this issue try below procedure.

    Run "make menuconfig", Disable "Module signature verification (EXPERIMENTAL)" in "Enable loadable module support" and

    Disable "In-kernel signature checker (EXPERIMENTAL)" in "Cryptographic API" save and exit

    Now build your kernel with the modified .config file

    2. Facing errors Like "lib/locking-selftest.c:1546: error: implicit declaration of function ‘raw_spin_lock_nest_lock’"

    You need to replace the raw_spin_lock_nest_lock with spin_lock_nest_lock in ww_test_spin_nest_unlocked function of lib/locking-selftest.c file

    3. Facing disk space issues:

    For this we need to make sure at least 20GB is available on disk.

  • 相关阅读:
    《高级软件测试》web测试实践--12月30日记录
    JUnit单元测试遇到的问题及解决思路
    静态代码检查报告
    召开小组评审会
    小组评审会前准备
    软工1701班06组白盒测试实践任务分配
    《高级软件测试》11.30.学习编写自动化测试脚本
    《高级软件测试》11.29.学习编写自动化测试脚本
    新博客
    Java中的NIO学习(一、缓冲区与Buffer)
  • 原文地址:https://www.cnblogs.com/lilideng/p/linux_build_kernel.html
Copyright © 2020-2023  润新知