This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
running systemtap on qemu
- From: William Cohen <wcohen at redhat dot com>
- To: SystemTAP <systemtap at sources dot redhat dot com>
- Date: Wed, 28 Sep 2005 12:41:28 -0400
- Subject: running systemtap on qemu
I am probably not the only one that doesn't always have a spare machine
handy to try something out on. Tuesday I set up an FC4 image on QEMU on
my FC3 laptop. I have attached a writeup describing what I did.
-Will
SystemTap on The QEMU x86 emulator
Sometime you don't have a machine handy you can use for experiments
that may crash the machines or require a specific distribution of
Linux. You can use the QEMU x86 emulator
(http://fabrice.bellard.free.fr/qemu/) as a sandbox to try simple
SystemTap experiments without worrying about crashing the
machine. However, do not expect this to be fast. This write-up
describes how I installed QEMU on my laptop, made a Fedora Core 4 image, and installed the additional SystemTap software.
Building and Installing QEMU
First step is to obtain and build the QEMU emulator. The source code
can be obtained from
http://fabrice.bellard.free.fr/qemu/download.html. Download
qemu-0.7.2.tar.gz and and unpack the source code. Go into the
directory qemu-0.7.2 directory:
./configure
make
make install
At this point QEMU is available on the machine.
Creating FC4 Image
The next step is to set up a FC4 image. For this you will need a file
to act as the virtual disk drive and the ISO image for the FC4 DVD. A
8Gigabyte virtual disk drive file can be created for QEMU with:
qemu-img create qemu-fc4.img 8G
The FC4 DVD ISO,FC4-i386-DVD.iso, can be obtained from:
http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/iso/FC4-i386-DVD.iso
Now you can install FC4 on the virtual disk drive with QEMU. QEMU can
grab the mouse and keyboard, you can toggle back to the regular system
with <cntl>-<alt>. Start the installation with:
qemu -boot d -cdrom FC4-i386-DVD.iso qemu-fc4.img
This will boot off the DVD iso. Now you can do the normal installation
using the normal defaults for things. When selecting packages at a
minimum SystemTap will need the kernel-devel and the gcc compiler
packages. The "Workstation" installation should be sufficient; to keep
the amount of space required down and reduce the installation time
avoid an "everything" install. Refer to the following URL for more information
about installation:
http://fedora.redhat.com/docs/fedora-install-guide-en/fc4/
The installation of the packages will take a while. Allow the RPM
install to complete. When asked select the reboot and go through the
normal first boot. After this you have an FC4 image you can play with
on QEMU. You will need to shut down the system in the normal manner,
e.g. selecting shutdown on log out. To restart the FC4 image you use
the following command:
qemu qemu-fc4.img
You will want to update the packages in the FC4. The machine
will need a network connection to connect to the YUM repository. Log
in as root on the FC4 system running on QEMU. Open a terminal and run
the upgrade:
yum update
This will take a while to download the header information for the
packages. Then it will ask whether you want to download the
packages. Answer "y" to start the download. When YUM starts the actual
update it will get the key to verify the packages are
uncorrupted. Again answer "y" to download the key. Let the system
install the updated packages. Once the update is complete some space
can be recoverd by removing the rpms in
/var/cache/yum/updates-released/packages.
Reboot the system to use the current kernel. Log in as root to
finished the installation. Install the needed kernel-debuginfo with:
yum install kernel-debuginfo
To install the systemtap RPM use:
sudo yum --enablerepo=updates-testing install systemtap
At this point you should be able to run the simple.stp probe from the tests:
probe begin
{
log("systemtap starting probe")
}
probe end
{
log("systemtap ending probe")
}
With the following command:
stap simple.stp
You should see the "systemtap starting probe" when it starts running
and the "systemtap ending probe" when you hit control-c.
You can download the current sources and tests for systemtap with:
cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/systemtap login
{enter "anoncvs" as the password}
cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/systemtap co src tests
Assuming that the dejagnu RPM is installed you can go into the
tests/testsuite directory and run the tests with:
runtest --tool=systemtap
It is not speedy. On a 2GHz AMD64 laptop it took about 10 minutes to
run the current set of tests. However, it does beat crashing my laptop
when reading email or hauling around a separate machine to try things
out on.