Using QEMU
From Milkymist Wiki
Contents |
[edit] Build and Install QEMU
Mico32 support is available in the QEMU source tree and in QEMU releases since 0.10. If your distribution packages an outdated version, you will need to build QEMU from the source code. To get the QEMU source code you will need the git version control system installed. You can get git from git-scm.com
Prior to building QEMU sure you have libsdl-dev installed (following line works on debian & ubuntu) :
# aptitude install libsdl-dev
In fedora:
# yum install SDL-devel
On OS X install SDL from source code (the frameworks installed by the SDL OS X disk image aren't recognized by the configure script):
$ curl http://www.libsdl.org/release/SDL-1.2.14.tar.gz -o SDL-1.2.14.tar.gz $ tar xvzf SDL-1.2.14.tar.gz $ cd SDL-1.2.14 $ ./configure $ make # make install
Checkout the latest version of the QEMU source code:
$ git clone git://git.qemu.org/qemu.git $ cd qemu
Compile and install qemu for lm32 target with sdl support :
$ ./configure --target-list="lm32-softmmu" --enable-sdl [other options? see configure --help] on OS X: $ ./configure --target-list="lm32-softmmu" --enable-sdl --enable-cocoa $ make # make install
[edit] Basic usage
Command line to run Flickernoise using qemu :
$ qemu-system-lm32 -M milkymist -kernel flickernoise
Command line to run Linux using qemu :
$ qemu-system-lm32 -M milkymist -nographic -kernel [ELF kernel] -initrd [initrd] \ -append "root=/dev/ram"
Command line to run the sample Hello World application :
$ qemu-system-lm32 -M milkymist -kernel compile-flickernoise/build_dir/bsp-milkymist/lm32-rtems4.11/c/milkymist/testsuites/samples/hello/hello.exe -nographic
[edit] GDB
It is also possible to use GDB. For this purpose, add ā-s -Sā to the above command line, and run:
$ lm32-linux-gdb vmlinux (gdb) target remote localhost:1234
[edit] Networking
$ lm32-softmmu/qemu-system-lm32 -M milkymist -kernel bios.elf -nographic -net nic -net user,net=172.16.0.0/24,host=172.16.0.254,tftp=/milkymist
To use the real network: change the option to -net nic -net tap
[edit] binfmt_misc
- create a /usr/bin/mmqemu.sh file with:
#!/bin/sh exec qemu-system-lm32 -M milkymist -kernel $1
- make it executable
chmod 755 /usr/bin/mmqemu.sh
- register the binfmt format
echo ':lm32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x8a:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/mmqemu.sh:' > /proc/sys/fs/binfmt_misc/register
- you can now run MM binaries directly from the shell, i.e. "./flickernoise" will automatically run it in a QEMU window.
[edit] Audio
In case having problems setting up right audio device just try this:
export QEMU_AUDIO_DRV=none