Emulator

Differences between revisions 21 and 22
Revision 21 as of 2013-11-13 19:34:37
Size: 3610
Editor: vorlon
Comment: add a ToC
Revision 22 as of 2013-11-14 19:55:51
Size: 4326
Editor: 186
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
= Get the pre-built emulator =
= Getting the emulator =

== Installing
the pre-built emulator ==
Line 17: Line 20:
= Use the emulator = == Building from scratch ==

To build
{{{
$ sudo apt-get install phablet-tools git bzr

$ # install android build-dependencies
$ sudo apt-get build-dep android

$ # if we're on amd64, we need to pull in certain 32-bit packages explicitly
$ sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev:i386 zlib1g-dev:i386

$ # and then work around the fact that libgl1-mesa-dev isn't Multi-Arch: same yet
$ sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so

$ mkdir -p emulator/
$ phablet-dev-bootstrap emulator
$ cd emulator
$ source build/envsetup.sh
$ lunch cm_goldfish-eng
$ mka
}}}

To generate sdcard with the ubuntu rootfs
{{{
$ ./build/tools/build-emulator-sdcard.sh
}}}

Launch emulator with serial console:
{{{
$ emulator -verbose -gpu on -system $OUT/system.img -memory 512 -show-kernel -shell -no-jni -qemu -cpu cortex-a8
}}}

As of 2013/11/05 there is a bug in the goldfish kernel wrt !AppArmor, so you may want to launch with !AppArmor disabled until this issue is resolved:
{{{
$ emulator -verbose -gpu on -system $OUT/system.img -memory 512 -show-kernel -shell -no-jni -qemu -cpu cortex-a8 -append 'apparmor=0'
}}}

You can also use the run-emulator script:
{{{
$ ./build/tools/run-emulator.sh
}}}

Username & password are:
{{{
phablet
phablet
}}}

To update your existing working tree to pull in new changes from the server, run {{{repo sync}}}.

