Ubuntu2204降内核版本

一,需求

在使用Ubuntu2204编译Android7和Android9时会出现一些错误,

如: 报错提示dex2oatd E 217979 217979 art/runtime/gc/heap.cc:324] Could not create image

是由于编译环境ubuntu24.04使用的内核为6.5.0-28版本,这里需要使用小于 5.17.

所以我们需要降低内核版本。

二,下载内核源码

cpp 复制代码
sudo apt-get install linux-source-5.15.0
cd /usr/src/
tar -xvf  linux-source-5.15.0.tar.bz2
cd /usr/src/linux-source-5.15.0
cp /boot/config-5.15.0-97-generic  /usr/src/linux-source-5.15.0/.config

cd /usr/src/linux-source-5.15.0

make -j8


出现错误:安装下面软件包
sudo apt-get install dwarves
配置.config文件  vim .config
CONFIG_DEBUG_INFO_BTF = n

二,编译内核

cpp 复制代码
make -j4

三,安装模块

cpp 复制代码
make modules_install

四,安装内核

cpp 复制代码
make install

五,配置启动

cpp 复制代码
配置系统启动选项,设置选择上次保存(默认选择上次运行的内核进行启动)
配置grub文件
配置项目:
GRUB_DEFAULT=saved
 GRUB_SAVEDEFAULT=true

修改grub文件

cpp 复制代码
joyusing@joyusing-HFMP:~$ cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=saved
#"Advanced options for Ubuntu>Ubuntu, with with Linux 5.15.189"
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_SAVEDEFAULT=true
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

六,重启系统,到配置菜单

在重启时按住shift按键,进入Advanced options for Ubuntu的菜单,

选择我们编译的内核:5.15.189

进入系统后: uname -r

相关推荐
zhang133830890752 小时前
CG-09H 超声波风速风向传感器 加热型 ABS材质 重量轻 没有机械部件
大数据·运维·网络·人工智能·自动化
a41324472 小时前
ubuntu 25 安装vllm
linux·服务器·ubuntu·vllm
Configure-Handler2 小时前
buildroot System configuration
java·服务器·数据库
津津有味道2 小时前
易语言TCP服务端接收刷卡数据并向客户端读卡器发送指令
服务器·网络协议·tcp·易语言
Fᴏʀ ʏ꯭ᴏ꯭ᴜ꯭.3 小时前
Keepalived VIP迁移邮件告警配置指南
运维·服务器·笔记
物联网软硬件开发-轨物科技3 小时前
【轨物洞见】告别“被动维修”!预测性运维如何重塑老旧电站的资产价值?
运维·人工智能
程序员允诺3 小时前
[DevOps实战] 彻底解决依赖地狱:如何编译全静态、可移植的 Xorriso 工具
运维·devops
酣大智3 小时前
接口模式参数
运维·网络·网络协议·tcp/ip
Genie cloud3 小时前
1Panel SSL证书申请完整教程
服务器·网络协议·云计算·ssl
一只自律的鸡3 小时前
【Linux驱动】bug处理 ens33找不到IP
linux·运维·bug