1. 程式人生 > >升級 Linux 核心版本(編譯原始碼)

升級 Linux 核心版本(編譯原始碼)

升級核心版本(自己編譯原始碼)

  1. 解壓

    tar -xvf linux-4.16.8.tar.xz
    cd linux-4.16.8/

  2. 編譯(出現問題)

    make

    出現

    /bin/sh: 1: bison: not found
    scripts/Makefile.lib:217: recipe for target 'scripts/kconfig/zconf.tab.c' failed
    make[2]: *** [scripts/kconfig/zconf.tab.c] Error 127
    Makefile:514: recipe for target 'silentoldconfig' failed

    解決方法

    sudo apt-get install bison

    繼續 make 又出現

    /bin/sh: 1: flex: not found
    scripts/Makefile.lib:202: recipe for target 'scripts/kconfig/zconf.lex.c' failed
    make[2]: *** [scripts/kconfig/zconf.lex.c] Error 127
    Makefile:514: recipe for target 'silentoldconfig' failed

    解決

    sudo apt-get install flex

    大概可以看出來,編譯時缺少什麼就安裝什麼

  3. 配置

    make menuconfig

    使用預設配置,save 後 exit

  4. 修復配置後編譯 (4執行緒)

    make -j 4

  5. 安裝核心模組

    sudo make modules_install

  6. 安裝核心

    sudo make install

關於VirtualBox 對 header 的依賴
我在升級完核心版本後,把舊的linux啟動項給刪除了,header 應該也被我刪除,然後啟動vbox 失敗,想起vbox需要有linux-header才能執行,然後安裝header

sudo apt-get install linux-headers-4.16.0-1-amd64

安裝完 header 後可以發現其存在 /usr/src 中,當然 vboxhost-5.2.1 也在裡面,後面再啟動vbox就沒有問題了