[20080915]
|
Debugging NetBSD kernel with qemu
Alexander Shishkin has written some
posted
instructions on how to debug a NetBSD kernel running
in qemu with gdb. He reminds how to build NetBSD,
provides a shell script for making a bootable disk,
and explains the magic on how to run qemu and connect
gdb to it. An example session shows how to load the
kernel, set a breakpoint, and examine registers and
variables when the breakpoint is reached.
[Tags: debugging, gdb, qemu]
|
[20071029]
|
Note to self: Getting X with 1024x768 in qemu (Updated)
I keep on forgetting, and will abuse my blog now to remember
how to get a standard installation of NetBSD 4.0(RC3 here)
with standard X to run 1024x768 in Qemu:
Update:
This also goes for Parallels. A "DefaultDepth 24" may be needed in
the "Screen" section.
[Tags: qemu, xfree]
|
[20070801]
|
Emulating OpenMoko on NetBSD using Qemu
OpenMoko
is a mobile phone that was designed to run open source software
(i.e. Linux :). There are some ideas to port NetBSD to that
platform, but until there's hardware available,
Noud de Brouwer pointed me at
instructions on emulating the OpenMoko hardware in Qemu, using software available in pkgsrc-wip.
Includes links to a number of screenshots, showing Qemu-Neo1973 running
OpenMoko/Linux on NetBSD.
[Tags: images, openmoko, qemu]
|
[20070425]
|
qemu vs. X *Updated(
Trying to run qemu on a remote machine today gave me:
local% ssh -X remote
remote% qemu $options
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 25 (X_SendEvent)
Resource id in failed request: 0x40
Serial number of failed request: 12
Current serial number in output stream: 17
After a round of cursing and googling, the solution seems to be to use "ssh -Y":
remote% exit
local% ssh -Y remote
remote% qemu $options
... and things work as expected. Doh! (FWIW, what does "ssh -Y do? According
to the manpage here, it "Enables trusted X11 forwarding" - how obvious from
the error message! :-/)
Now if qemu from a remote machine was actually usable that would be nice -
turns out the scroll speed is unacceptably slow, though. :(
Update:
I was using qemu 0.8.0 on these machines, and after upgrading to 0.9.0,
this version also offers running Qemu with a VNC server that one can
then connect to. I still have to try that one from at home
(working around a few firewalls :-/), but with some tricky SSH port
forwardings that may be possible - and can't possibly be slower than just
Qemu via remote X. Thanks to sec for the hint!
[Tags: qemu]
|
[20061120]
|
Automated testing: Fun with pexpect, qemu, and sysinst
This was posted quite some time ago, and I never got around
to mention it here. Now that the topic came up in a related
context, I think Andreas Gustafsson's work should be mentioned:
in his posting to tech-install,
he describes how to use qemu as sandbox to automate a NetBSD
install that is scripted with pexpect, for the sake of
regression testing the installer and quality assurance.
[Tags: pexpect, qemu, sysinst, testing]
|
[20061020]
|
Xen with HVM and hardware virtualization: Booting Windows XP in a DomU
Manuel Bouyer has continued his work on the NetBSD/Xen port, and
his latest results include support to use the
Hardware Virtual Machine (HVM)
interface for Intel and AMD CPUs that support virtualization
as well as the Qemu Device Model (Qemu-dm), which is a modified Qemu
running in Dom0 that is used to emulate some hardware devices, see
Manuel's first posting
to the port-xen list and the thread starting from it.
In related news, Manuel has updated the packages for the latest Xen release
(3.0.3) and a new one to support HVM (which needs X, in order to emulate
a VGA console via Qemu, see above). With that package, it was possible to
boot systems that were not specifically prepared for use with Xen, e.g.
NetBSD/i386, Linux and Windows XP!
See Manuel's
second posting
and the followups.
[Tags: qemu, xen]
|
[20060504]
|
Using qemu in SysAdmin class
I'm teaching System Administration again this summer, and
after some basic system analysis and scripting, the course is
reachinga point where practical exercises require root permissions
to be useful. While e.g. my
Virtual Unix Lab is
nice for students to train certain exercises and get feedback
on their training, the system is limited to one student at
a time (right now), and as it does not provide console access
and recovery may be problematic if the system is thrashed,
I let my students play with qemu today.
I did setup a 200MB harddisk image with NetBSD (could be
anything). Instead of copying this huge file onto students'
tiny (50MB quota) accounts, I used the "copy on write" feature
of Qemu instead. Basically, the following script was given
to students to run:
$ cat ~hubertf/tmp/qemu/qemu.sh
#!/bin/sh
QEMU_HOME=/home/feyrer/tmp/qemu
roimg=${QEMU_HOME}/harddisk.netbsd
rwimg=harddisk.qemu
if [ ! -f $rwimg ]; then
qemu-img create -b $roimg -f qcow $rwimg
fi
qemu \
-hda $rwimg \
-cdrom ${QEMU_HOME}/i386pkg-3.0.iso \
-boot c
This first creates a copy-on-write image ($rwimg)
from my master image ($roimg), which just takes up a few kb,
depending on what students do. After that, qemu is started
normally, and students can modify "their" (qemu) system
as they like. For later sessions, the students' local
image ($rwimg) is kept so they can continue working on the
image, and if something goes terribly wrong, the student
image can be deleted and upon next start of the script
the student will start with a fresh version from the master
image.
There are several interesting aspects of using Qemu
this way: 1) it saves disk space for students, by using
copy-on-write images. 2) Qemu doesn't need any kernel
modules or special privileges to run. Whatever students
do, they can not possibly violate host system security.
3) thanks to Qemu's built in network stack (and application
level gateway, DHCP server, router, DNS server etc.),
a lot of networking can be done from
within Qemu. 4) Easy recovery as described above.
In short: Qemu rocks once more!
[Tags: qemu]
|
[20060427]
|
dmesgs: NetBSD/Xen in qemu
Being a qemu-whore^W^W^Wlazy, I wanted to play with Xen, but
never found the hardware to do so. Once again, qemu came to the
rescue, and following the fine
NetBSD/Xen howto, I managed to setup Xen in
qemu.
Setup and configuration was dead easy, and NetBSD comes with some
excellent infrastructure to setup a machine that starts up multiple
domUs automatically, by simply adding the needed config files into
/usr/pkg/etc/xen.
The qemu disk image is 1GB in size so I'll not make this available
(but can upload it on request, if someone wants?), but for kicks here
are dmesg outputs of
the host running qemu,
the Xen dom0 running inside qemu and
a Xen domU domain.
Harddisk usage of the 1GB disk is, in dom0:
two 180MB disk images for the domU filesystems, mounted via vnd(4).
About 100MB of additional packages are installed to manage Xen plus
some other things pulled in to support that (Python, Perl and lots of
modules), 100MB for X, some 200MB for a full installation of NetBSD
3.0/i386 (used on the Xen kernel) which includes development and
text processing environment, documentation and manpages.
The rest of the disk is dedicated to swap.
The system is setup to use grub as bootloader, which offers booting
either a 'regular' NetBSD/i386 kernel (i.e. no Xen), or the Xen
hypervison, which then boots a NetBSD/Xen kernel, that uses
the NetBSD/i386 userland to boot.
After the system has booted to multiuser mode, started the two
domUs, and after logging in as root, the domU consoles can be
accessed by telnetting to localhost port 9601 and 9602,
respectively. Networking for the domUs is setup in the domU config
files: all domUs, the dom0 plus the physical ethernet interface
are all plugged into a (virtual) switch (implemented via bridge(4)),
which is then bridged to the "normal" ethernet - Voila, network
for all domains!
FWIW, here's what a Xen domU config file looks:
$ cat /usr/pkg/etc/xen/hf1
kernel="/netbsd-XENU"
memory=32
name="hf1"
nics=1
vif = [ 'mac=52:54:00:12:34:57, bridge=bridge0' ]
disk = [ 'file:/harddisk.xen-hf1,wd0d,w' ]
root="/dev/wd0d"
Installation of a Xen domU with NetBSD works by creating a
harddisk image, and then using the INSTALL_XENU kernel,
which boots right into an installer that can then be
used to install NetBSD on the disk(image). Installation
sets can be fetched using the local network e.g. via
FTP from dom0.
Of course after setting up one domU harddisk image, setting
up the other one is a mere "cp img1 img2", with some small
changes for hostname and SSH keys etc.
In summary, I'm very impressed by the "roundness" of the
Xen integration into NetBSD - no hacking, just add config
files, disk images, and off you go.
Mmm, NetBSD!
[Tags: dmesg, qemu, xen]
|
[20051222]
|
Toying with qemu 0.8
I made a
package for qemu 0.8
today (sent it off to the maintainer), to see what's new.
And boy, SMP supports looks quite funny. I've played with
two,
four,
sixteen
and 128 CPUs, but qemu gets very slow then (apparently N times slower
than 1 CPU for N CPUs). I managed to get to multiuser with 128
CPUs (of which NetBSD only recognized/used the first 20...),
but due to some other process things (I'm not root on my work
machine!) became unbearable slow and I deferred the playing to
some other day.
Anyone got success with sparc SMP, or booting NetBSD/sparc in
general, or NetBSD/macppc or any of the AFM or MIPS platforms?
Please let me know if so! :)
[Tags: qemu]
|
[20051221]
|
Tripping over not-so-standard standard types
Well, or maybe just non-standard use of them. Trying to build
qemu 0.8 today (with SMP for i386 and sparc!), I tripped over
some evil code that builds symbols from types using some
extended cpp(1) magic:
#define IN_T int8_t
...
#define ET glue (ENDIAN_CONVERSION, glue (_, IN_T))
...
static void glue (glue (conv_, ET), _to_mono)
(st_sample_t *dst, const void *src, int samples, volume_t *vol)
{ ... }
t_sample *mixeng_conv[2][2][2][2] = {
{
{
{
conv_natural_uint8_t_to_mono,
conv_natural_uint16_t_to_mono
}
...
(Some data ommitted, see audio/mixeng.c and audio/mixeng_template.h).
This led to fireworks, as conv_natural___uint8_t_to_mono
was not defined - note the two extra underscores!
As it turns out, the NetBSD 2.x system I did this on actually has uint8_t
(and others) as a #define to the corresponding types with __, which
then leads to the above effect. Of course the right way is not to
use #define but typedef here, but upgrading to NetBSD 3.0 (which does
the right thing) is not an option right now).
So I tried to come up with some equally evil cpp(1) magic to expand
the symbol in the second place, replacing:
conv_natural_uint8_t_to_mono,
conv_natural_uint16_t_to_mono
with
NBglue(conv_natural_, uint8_t, _to_mono),
NBglue(conv_natural_, uint16_t, _to_mono)
the idea here was to add a
#define NBglue(x,y,z) x ## y ## z
that does the right thing, but it didn't - the "y" symbol
was not expanded by cpp(1)! I tried a second version:
#define NBexpand(x) x
#define NBglue(x,y,z) x ## NBexpand(y) ## z
but here again the symbol was not expanded but used literally,
and I got complaints that "conv_natural_NBexpand(uint16_t)_to_mono"
was not a valid symbol - surprise. So the final answer was -- thanks
to Christos at this point! -- this one:
#define _NBglue(x,y,z) x ## y ## z
#define NBglue(x,y,z) _NBglue(x,y,z)
This expands the types properly.
What lesson can be learned from this? 1) don't use #define where typedef
is the right thing 2) don't blindly assume someone followed rule 1).
Oh, and someone please feel free to go back and clean up this whole code,
apparently it was de-C++-ified at some time, according to some comment... :)
And finally, if someone's got some success with the kqemu or that
other kernel-module whose name I forgot, please let me know! :)
[Tags: hubertf, qemu]
|
|
Tags: ,
2bsd,
34c3,
3com,
501c3,
64bit,
acl,
acls,
acm,
acorn,
acpi,
acpitz,
adobe,
adsense,
Advocacy,
advocacy,
advogato,
aes,
afs,
aiglx,
aio,
airport,
alereon,
alex,
alix,
alpha,
altq,
am64t,
amazon,
amd64,
anatomy,
ansible,
apache,
apm,
apple,
arkeia,
arla,
arm,
art,
Article,
Articles,
ascii,
asiabsdcon,
aslr,
asterisk,
asus,
atf,
ath,
atheros,
atmel,
audio,
audiocodes,
autoconf,
avocent,
avr32,
aws,
axigen,
azure,
backup,
balloon,
banners,
basename,
bash,
bc,
beaglebone,
benchmark,
bigip,
bind,
blackmouse,
bldgblog,
blog,
blogs,
blosxom,
bluetooth,
board,
bonjour,
books,
boot,
boot-z,
bootprops,
bozohttpd,
bs2000,
bsd,
bsdca,
bsdcan,
bsdcertification,
bsdcg,
bsdforen,
bsdfreak,
bsdmac,
bsdmagazine,
bsdnexus,
bsdnow,
bsdstats,
bsdtalk,
bsdtracker,
bug,
build.sh,
busybox,
buttons,
bzip,
c-jump,
c99,
cafepress,
calendar,
callweaver,
camera,
can,
candy,
capabilities,
card,
carp,
cars,
cauldron,
ccc,
ccd,
cd,
cddl,
cdrom,
cdrtools,
cebit,
centrino,
cephes,
cert,
certification,
cfs,
cgd,
cgf,
checkpointing,
china,
christos,
cisco,
cloud,
clt,
cobalt,
coccinelle,
codian,
colossus,
common-criteria,
community,
compat,
compiz,
compsci,
concept04,
config,
console,
contest,
copyright,
core,
cortina,
coverity,
cpu,
cradlepoint,
cray,
crosscompile,
crunchgen,
cryptography,
csh,
cu,
cuneiform,
curses,
curtain,
cuwin,
cvs,
cvs-digest,
cvsup,
cygwin,
daemon,
daemonforums,
daimer,
danger,
darwin,
data,
date,
dd,
debian,
debugging,
dell,
desktop,
devd,
devfs,
devotionalia,
df,
dfd_keeper,
dhcp,
dhcpcd,
dhcpd,
dhs,
diezeit,
digest,
digests,
dilbert,
dirhash,
disklabel,
distcc,
dmesg,
Docs,
Documentation,
donations,
draco,
dracopkg,
dragonflybsd,
dreamcast,
dri,
driver,
drivers,
drm,
dsl,
dst,
dtrace,
dvb,
ec2,
eclipse,
eeepc,
eeepca,
ehci,
ehsm,
eifel,
elf,
em64t,
Embedded,
embedded,
emips,
emulate,
encoding,
envsys,
eol,
espresso,
etcupdate,
etherip,
euca2ools,
eucalyptus,
eurobsdcon,
eurosys,
Events,
exascale,
ext3,
f5,
facebook,
falken,
fan,
faq,
fatbinary,
features,
fefe,
ffs,
filesystem,
fileysstem,
firefox,
firewire,
fireworks,
flag,
flash,
flashsucks,
flickr,
flyer,
fmslabs,
force10,
fortunes,
fosdem,
fpga,
freebsd,
freedarwin,
freescale,
freex,
freshbsd,
friendlyAam,
friendlyarm,
fritzbox,
froscamp,
fsck,
fss,
fstat,
ftp,
ftpd,
fujitsu,
fun,
fundraising,
funds,
funny,
fuse,
fusion,
g4u,
g5,
galaxy,
games,
gcc,
gdb,
gentoo,
geode,
getty,
gimstix,
git,
gnome,
google,
google-soc,
googlecomputeengine,
gpio,
gpl,
gprs,
gracetech,
gre,
groff,
groupwise,
growfs,
grub,
gumstix,
guug,
gzip,
hackathon,
hackbench,
hal,
hanoi,
happabsd,
hardware,
Hardware,
haze,
hdaudio,
heat,
heimdal,
hf6to4,
hfblog,
hfs,
history,
hosting,
hotplug,
hp,
hp700,
hpcarm,
hpcsh,
hpux,
html,
httpd,
hubertf,
hurd,
i18n,
i386,
i386pkg,
ia64,
ian,
ibm,
ids,
ieee,
ifwatchd,
igd,
iij,
image,
images,
imx233,
imx7,
information,
init,
initrd,
install,
intel,
interix,
internet2,
interview,
interviews,
io,
ioccc,
iostat,
ipbt,
ipfilter,
ipmi,
ipplug,
ipsec,
ipv6,
irbsd,
irc,
irix,
iscsi,
isdn,
iso,
isp,
itojun,
jail,
jails,
japanese,
java,
javascript,
jetson,
jibbed,
jihbed,
jobs,
jokes,
journaling,
kame,
kauth,
kde,
kerberos,
kergis,
kernel,
keyboardcolemak,
kirkwood,
kitt,
kmod,
kolab,
kvm,
kylin,
l10n,
landisk,
laptop,
laptops,
law,
ld.so,
ldap,
lehmanns,
lenovo,
lfs,
libc,
license,
licensing,
linkedin,
links,
linksys,
linux,
linuxtag,
live-cd,
lkm,
localtime,
locate.updatedb,
logfile,
logging,
logo,
logos,
lom,
lte,
lvm,
m68k,
macmini,
macppc,
macromedia,
magicmouse,
mahesha,
mail,
makefs,
malo,
mame,
manpages,
marvell,
matlab,
maus,
max3232,
mbr95,
mbuf,
mca,
mdns,
mediant,
mediapack,
meetbsd,
mercedesbenz,
mercurial,
mesh,
meshcube,
mfs,
mhonarc,
microkernel,
microsoft,
midi,
mini2440,
miniroot,
minix,
mips,
mirbsd,
missile,
mit,
mixer,
mobile-ip,
modula3,
modules,
money,
mouse,
mp3,
mpls,
mprotect,
mtftp,
mult,
multics,
multilib,
multimedia,
music,
mysql,
named,
nas,
nasa,
nat,
ncode,
ncq,
ndis,
nec,
nemo,
neo1973,
netbook,
netboot,
netbsd,
netbsd.se,
nethack,
nethence,
netksb,
netstat,
netwalker,
networking,
neutrino,
nforce,
nfs,
nis,
npf,
npwr,
nroff,
nslu2,
nspluginwrapper,
ntfs-3f,
ntp,
nullfs,
numa,
nvi,
nvidia,
nycbsdcon,
office,
ofppc,
ohloh,
olimex,
olinuxino,
olpc,
onetbsd,
openat,
openbgpd,
openblocks,
openbsd,
opencrypto,
opendarwin,
opengrok,
openmoko,
openoffice,
openpam,
openrisk,
opensolaris,
openssl,
or1k,
oracle,
oreilly,
oscon,
osf1,
osjb,
paas,
packages,
pad,
pae,
pam,
pan,
panasonic,
parallels,
pascal,
patch,
patents,
pax,
paypal,
pc532,
pc98,
pcc,
pci,
pdf,
pegasos,
penguin,
performance,
pexpect,
pf,
pfsync,
pgx32,
php,
pie,
pike,
pinderkent,
pkg_install,
pkg_select,
pkgin,
pkglint,
pkgmanager,
pkgsrc,
pkgsrc.se,
pkgsrccon,
pkgsrcCon,
Platforms,
plathome,
pleiades,
pocketsan,
podcast,
pofacs,
politics,
polls,
polybsd,
portability,
posix,
postinstall,
power3,
powernow,
powerpc,
powerpf,
pppoe,
precedence,
preemption,
prep,
presentations,
prezi,
Products,
products,
proplib,
protectdrive,
proxy,
ps,
ps3,
psp,
psrset,
pthread,
ptp,
ptyfs,
Publications,
puffs,
puredarwin,
pxe,
qemu,
qnx,
qos,
qt,
quality-management,
quine,
quote,
quotes,
r-project,
ra5370,
radio,
radiotap,
raid,
raidframe,
rants,
raptor,
raq,
raspberrypi,
rc.d,
readahead,
realtime,
record,
refuse,
reiserfs,
Release,
Releases,
releases,
releng,
reports,
resize,
restore,
ricoh,
rijndael,
rip,
riscos,
rng,
roadmap,
robopkg,
robot,
robots,
roff,
rootserver,
rotfl,
rox,
rs323,
rs6k,
rss,
ruby,
rump,
rzip,
sa,
safenet,
san,
sata,
savin,
sbsd,
scampi,
scheduler,
scheduling,
schmonz,
sco,
screen,
script,
sdf,
sdtemp,
secmodel,
Security,
security,
sed,
segvguard,
seil,
sendmail,
serial,
serveraptor,
sfu,
sge,
sgi,
sgimips,
sh,
sha2,
shark,
sharp,
shisa,
shutdown,
sidekick,
size,
slackware,
slashdot,
slides,
slit,
smbus,
smp,
sockstat,
soekris,
softdep,
softlayer,
software,
solaris,
sony,
sound,
source,
source-changes,
spanish,
sparc,
sparc64,
spider,
spreadshirt,
spz,
squid,
ssh,
sshfs,
ssp,
statistics,
stereostream,
stickers,
storage,
stty,
studybsd,
subfile,
sudbury,
sudo,
summit,
sun,
sun2,
sun3,
sunfire,
sunpci,
support,
sus,
suse,
sushi,
susv3,
svn,
swcrypto,
symlinks,
sysbench,
sysctl,
sysinst,
sysjail,
syslog,
syspkg,
systat,
systrace,
sysupdate,
t-shirt,
tabs,
talks,
tanenbaum,
tape,
tcp,
tcp/ip,
tcpdrop,
tcpmux,
tcsh,
teamasa,
tegra,
teredo,
termcap,
terminfo,
testdrive,
testing,
tetris,
tex,
TeXlive,
thecus,
theopengroup,
thin-client,
thinkgeek,
thorpej,
threads,
time,
time_t,
timecounters,
tip,
tk1,
tme,
tmp,
tmpfs,
tnf,
toaster,
todo,
toolchain,
top,
torvalds,
toshiba,
touchpanel,
training,
translation,
tso,
tty,
ttyrec,
tulip,
tun,
tuning,
uboot,
ucom,
udf,
ufs,
ukfs,
ums,
unetbootin,
unicos,
unix,
updating,
upnp,
uptime,
usb,
usenix,
useradd,
userconf,
userfriendly,
usermode,
usl,
utc,
utf8,
uucp,
uvc,
uvm,
valgrind,
vax,
vcfe,
vcr,
veriexec,
vesa,
video,
videos,
virtex,
virtualization,
vm,
vmware,
vnd,
vobb,
voip,
voltalinux,
vpn,
vpnc,
vulab,
w-zero3,
wallpaper,
wapbl,
wargames,
wasabi,
webcam,
webfwlog,
wedges,
wgt624v3,
wiki,
willcom,
wimax,
window,
windows,
winmodem,
wireless,
wizd,
wlan,
wordle,
wpa,
wscons,
wstablet,
X,
x.org,
x11,
x2apic,
xbox,
xcast,
Xen,
xen,
xfree,
xfs,
xgalaxy,
xilinx,
xkcd,
xlockmore,
xmms,
xmp,
xorg,
xscale,
youos,
youtube,
zaurus,
zdump,
zfs,
zlib
'nuff.
Grab the RSS-feed,
index,
or go back to my regular NetBSD page
Disclaimer: All opinion expressed here is purely my own.
No responsibility is taken for anything.