QEMUx86 Emulator for Linux
Version added 28-Jun-2018| Modified 05-Mar-2019
webOS provides an emulator that enables you to test the webOS application and platform on a virtual environment. With the emulator, you can test major features of webOS on your PC without the need of a physical device such as Raspberry Pi (RPi).
To use the emulator, you must take the following steps:
First thing to do is build a disk image of webOS OSE for QEMUx86. The image will be created as webos-image-qemux86.vmdk.
Make sure that your system meets the Build System Requirements.
Upgrade all the installed packages to the latest version.
$ sudo apt-get update
$ sudo apt-get upgrade
If Git is not installed, install the package with an -f option to correct a possible broken dependencies.
$ sudo apt-get -f install git
Build the Image for QEMUx86
To build the webOS OSE image for QEMUx86, run the following commands one by one. Note that qemux86 is used as a parameter to the mcf command.
$ git clone https://github.com/webosose/build-webos.git
$ cd build-webos
$ sudo scripts/prerequisites.sh
$ ./mcf -p 0 -b 0 qemux86
$ source oe-init-build-env
$ bitbake webos-image
After the build is successfully completed, the image will be created at BUILD/deploy/images/qemux86/webos-image-qemux86.vmdk.
You can choose to use the pre-built emulator package or you can build a custom emulator package.
Use the Pre-built Emulator Package
To use the pre-built emulator package, download or clone the pre-built emulator package from the GitHub repository.
To clone the pre-built emulator package, enter the following:
$ git clone https://github.com/webosose-emulator/prebuilt-emulator.git
If you have downloaded the package as zip, unzip the package to the location of your choice.
Build a Custom Emulator Package
Depending on the version of your Ubuntu or required libraries, you may have trouble running the pre-built emulator package. In such a scenario you can build a custom package as described here: Building a Custom Emulator Package.
Before running the emulator, make sure your PC meets the system requirements mentioned in the Release Notes. Also make sure that the above steps (1) and (2) are successfully completed.
To run the emulator:
Create a JSON configuration file.
By default, the emulator package includes a template for configuration file, webos-config-sample.json. You can create your own configuration file, webos-config.json, from the template by modifying the option values according to your environment.
Create a configuration file from the template, and edit the file.
$ cd <pre-built emulator directory path>
$ mv webos-config-sample.json webos-config.json
$ vi webos-config.json
Change the option values to the ones suitable for your environment. Especially, "vmdk_file_path" must be set to the file path of the built .vmdk image. For example, if build-webos is under your home directory, the path must be set to ~/build-webos/BUILD/deploy/images/qemux86/webos-image-qemux86.vmdk.
For detailed description of all the options in the JSON file, refer to the README file inside the package.
Run the emulator.
Use the run script (emulator) to launch the emulator.
$ ./emulator webos-config.jsonIn case of Ubuntu 18.04, you need to launch the script with sudo command, because of KVM permission.
On the host machine, you can connect to the emulator using either of the two options:
Connect from the Shell
To connect to the emulator on a Linux shell, use the command below. The port number must match the value set in the portforwarding.SSH option (default: 6622) of JSON configuration file.
$ ssh -p <PortNumber> -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@localhost
Connect from the Web Browser
To connect to the emulator using Web Inspector, connect to "localhost:<PortNumber>" on a web browser (for example, Chrome). The port number must match the value set in the portforwarding.inspector option (default: 9998) of JSON configuration file.