升級內核版本(自己編譯源碼)
- 從 linux 官網 https://www.kernel.org/ 下載內核源碼
- 解壓
tar -xvf linux-4.16.8.tar.xz
cd linux-4.16.8/ 編譯(出現問題)
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
大概可以看出來,編譯時缺少什么就安裝什么
配置
make menuconfig
使用默認配置,save 后 exit
修復配置后編譯 (4線程)
make -j 4
安裝內核模塊
sudo make modules_install
安裝內核
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就沒有問題了