For more information about how to use the repo command to manage your android working tree, see [[http://source.android.com/source/using-repo.html|this page]].

= Using the emulator =
Line 29: Line 85:
The terminal where the wrapper script is started from should eventually give one console into Android container The terminal will start an Ubuntu console by default, which can be used as any virtual console. Just be aware that hiiting Control + C will stop the emulator.

 * SSH access
SSH is enabled by default in the emulator, but you can only access it via localhost (QEMU handles the routes and NAT internally). All you need is to forward the target SSH port to a known port at your host:
{{{
$ adb forward tcp:9999 tcp:22
$ ssh phablet@localhost -p 9999
}}}
Line 64: Line 127:
= Building from scratch = == Known Issues ==
Line 66: Line 129:

To build
{{{
$ sudo apt-get install phablet-tools git bzr
$ # install android build-dependencies
$ sudo apt-get build-dep android
$ # if we're on amd64, we need to pull in certain 32-bit packages explicitly
$ sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev:i386 zlib1g-dev:i386
$ # and then work around the fact that libgl1-mesa-dev isn't Multi-Arch: same yet
$ sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so
$ mkdir -p emulator/
$ phablet-dev-bootstrap emulator
$ cd emulator
$ . ./build/envsetup.sh
$ lunch cm_goldfish-eng
$ make -j12
}}}

To generate sdcard with the ubuntu rootfs
{{{
$ ./build/tools/build-emulator-sdcard.sh
}}}

Launch emulator with serial console:
{{{
$ emulator -verbose -gpu on -system $OUT/system.img -memory 512 -show-kernel -shell -no-jni -qemu -cpu cortex-a8
}}}

As of 2013/11/05 there is a bug in the goldfish kernel wrt !AppArmor, so you may want to launch with !AppArmor disabled until this issue is resolved:
{{{
$ emulator -verbose -gpu on -system $OUT/system.img -memory 512 -show-kernel -shell -no-jni -qemu -cpu cortex-a8 -append 'apparmor=0'
}}}

You can also use the run-emulator script:
{{{
$ ./build/tools/run-emulator.sh
}}}

Username & password are:
{{{
phablet
phablet
}}}

To update your existing working tree to pull in new changes from the server, run {{{repo sync}}}.

For more information about how to use the repo command to manage your android working tree, see [[http://source.android.com/source/using-repo.html|this page]].
 * Powerd is disabled by default as suspending & resuming corrupts the root filesystem.
 * Unity8 is also disabled by default as it's still crashing during start-up. Once the issue is fixed, it'll be enabled by default. To start Unity8 manually just use SSH (as phablet) and call ''start unity8''.

Getting the emulator

Installing the pre-built emulator

  • Install android-emulator package in Trusty
  • Copy out emulator to read/write directory
  • Generate sdcard
  • Run the emulator

$ sudo apt-get install android-emulator
$ cp -r /usr/share/android/emulator/ ~/
$ cd ~/emulator/
$ ./build-emulator-sdcard.sh
$ ./run-emulator.sh

Building from scratch

To build

$ sudo apt-get install phablet-tools git bzr

$ # install android build-dependencies
$ sudo apt-get build-dep android

$ # if we're on amd64, we need to pull in certain 32-bit packages explicitly
$ sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev:i386 zlib1g-dev:i386

$ # and then work around the fact that libgl1-mesa-dev isn't Multi-Arch: same yet
$ sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so

$ mkdir -p emulator/
$ phablet-dev-bootstrap emulator
$ cd emulator
$ source build/envsetup.sh
$ lunch cm_goldfish-eng
$ mka

To generate sdcard with the ubuntu rootfs

$ ./build/tools/build-emulator-sdcard.sh

Launch emulator with serial console:

$ emulator -verbose -gpu on -system $OUT/system.img -memory 512 -show-kernel -shell -no-jni -qemu -cpu cortex-a8

As of 2013/11/05 there is a bug in the goldfish kernel wrt AppArmor, so you may want to launch with AppArmor disabled until this issue is resolved:

$ emulator -verbose -gpu on -system $OUT/system.img -memory 512 -show-kernel -shell -no-jni -qemu -cpu cortex-a8 -append 'apparmor=0'

You can also use the run-emulator script:

$ ./build/tools/run-emulator.sh

Username & password are:

phablet
phablet

To update your existing working tree to pull in new changes from the server, run repo sync.

For more information about how to use the repo command to manage your android working tree, see this page.

Using the emulator

After starting the emulator with the wrapper script following should be available

  • Adb

Emulator will appear in the output of $ adb devices, and will, once fully booted allow

$ adb shell

access into ubuntu.

  • Serial console

The terminal will start an Ubuntu console by default, which can be used as any virtual console. Just be aware that hiiting Control + C will stop the emulator.

  • SSH access

SSH is enabled by default in the emulator, but you can only access it via localhost (QEMU handles the routes and NAT internally). All you need is to forward the target SSH port to a known port at your host:

$ adb forward tcp:9999 tcp:22
$ ssh phablet@localhost -p 9999
  • Telnet access

Once launched graphical window title will show a port number, e.g. 5554. Connect to that over telnet, to send hardware events to the emulator

$ telnet 127.0.0.1 5554
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
help
Android console command help:

    help|h|?         print a list of commands
    event            simulate hardware events
    geo              Geo-location commands
    gsm              GSM related commands
    cdma             CDMA related commands
    kill             kill the emulator instance
    network          manage network settings
    power            power related commands
    quit|exit        quit control session
    redir            manage port redirections
    sms              SMS related commands
    avd              control virtual device execution
    window           manage emulator window
    qemu             QEMU-specific commands
    sensor           manage emulator sensors

try 'help <command>' for command-specific help
OK

Known Issues

  • Powerd is disabled by default as suspending & resuming corrupts the root filesystem.

  • Unity8 is also disabled by default as it's still crashing during start-up. Once the issue is fixed, it'll be enabled by default. To start Unity8 manually just use SSH (as phablet) and call start unity8.

Touch/Emulator (last edited 2016-04-15 03:17:10 by tsimonq2)