调试Fedora35 Linux内核

//创建工作目录
mkdir workspace_kernel; cd workspace_kernel

//下载相关文件
yum install -y qemu gdb
wget https://download.fedoraproject.org/pub/fedora/linux/releases/35/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-35-1.2.iso

//创建qemu虚拟磁盘
qemu-img create -f qcow2 fedora35.qcow2 100G

//运行qemu安装系统
qemu-system-x86_64 -m 1024 -hda fedora34.qcow2  -cdrom Fedora-Workstation-Live-x86_64-35-1.2.iso -boot d -enable-kvm

//运行安装好的虚拟机,
qemu-system-x86_64 -m 1024 -hda ./fedora34.qcow2  -boot c -enable-kvm

//修改虚拟机的grub启动参数,在启动参数上加上console=tty0 console=ttyS0 nokaslr 3 
vi /boot/loader/entries/ed311076f30f44de810c04c1a5b24bc7-5.14.10-300.fc35.x86_64.conf

//加上-s -S参数重新运行虚拟机
//-S              freeze CPU at startup (use 'c' to start execution)
//-s              shorthand for -gdb tcp::1234
qemu-system-x86_64 -m 1024 -hda fedora34.qcow2 -boot c -enable-kvm -nographic -s -S

//下载内核的debuginfo
debuginfo-install kernel-core-5.14.10-300.fc35.x86_64

//运行GDB
gdb /lib/debug/lib/modules/5.14.10-300.fc35.x86_64/vmlinux
        target remote :1234
        hbreak start_kernel
        c

tip1: yum search --showduplicate kernel-core列出某个软件包的所有版本。

 

 tip2:uname -a查看当前系统内核的版本

 tip3:yumdownloader --source kernel-core-5.14.10-300.fc35.x86_64下载软件的源rpm包

tip4: debuginfo-install kernel-core-5.14.10-300.fc35.x86_64安装软件的调试信息

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值