在Ubuntu重新編譯Kernel

安裝套件

#apt-get install -y build-essential libncurses5-dev gcc libssl-dev grub2 bc bison flex libelf-dev

下載原始碼

#wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.7.9.tar.xz

#tar -xvf linux-5.7.9.tar.xz

製作kernel的設定檔

#make menuconfig

編譯模組與kernel,-j8表示使用8個核心進行編譯,加快速度

#make -j8

安裝模組與kernel

#make modules_install

#make install

make install 如果出現錯誤「Error 24 : Write error : cannot write compressed block」,因為使用Virtual Box安裝Ubuntu,預設/boot磁區只開1G造成空間不夠,擴大/boot磁區即可以順利安裝kernel。