UP | HOME

Kernel

目录

How upgrade kernel

    #!/bin/bash

    #1.select the kernel will use
    eselect kernel list
    eselect kernel set <No.>
    #2.configure the kernel with old config (and diff with previous config)
    zcat /proc/config.gz > /usr/src/linux/.config
    diff .config ../linux-x.xx.x-gentoo/.config
    make silentoldconfig/syncconfig/oldconfig
    #3.compile&install kernel/modules
    make -j9
    make install
    # compile&install out-of-tree module(s)
    make modules_prepare
    emerge --ask @module-rebuild
    # install initramfs
    genkernel --install initramfs
    #4.clean up old kernel files
    eclean-kernel
    grub-mkconfig -o /boot/grub/grub.cfg

Configure kernel

将 intel wifi 固件编译进内核

  1. Enable CONFIG_IWLWIFI and CONFIG_IWLMVM
  2. 固件与网卡之间的对应关系可参考iwlwifi驱动的wiki文档
  3. 将在上面找到的与网卡对应的的二进制固件名称填入 EXTRA_FIRMWARE 选项中。 此选项的值是一个空格分隔的固件文件名字符串,这些文件必须位于 CONFIG_EXTRA_FIRMWARE_DIR 目录中(其默认值为 /lib/firmware ).
    Symbol: EXTRA_FIRMWARE
    Type  : string
    Prompt: Build named firmware blobs into the kernel binary
      Location:
        -> Device Drivers
          -> Generic Driver Options
            -> Firmware loader
              -> Firmware loading facility (FW_LOADER [=y])

将 Intel microcode 编译进内核

  1. Enable CONFIG_MICROCODE, and CONFIG_MICROCODE_INTEL
    Processor type and features  --->
        <*> CPU microcode loading support
        [*]   Intel microcode loading support
  1. 查找 CPU 和 microcode 的对应关系
    #查看microcode的sig值:
    dmesg | grep microcode
    #例如sig=0x306c3

    #然后查看intel-ucode目录:
    ls /lib/firmware/intel-ucode
    #在目录中找到与sig值对应为06-3c-03的microcode
  1. 将在上面找到 microcode 名称填入 EXTRA_FIRMWARE 选项中

其他配置

开启 zswap

在内核中选中 zswap 对应的选项后,在=CONFIG_CMDLINE=中添加对应选项开启:

CONFIG_CMDLINE="zswap.enabled=1 zswap.compressor=lz4 zswap.max_pool_percent=20 zswap.zpool=z3fold"

CPU Frequency scaling

CONFIG_CPU_FREQ_GOV_POWERSAVE 配合 CONFIG_X86_INTEL_PSTATE 使用,效果与 CONFIG_CPU_FREQ_GOV_ONDEMAND 差异不大。 甚至可以获得比 CONFIG_CPU_FREQ_GOV_ONDEMAND 更优秀的"性能/瓦特"比。

I/O Schedulers

TODO

创建 udev 使得 lightdm 反复重启,最终导致退出

https://blog.justforlxz.com/2019/10/24/%E7%BB%99Archlinux%E5%BC%80%E5%90%AFBFQ%E5%92%8CMuQSS/

参考

作者: Petrus.Z

Created: 2021-09-01 Wed 00:38