Emulator

From Tizen Wiki
Jump to: navigation, search

This page aims to be a Community entry point on ongoing efforts related to running Tizen in VM

For official documentation check :

IMPORTANT !

If you want to use Vmware to emulate Tizen : you have yo use RAW images (for example download snapshot at http://download.tizen.org/snapshots/tizen/ivi/latest/images/atom/ivi-mbr-i586/ or http://download.tizen.org/snapshots/tizen/common/latest/images/x86_64-wayland/common-wayland-mbr-x86_64/ )

If you want to use Qemu to emulate Tizen : you have to use emulator images (for example download snapshot at http://download.tizen.org/snapshots/tizen/ivi/latest/images/emulator/ivi-mbr-i586-emul/ or http://download.tizen.org/snapshots/tizen/common/latest/images/emulator32-wayland/common-emulator-wayland-mbr-i586/ )

Tizen:Common on VMWARE : x86 (ia32 and x64)

Download VMware

Download VMware Player if you are using a Linux distribution or Microsoft Windows. Otherwise, it you are working on a Mac download VMware Fusion. Please pay attention that VMware Fusion is a paid software but you can get a free 30-day evaluation version.

Prepare Tizen image

First, follow the 3 steps of https://wiki.tizen.org/wiki/IVI/IVI_3.0_VMware but don't select "keep existing format" at the end (convert to vmx vmware extension)

1/ Setup host

On the host, install:

  • vmware qemu libtxc-dxtn-s2tc0 (ubuntu packages)
  • qemu-tools libtxc-dxtn (opensuse)
2/ Create Virtual machine

Edit the vmware vmx file and add at the end of the file:

  mks.gl.allowBlacklistedDrivers = "TRUE"

From command line :

 echo 'mks.gl.allowBlacklistedDrivers = "TRUE" ' >> ~/vmware/tizen/tizen.vmx
3/ Boot and Tune VM

start the vmware and start the virtual vmx machine

Wayland Display is working and crosswalk apps should be started from the tz-launchers

Note: if weston didn't start, open a tty and edit the /usr/lib/systemd/system/display-manager-run.service file and add to the service :

Restart=on-failure

Then, reboot

To be able to launch qml apps (qt icon in tz-launchers), add in /etc/sysconfig/weston-user :

 EGL_PLATFORM=gallium
 EGL_DRIVER=egl_gallium


Or you can set it up dynamically by adding :

 cat  /etc/profile.d/mesa.sh
 do_gallium=true
 lspci | grep 'VGA compatible controller: VMware' >/dev/null 3>&1 || do_gallium=false
 if $do_gallium ; then
 EGL_PLATFORM=gallium
 export EGL_PLATFORM
 EGL_DRIVER=egl_gallium
 export EGL_DRIVER
 fi


Notes

Video issues to solve are WIP :

Tizen:Common on qemu : ARM

See ARM page , yagl is said to be usable too.

Tizen:Common on qemu-yagl : ia32

It's working using yagl QEMU fork (need to be rebuild). The procedure below has been verified on Ubuntu 14.04 and 14.10.


Before you start please make sure that the following package are installed on the system: libxen-dev, libpixman-1-dev, libcap-dev, libcurl4-openssl-dev, libv4l-dev.

Prepare Tizen Images

Notes : You need to download here http://download.tizen.org/releases/daily/tizen/common/tizen-common_20141223.1/images/emulator32-wayland/common-emulator-wayland-mbr-i586/ the two following files in your home directory

1) The image you want to launch, containing graphical yagl support (after download, extract it in your home directory) :

  • Tizen:Common:

http://download.tizen.org/releases/daily/tizen/common/tizen-common_20141223.1/images/emulator32-wayland/common-emulator-wayland-mbr-i586/tizen-common_20141223.1_common-emulator-wayland-mbr-i586.tar.gz

  • Tizen IVI:

http://download.tizen.org/snapshots/tizen/ivi/latest/images/emulator/ivi-mbr-i586-emul/tizen-ivi_20150529.2_ivi-mbr-i586-emul.tar.gz

2) The kernel file (vmlinuz) containing graphical yagl support: wget http://download.tizen.org/releases/daily/tizen/common/latest/images/emulator32-wayland/common-emulator-wayland-mbr-i586/tizen-common_20150518.3_common-emulator-wayland-mbr-i586-vmlinuz-3.12.18-3.26-common-i386-emulator

