赞
踩
前言:实验课要求下载最新版本Linux内核并修改版本号,本人在Vmware中Ubuntu22.04中实现,花三天时间查阅大量网站资料。记录一下误打误撞成功的过程,希望对你们有帮助。
目录
一开始用的是ubuntu15的版本,gcc版本号为4.X。
arch/x86/kvm/svm/pmu.c: In function ‘get_gp_pmc_amd’:
arch/x86/kvm/svm/pmu.c:56:20: error: logical not is only applied to the left hand side of comparison [-Werror=logical-not-parentheses]
if (!(msr & 0x1) != (type == PMU_TYPE_EVNTSEL))
^
arch/x86/kvm/svm/pmu.c: At top level:
cc1: error: unrecognized command line option ‘-Wno-shift-negative-value’ [-Werror]
cc1: all warnings being treated as errors
scripts/Makefile.build:243: recipe for target 'arch/x86/kvm/svm/pmu.o' failed
make[4]: *** [arch/x86/kvm/svm/pmu.o] Error 1
scripts/Makefile.build:480: recipe for target 'arch/x86/kvm' failed
make[3]: *** [arch/x86/kvm] Error 2
scripts/Makefile.build:480: recipe for target 'arch/x86' failed
make[2]: *** [arch/x86] Error 2
搞了半天,放弃,重新新建虚拟机。
新建了一个虚拟机,系统用最新的Ubuntu22.04,常规配置基本环境(设置root密码、换源、安装vmwaretools等),接着如上面下载linux6.7.8压缩包、复制、解压缩、安装依赖库;
- sudo vim MakeFile#在/usr/src/linux-6.7.8文件夹中启动终端执行,
- #按i进入插入模式修改版本号后缀,esc在输入:wq回车保存
- make mrproper#净化
- sudo make menuconfig#save→ok→exit退出
sudo make -j4
make[1]: *** No rule to make target 'debian/canonical-certs.pem', needed by 'certs/x509_certificate_list'. Stop.
CONFIG_SYSTEM_REVOCATION_KEYS="debian/canonical-revoked-certs.pem"
scripts/config --disable SYSTEM_TRUSTED_KEYS
scripts/config --disable SYSTEM_REVOCATION_KEYS
make[2]: *** 没有规则可制作目标“/lib/modules/6.7.821/kernel/arch/x86/events/amd/amd-uncore.ko.zst”,由“depmod” 需求。 停止。
- sudo make modules
- sudo make INSTALL_MOD_STRIP=1 modules_install -j4
- #应该两个运行一个就行(?)
- sh ./arch/x86/boot/install.sh 4.14.28-2018840814 arch/x86/boot/bzImage \
- System.map "boot/"
-
- *** Missing file: arch/x86/boot/bzImage
- *** you need to run "make before "make install".
sudo make -j4
完成了,果断sudo make install
最后reboot重启,uname -a查看版本号,确实正确,完结撒花~❀
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。