如何使用QEMU调试Linux内核模块? [英] How to debug Linux kernel modules with QEMU?

查看:323
本文介绍了如何使用QEMU调试Linux内核模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事学术项目,该项目修改了Kernel Networking的一些代码并包含了新的Kernel module.

I am working on academic project that modifies some Kernel Networking code as well as include a new Kernel module.

我正在使用QEMU加载修改后的内核并进行测试.

I am using QEMU to load modified kernel and test.

但是,我发现在某些.img中需要完整的操作系统才能进行调试.
没有它,有可能吗?

However, i find that a complete OS is required in some .img to debug.
Is it possible without it ?

或者,它是可与Kernel 2.6一起用于系统的发行版.该发行版不需要运行任何功能,只有运行程序的能力,包括网络支持.

Or, which is the distro that can be used with Kernel 2.6 for system. The distro need not have any features, except ability to run programs, including networking support.

推荐答案

我认为最简单的方法是使用buildroot http://buildroot.uclibc.org/

The easiest way in my opinion is to use buildroot http://buildroot.uclibc.org/

克隆它,配置它以使用您的自定义内核(默认用户空间适合开始使用,您可能希望稍后进行更改).

clone it, configure it to use your custom kernel (default userspace is fine for a start, you might want to change it later).

它将构建您的内核和根文件系统.整个过程大约需要半小时,其中二十分钟是在编译怪物.

it will build your kernel and root filesystem. the entire process takes about half an hour, twenty minutes of which is compiling the monster

我的跑步路线看起来像: qemu-system-i386 -hda rootfs.ext2 -内核bzImage -m 512M -附加"root =/dev/sda console = ttyS0" -当地时间 -serial stdio

my run line looks something: qemu-system-i386 -hda rootfs.ext2 -kernel bzImage -m 512M -append "root=/dev/sda console=ttyS0" -localtime -serial stdio

以及有关拍打设备的更多选项

and some more options regarding a tap device

这篇关于如何使用QEMU调试Linux内核模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