Build QEMU with YAGL from Scratch
  • Optionally you can also create a swap partition swap.x86:
    truncate -s 1024 $HOME/swap.x86
  • Clone and build QEMU:

git clone git://review.tizen.org/sdk/emulator/qemu

cd qemu

./configure \
  --target-list=i386-softmmu \
  --enable-werror --disable-gtk \
  --audio-drv-list=alsa \
  --disable-vnc --disable-pie \
  --enable-sdl --with-sdlabi=1.2 \
  --enable-vigs --enable-yagl \
  --enable-maru --enable-libpng \
  --enable-xen --enable-virtfs

make -C tizen/src build_info && make

Note with a recent distro this won't build, with:

  CC    vl.o
vl.c: In function ‘qemu_main’:
vl.c:3062:5: error: ‘g_mem_set_vtable’ is deprecated [-Werror=deprecated-declarations]
     g_mem_set_vtable(&mem_trace);

Upstream has moved on from this usage. Function is deprecated since glib 2.46 (thus affects Ubuntu 15.10, 16.04) with this comment: This function used to let you override the memory allocation function. However, its use was incompatible with the use of global constructors in GLib and GIO, because those use the GLib allocators before main is reached. Therefore this function is now deprecated and is just a stub.

Run Tizen with QEMU with YAGL

In qemu directory edit a new file named info.ini and add the following in it (replace $USER with your username):


[[QEMU_OPTIONS]]
-M pc
-m 1024
-drive file=/home/$USER/tizen-common.img,if=virtio,index=1
-drive file=/home/$USER/swap.x86,if=virtio,index=2
-boot c
-append "console=ttyS0 root=/dev/vda rw video=LVDS-1:1366x768-32@60 ip=10.0.2.15::10.0.2.2:255.255.255.0::eth0:none vm_name=tizen sdb_port=26100"
-serial "file://dev/stderr"
-kernel /home/$USER/tizen-common_20141022.1_common-emulator-wayland-mbr-i586-vmlinuz-3.12.18-2.3-common-i386-emulator
-enable-kvm
-smp 8
-vga none
-display sdl
-soundhw all
-vigs-backend gl
-yagl-backend vigs
-enable-vigs
-enable-yagl
-device virtio-esm-pci
-device virtio-hwkey-pci
-device maru-brightness
-device maru-camera
-device virtio-touchscreen-pci,max_point=10
-usb
-usbdevice tablet
-net nic
-net user
-redir tcp:22122::22

Save and exit.

To launch the emulator image :

./i386-softmmu/qemu-system-i386 -c info.ini --resolution WxH

Note : It doesn't seem to take care of the value of --resolution, that's why I wrote "WxH" and not a real resolution,

but if you don't add this option, qemu refuses to start, the only resolution who cares is the video=LVDS-1:1366x768-32@60 ( of course you can set the resolution you want in the append line )

To connect through ssh, open a terminal and type :


ssh -p 22122 root@localhost

ps auxf | grep sdb

root       272  0.0  0.0  13352   560 ? Ssl  06:14   0:00 /usr/sbin/sdbd --emulator=tizen:26100 --connect-to=10.0.2.2:26099 
--sensors=10.0.2.2:26103 --listen-port=26101

For graphics acceleration (check /dev/dri presence and yagl logs in dmesg)

Resources :

Note :

Previous project was : git clone https://github.com/Sheph/qemu

