我下载了 linux kernel-5.0.0 并尝试在我的 Ubuntu-18.04.3 上编译和安装它
我在/usr/src/linux-5.0 中使用的命令:
sudo make mrproper
sudo make menuconfig
sudo make -j4
sudo make modules_install
sudo make install
在最后一个命令的结果,有一个错误:
* dkms: running auto installation service for kernel 5.0.02173611831
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.0.02173611831 /boot/vmlinuz-5.0.02173611831
update-initramfs: Generating /boot/initrd.img-5.0.02173611831
FATAL: cannot determine kernel version
我不知道为什么这是“致命:无法确定内核版本”以及如何修复它。
一开始,我跳过它,但后来我发现一旦我像这样打开 vim,“无法确定内核版本”总是出现。
when i open vim
顺便说一句,奇怪的数字 5.0.02173611831 是(内核版本)+(我在大学的数字),我在“sudo make menuconfig”时按照老师的要求进行了配置。
最佳答案
我有这个错误“致命:无法确定内核版本”,结果证明是在 ./configure 脚本中滥用了“cpp”。
其他用途就像
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
但是这个错误来自一行kernsrcver=`(echo "#include <$utsrelease>";
echo "kernsrcver=UTS_RELEASE") |
cpp -I $kernelbuild/include |
grep "^kernsrcver=" | cut -d \" -f 2`
我将 cpp 行更改为(并且有效): cpp -I $kernelbuild/include -E - |
关于linux - "FATAL: cannot determine kernel version"更新 initramfs 时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58394650/