2015年12月12日 星期六

[Kernel][Archlinux] Replace new kernel method

  1. Install package
    pacman -S bc

  2. Download kernel source
    tar xvf linux-4.3.2.tar.xz -C /usr/src/
    cd /usr/src//linux-4.3.2/
    make mrproper (Ensures that the kernel tree is absolutely clean.)

  3. Use system configuration file to compile kernel
    zcat /proc/config.gz > .config
  4. Start to compile
    make
    make modules_install
    This copies the compiled modules into /lib/modules/ARCH-X.X.X/
  5. Copy the kernel to /boot directory
    cp -v arch/x86/boot/bzImage /boot/vmlinuz-ARCH-4.3.2
  6. Make initial RAM disk
    mkinitcpio -k FullKernelName -c /etc/mkinitcpio.conf -g /boot/initramfs-YourKernelName.img

    Check out which is FullKernelName under /lib/modules
    I have 4.3.2-ARCH-4.3.2 which I create and under my /lib/modules.

    Ex:
    sudo mkinitcpio -k 4.3.2-ARCH-4.3.2 -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-ARCH-4.3.2
    ==> Starting build: 4.3.2-ARCH-4.3.2
    -> Running build hook: [base]
    -> Running build hook: [udev]
    -> Running build hook: [autodetect]
    -> Running build hook: [modconf]
    -> Running build hook: [block]
    -> Running build hook: [filesystems]
    -> Running build hook: [keyboard]
    -> Running build hook: [fsck]
    ==> Generating module dependencies
    ==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-ARCH-4.3.2
    ==> Image generation successful
  7. Switch kernel to new one (Quick method)
    initramfs-linux-ARCH-4.3.2 (size: 3.6M) (Initial RAM disk)
    vmlinuz-ARCH-4.3.2 (size: 4.4M) (Kernel)

    cd /boot

    Backup the original one
    cp vmlinuz-linux{,.ori}
    cp initramfs-linux.img{,.ori}


    Use new kernel to replace old one
    cp vmlinuz-ARCH-4.3.2 vmlinuz-linux
    cp initramfs-linux-ARCH-4.3.2 initramfs-linux.img


    Reference:

Virtualbox:

Related Posts:

0 意見:

張貼留言