Tizen:Common on virtualbox

As of today VirtualBox does not provide guest addition with support for Wayland and therefore Weston can not run with hardware acceleration. This restriction makes it impossible to run Tizen IVI in VirtualBox at the moment.

Instead you may try to launch Weston in software mode using frame buffer. Although it seems that this method does not work anymore you can give it a try. Download snapshots at http://download.tizen.org/snapshots/tizen/common/latest/images/ia32-wayland/common-wayland-mbr-i586/ and not emulator snapshots which are made for qemu:

weston-launch --backend=fbdev-backend.so

Tizen:Common minimal on qemu

Since May 2015, Tizen Common provides a minimal disk image for x86_64 that can be used in text mode.

The script below make it easy to use. It is available for linux. Windows contribs for this are welcome.

Its goal is to download the image using curl, prepare the disk and the script to run it using qemu.

Instructions to get and run the script.

  1. copy paste the script below in a new file
  2. make that file executable
  3. run it without arguments, at the end it summarize the work it did
  4. run the scripts indicated as "launcher"

That's all you are in. Log as root with the password indicated.

The script:

#!/bin/sh

url="http://download.tizen.org/snapshots/tizen/common/${1:-latest}/images/x86_64-wayland/common-minimal-mbr-x86_64/"

err() { echo "$*" >&2; exit 1; }

echo "scanning $url"
entries=$(curl -s "$url/" | grep 'href="tizen-common' | sed 's/.*href="\([^"]*\)".*/\1/')
for entry in $entries; do
  case "$entry" in
  *vmlinuz*) dir="${entry%_common-minimal-mbr-*}" urlvm="$url/$entry";;
  *.tar.gz) dir2="${entry%_common-minimal-mbr-*}" urltgz="$url/$entry";;
  esac
done
[ -z "$dir" -o -z "$dir2" -o "$dir" != "$dir2" ] && err bad dirs dir1=$dir dir2=$dir2

[ -d "$dir" ] || mkdir -v "$dir" || exit 1
cd "$dir"
echo "downloading vmlinuz from $urlvm"
curl -z vmlinuz -o vmlinuz "$urlvm" || exit 1
echo "downloading tizen-common.tar.gz from $urltgz"
curl -z tizen-common.tar.gz -o tizen-common.tar.gz "$urltgz" || exit 1

mkmbr() {
  head -c 446 /dev/zero
  printf '\x00\x00\x00\x00\x83\x00\x00\x00\x01\x00\x00\x00'
  printf $(printf %08x $1 | sed 's:\(..\)\(..\)\(..\)\(..\):\\x\4\\x\3\\x\2\\x\1:')
  head -c 48 /dev/zero
  printf '\x55\xAA'
}

if [ ! -f tizen-common.img ] || [ tizen-common.tar.gz -nt tizen-common.img ]; then
  echo "creation of disk image tizen-common.img"
  mkmbr $(tar ztvf tizen-common.tar.gz tizen-common.img | awk '{printf "%d", $3 / 512}') > tizen-common.img
  tar -zxOf tizen-common.tar.gz tizen-common.img >> tizen-common.img
fi

cat << EOC > run-tizen.sh
#!/bin/sh
cd \$(dirname \$0)
exec qemu-system-x86_64 -m 1024 -cpu Haswell  -enable-kvm -smp 2 \
  -usb -net nic -net user -redir tcp:22122::22 \
  -hda tizen-common.img  -kernel vmlinuz -serial stdio \
  -append 'console=ttyS0 root=/dev/sda1 rw ip=10.0.2.15::10.0.2.2:255.255.255.0::eth0:none vm_name=tizen sdb_port=26100' 
EOC
chmod +x run-tizen.sh

cat << EOC

Directory: $(pwd)
Launcher:  $(pwd)/run-tizen.sh
Login:     root
Password:  tizen

Done.
EOC

LINKS

Contacts