Syborg & QEMU
From Symbian Developer Community
This page describes how to set up and start running a Symbian ROM image using QEMU and Syborg.
QEMU is an open source process emulator. It enables a PC to emulate an ARM machine - which means that a Symbian ROM image compiled for target hardware can be run and debugged on a PC.
Syborg is a Symbian baseport for use with QEMU. You must build the Syborg baseport into your ROM image to run and debug it on QEMU.
The combination of QEMU and Syborg is known as the Symbian Virtual Platform (SVP)
Note: The Syborg baseport builds and runs with both Symbian^2 and Symbian^3 PDKs. The instructions on this page were written for PDK versions before 2.0.0, this version and all future versions include Syborg, although you may still want to use Mercurial to fetch a more recent version, so the instructions are still relevant. To get running with QEMU quickly read the Kernel & Hardware Services Quick Start. If you want to modify and extend QEMU for Symbian or the Syborg baseport then keep reading this page.
Contents |
QEMU
QEMU is open source software.
Getting QEMU
You can download a working binary version for Windows directly from here.
You can also obtain QEMU in source form, either in its original form or with Symbian modifications.
- The source that we used during the development of Syborg is available in the Symbian Foundation Mercurial Repository here. Find instructions for building it below.
- You can download the latest source from http://savannah.nongnu.org.
To compile QEMU for Windows you also require the full MinGW (Minimalist GNU for Windows) environment: see below for download instructions.
Compiling QEMU from the FCL
Setting up MinGW on Windows for building QEMU
- Download and install MinGW and related components from http://sourceforge.net/projects/mingw/files/
- Download and install MinGW
- Open http://sourceforge.net/projects/mingw/files/
- Go to "Automated MinGW Installer"->"MinGW 5.1.5"
- Download MinGW-5.1.5.exe
- Double click on MinGW-5.1.5.exe to install
- Download and install MSYS base system
- Open http://sourceforge.net/projects/mingw/files/
- Go to MSYS Base System->Current Release_ MSYS-1.0.11
- Download MSYS-1.0.11.exe
- Double click MSYS-1.0.11.exe to install
- Download and install MSYS bison
- Open http://sourceforge.net/projects/mingw/files/
- Go to "MSYS bison"->bison-2.4.1-1
- Download bison-2.4.1-1-msys-1.0.11-bin.tar.lzma, will be downloaded as bison-2.4.1-1-msys-1.0.11-bin.tar.lzma.tar
- Extract bison-2.4.1-1-msys-1.0.11-bin.tar.lzma.tar to bison-2.4.1-1-msys-1.0.11-bin.tar.lzma using 7-Zip
- Extract bison-2.4.1-1-msys-1.0.11-bin.tar.lzma to bison-2.4.1-1-msys-1.0.11-bin.tar folder using 7-Zip
- Copy the folder bison-2.4.1-1-msys-1.0.11-bin.tar to C:\msys
- Add C:\msys\bison-2.4.1-1-msys-1.0.11-bin.tar to system PATH in the begining
- Download and install MSYS flex similar to MSYS bison
- Download and install MSYS regex-1 (note: not regex-0!) similar to MSYS bison
- Open the MSYS shell using window's Start->All Programs->MinGW->MSYS->MSYS, use this shell for all the operations mentioned below
- In order to get the compiler and linker to find the appropriate header files that each component exports you need to set CFLAGS and LDFLAGS in the environment
- in /etc/profile, add the lines (without the outer set of quotes) "export CFLAGS="-I/usr/local/include"" and "export LDFLAGS="-L/usr/local/lib""
- remember to close and open the shell again after this stage so it picks up the new variables, otherwise you'll see problems building libpng where it depends on zlib
| Warning Make sure /c/MinGW/bin and /c/MinGW/include is added to the PATH, otherwise build of some of the components might FAIL |
Building QEMU
- Build all the dependancies for QEMU using MSYS shell (expat, zlib, libpng, libsdl), before building QEMU (Assuming x: is the subst drive for PDK)
- Build expat-2.0.0
- cd /x/sf/os/QEMU/symbian-qemu-0.9.1-12/expat-2.0.0
- ./configure
- make
- make install
- Build zlib-1.2.3
- cd /x/sfos/QEMU/symbian-qemu-0.9.1-12/zlib-1.2.3
- ./configure
- make
- make install
- Build libpng-1.2.32
- cd /x/sf/os/QEMU/symbian-qemu-0.9.1-12/libpng-1.2.32
- ./configure
- make
- make install
- Build libsdl-trunk
- cd /x/sf/os/QEMU/symbian-qemu-0.9.1-12/libsdl-trunk
- ./configure
- make
- make install
- Rename the x:/sf/os/QEMU/symbian-qemu-0.9.1-12/python-win32-2.6.1/lib directory to something else, then rename libs to lib (since the qemu build is expecting to find the .lib files in the python lib directory, not the libs directory)
- Build QEMU, using MSYS shell
- The python source doesn't seem to build cleanly, so just use the binary win32 distribution instead (no building necessary, just need to tell QEMU where it is in the qemu configure step)
- cd /x/sf/os/QEMU/symbian-qemu-0.9.1-12/qemu-symbian-svp
- ./configure --target-list=arm-softmmu --with-python=/x/sf/os/QEMU/symbian-qemu-0.9.1-12/python-win32-2.6.1 --audio-drv-list="sdl"
- make
- make install
If all went well the QEMU executable can now be found at arm-softmmu\qemu-system-arm.exe
| Note To install on Windows Vista you must change the installation directory from /c/Program Files/Qemu to /c/Qemu. This has to be changed in /x/sf/os/QEMU/symbian-qemu-0.9.1-12/qemu-symbian-svp/config-host.mak. Edit the prefix variable |
Running QEMU
QEMU uses python plugins to describe peripherials. Naturally, this implies that QEMU links with the python library and loads python modules. You'll need to set two variables to run the executable you built.
- find the right version of the python library on your machine. On Windows, you'll need to add this path to your PATH variable.
- Python introduced a similar variable to find its modules called PYTHONPATH. If you see an error like this...
+ '/c/Program Files/Qemu/qemu-system-arm.exe' /c/Symbian/QEMU/syborg.img 'import site' failed; use -v for traceback ImportError: No module named qemu_arm_plugins
most likely you haven't got it set correctly.
If you're using a shell from Msys, you can set it like this.
#!/bin/sh
SYBORG_HOME=/c/Symbian/pdk/v2.0e-qemu/sf/os/QEMU/symbian-qemu-0.9.1-12
export PATH=${SYBORG_HOME}/python-win32-2.6.1:${PATH}
export PYTHONPATH=${SYBORG_HOME}/qemu-symbian-svp/plugins:${SYBORG_HOME}/python-win32-2.6.1/lib_py
Syborg
Compiling the Syborg baseport
Syborg is available in this FCL repository: http://developer.symbian.org/oss/FCL/sf/adaptation/qemu
To build the Syborg base port, you need to clone two packages and use PDK 2.0.d or later. (In newer versions of the PDK [from x.x.x] the Syborg baseport is delivered in the PDK, if this is the case it is not necessary to clone and build the source).
mkdir \sf\os
cd \sf\os
hg clone https://developer.symbian.org/oss/FCL/sf/os/kernelhwsrv
mkdir ..\adaptation
cd ..\adaptation
hg clone http://developer.symbian.org/oss/FCL/sf/adaptation/qemu
cd \sf\adaptation\qemu\baseport\syborg
sbs -c armv5
| Note If you are using PDK 2.0.d you need to apply a workaround for [Bug 239] otherwise you will get compilation failures involving zconf.h and zlib.h. This is fixed in PDK 2.0.e. |
The hg (Mercurial) clone commands above fetch the "tip" revision of each repository. You can specify a specific revision or branch by adding an update command after calling clone, e.g. for the kernelhwsrv repository:
cd \sf\os\kernelhwsrv
hg update -r RCL_1
| Warning In Windows Vista, there might be permission issues with the files kasyborg.dso, kasyborg.lib, _syborg_ekdata.dso and _syborg_ekdata.lib in x:/epoc32/release/armv5/udeb. Change the permissions to 666 using chmod 666 <file name> |
Building a Syborg image
Use the minimal text shell ROM and the baseport ROM building tools
cd \sf\os\kernelhwsrv\kernel\eka\rombuild
rom --variant=syborg --inst=armv5 --build=udeb --type=tshell
This should produce a file called SYBORGARMV5D.IMG in the same directory, but you may first have to edit /x/sf/os/kernelhwsrv/kernel/eka/rombuild/user.iby to comment out btrace.exe and dptest.dll unless we've fixed Bug 247 (S^2)/Bug 472 (S^3). You may also need to comment out emmcptn.dll as it is dependent on epbusm.dll which is not available.
| Note The fix for Bug 247 has been submitted, but to create btrace.exe and dptest.dll you must build the \kerneltest\e32utils component before building the ROM. e.g. cd \sf\os\kernelhwsrv\kerneltest\e32utils\group\ |
Running a Syborg image
The Syborg board description is in the FCL baseport/syborg/syborg.dtb.
There is a Python module called qemu_arm_plugins which defines the peripheral models. The module is supplied in the prebuilt binary in share\qemu\plugins, but QEMU is expecting to find it using a path relative to the current directory, so you need to run the QEMU exe from the bin directory.
cd symbian-qemu-0.9.1\bin
arm-none-symbianelf-qemu-system.exe -M j:\sf\adaptation\QEMU\baseport\syborg\syborg.dtb -kernel j:\sf\os\kernelhwsrv\kernel\eka\rombuild\SYBORGARMV5.IMG
Viewing RDebug output
The RDebug::Print() output on Syborg is routed to "serial0", and can be viewed by pressing Ctrl-Alt-3 to switch displays. Pressing Ctrl-Alt-1 switches back to the normal display.
Stop-mode debugging on QEMU in an Eclipse environment
For information about how to set up your SVP environment for debugging see QEMU & Syborg Debugging
Mapping a directory on the host OS to the QEMU S: drive
A very useful feature of QEMU is the ability to map a directory on the host OS to the S: drive.
To do this create a directory called svphostfs in the root of the current working directory when QEMU is run. For example, if the current working directory is C:, create C:\svphostfs. You must restart QEMU after creating this directory for the drive to appear in QEMU.
Files can be copied to the S: drive in the emulated Symbian OS environment and they will appear here. This makes retrieval of logs very straightforward.
Additionally you can copy files to the mapped directory (i.e. 'svphostfs') and then copy them to the appropriate location in the Symbian OS instance. You can even create a directory 'svphostfs\sys\bin' and copy binaries there to make them usable in the Symbian OS. This feature reduces much of the need for building ROM images.
SVP support for Cortex-A8 CPU models
The SVP supports Cortex-A8 CPU models, and the Thumb2 instruction set.
In order to build a ROM with Thumb2 instructions you need to to the following
- Get RVCT3 /RVCT4-Change your environment variables etc to make sure this version of RVCT is used
- sbs -c armv7
- To build a textshell ROM : rom --variant=syborg --inst=armv7 --build=udeb --type=tshell -d RVCT3_1
Additional Resources
September Workshop
Presentation slides from a workshop given in September 2009 are available here.
Blog Article
Article from Tyson Key (November 2009)
SEE Presentation (Slides and Video)
- Video (Johnathan White presenting at SEE 2009 in October)
- Presentation (Slides from the same presentation)
Still to be done...
Comments
Contents |
Thirua said...
Bdonegan said…
Note: To access the files in the Qemu environment from Windows, you need to create a folder called svphostfs in the root of the drive from which Qemu is run, i.e. 'C:\svphostfs' if Qemu is run from 'C:\apps\symbian-qemu\bin'. Then copy the files you want to view to the S: drive in Qemu.
--Bdonegan 11:45, 16 October 2009 (BST)
Bdonegan said…
Added the info on S: drive mapping to the main article.
--Bdonegan 12:53, 17 October 2009 (BST)
Johnk said…
Mapping a drive is a very welcome addition. The phrase "run from" is an unfortunate choice. What does it mean? QEMU is an executable which is located on a disk drive. It will always be "run from" that directory. Are we looking for this drive? Alternatively, this might be referenced to the current working directory which is unambiguous.
--Johnk 23:35, 20 October 2009 (BST)
Markw said…
Yes, it believe it really means the drive which contains the current working directory when you run QEMU - this is important because it's common to use subst'ed drives when working with Symbian platform builds on Windows. If you stay in your subst'ed drive and launch the executable either by having the symbian-qemu\bin directory in your path, or explicitly specifying the whole path, then I think the svphostfs directory needs to be on the subst'ed drive, whether the QEMU binary is there or not. Feel free to double check and update the text.
--Markw 12:45, 21 October 2009 (BST)
Bdonegan said…
It's the current working directory when QEMU is run, so as Mark said if you run it from the subst'ed X: drive by giving the full path to QEMU, like so:
x:>c:\apps\symbian-qemu\arm-none-symbian-elf...
then x:\svphostfs should be created
--Bdonegan 09:40, 6 November 2009 (UTC)
Louis nayegon said…
Added creation and use of adaptation folder in Compiling the Syborg baseport
--Louis nayegon 08:44, 26 November 2009 (UTC)
Jruokonen said…
If you are using MinGW and have a Logitech Webcam, the webcam software can cause MinGW to produce weird errors when trying to build the dependancies. Stop the “Logitech Process Monitor” service or just uninstall the whole software as I did.
--Jruokonen 10:17, 7 December 2009 (UTC)
Nagano said…
Will the SVP support Cortex-A9 CPU models? I think A8 and A9 for the so many differences not to exist. And how do you think about multicore for the SVP?
--Nagano 11:31, 7 January 2010 (UTC)
Pavan 26 said…
Can you please provide me the path to dowload latest QEMU package which can be built to verify the audio driver changes.
I cannot find the folder "qemu-symbian-svp" in the latest download from FCL. I am not able to build qemu-system-arm.exe by following the instructions using the package from PDK^2
--Pavan 26 05:24, 11 March 2010 (UTC)
Sign in to comment…





I guess it will be beneficial for the new comers to see an image of symbian running on QEMU SVP. The document "Using the SVP" mentions about a prebuilt ROM image (syborg_001.techview.IMG). I cannot find this prebuilt ROM image or may be I am missing something.
--Thirua 09:32, 15 September 2009 (BST)