Emulating the XO/Help and tips: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Have the network started on QEMU)
(Backout my page freeze. I'm going to try a different approach.)
Line 1: Line 1:
'''DO NOT EDIT THIS PAGE. It is frozen. It will shortly become a redirect to [[Emulating_the_XO/Troubleshooting]].'''

More often than not, technology manages to get us 95% of the way... being the last 5% a mix of magical incantations, rituals and other esoteric activities only clear to the initiated. This page tries to take some of the magic away from the ''sufficiently advanced science''
More often than not, technology manages to get us 95% of the way... being the last 5% a mix of magical incantations, rituals and other esoteric activities only clear to the initiated. This page tries to take some of the magic away from the ''sufficiently advanced science''



Revision as of 14:54, 26 May 2007

More often than not, technology manages to get us 95% of the way... being the last 5% a mix of magical incantations, rituals and other esoteric activities only clear to the initiated. This page tries to take some of the magic away from the sufficiently advanced science

  If you want to use nano for system file edits,
  make sure line wrap is disabled by Alt-L 
  (or look here for it's documentation).

My emulator is very slow

Are you using the kqemu or qvm accelerator modules? You do have to have administrator rights to install the services. QEMU manager (in Windows) knows to start these services according to your profile settings. See Qemu on Windows and QEMU Home Page

KQEMU

Does the version of the QEMU support KQEMU? Type ctrl+alt+2 and type info kqemu. Use ctrl+alt+1 to return to OLPC screen. On x86_64 you must run qemu-system-x86_64 instead of qemu.

On FC 6, as of 2007-May-13, at least on x86_64, there do not seem to be any official kqemu, or kqemu kernel module, rpms. atrpms.net has some. Or install from source. Without the module, running

qemu-system-x86_64 -kernel-kqemu ...

will report

Could not open '/dev/kqemu' - QEMU acceleration layer not activated

After installing and modprobe'ing, I get a 3x speedup in booting (to 45 sec), and a 5x in starting the webrowser (to 7 sec). It actually feels usable. MitchellNCharity 17:25, 13 May 2007 (EDT)

Configuring X

  • In some builds X is configured to load the Geode driver by default. You need to modify it to load the frame buffer driver instead. In /etc/X11/xorg.conf, go to the "Device" section and change the Driver setting from "amd" to "fbdev"
  • You can then change XKbLayOut in the same file to your keyboard code with for example nano text editor by
  nano /etc/X11/xorg.conf


Setting Framebuffer resolution

NOTE: If you don't set the VGA kernel parameter to 0x317 (in order to get a 1024x768 with 64k colors) you will NOT be able to view / use Etoys properly.

In order to set the framebuffer's VGA kernel parameter you must edit /boot/grub/grub.conf according to the following table:

VGA kernel color / resolution table
Colors 640x480 800x600 1024x768 1280x1024
256 0x301 0x303 0x305 0x307
32k 0x310 0x313 0x316 0x319
64k 0x311 0x314 0x317 0x31A
16M 0x312 0x315 0x318 0x31B

Sound

Latest images add support of sound. Emulation does not work properly with Tam-Tam, yet, even with kqemu at 2 GHz Pentium4 (performance or insufficient emulation issue?). Maybe somebody could install Csound in host and pipe sound over the virtual network? Windows version can be found in Cecilia and Csound for Windows installer --Tonyv

Keyboard and Mouse

A typical case is that their keyboard and mouse don't work. A solution to the problem is:

  1. Make sure the the window has the focus (label should say QEMU - Press Ctrl-Alt to exit grab).
  2. Press Alt + Ctrl + 1 (or Alt + Ctrl + 3) to enter the terminal mode of the OLPC. Notice that QEMu seems to respond better to by pushing first down Ctrl, after Alt and finally the number.
  3. Make sure that you're logged in.
    • If not, just hit enter and it'll ask you to.
    • Login as root (no password is required)
  4. Type modprobe i8042 (oddly, you may need to try this multiple times before it works, so keep trying!)

Tty1 ps.PNG

  1. Press Alt + Ctrl + 7 to return to the graphical mode of the OLPC.
  2. Your keyboard and mouse should be working fine.
    • Usually the result is a continuous series of 1's will flow (as if the key is stuck)
    • Just hit any key (to stop it) and delete the offending 1's

Alternatively you can use the developers console and su command. I have not been able to bring up the terminal in most images. Quote from BTest-1_Release_Notes :

 The terminal (activity) does not appear on the Frame, but can be launched by typing Alt-Shift-F11. 
 (F11 is found in the 3rd position from the left in the Volume Slider key.)
 Note that on some newer builds, the terminal window (Memphis) is launched by typing Alt-Shift-F12.
 In even more recent builds, e.g., Build 224, Memphis is launched by typing
 Alt-View_Source or Alt-F12. 

See also Sugar Instructions:Terminal --Tonyv 01:24, 13 January 2007 (EST)

Network

Chances are that the network will not be enabled. Following are two possible ways to enable it.

Enabling the Network Alternative #1

When the emulator is starting GRUB boot loader, press a key.

  1. Choose then the Qemu line with arrow keys.
  2. Press E
  3. Move to the 'Kernel' line and press End
  4. Add Space 1 to end of the line
  5. Press Enter
  6. Press B

You will be automaticaly log in as superuser in terminal (in single user mode).

You can start network and put your local keyboard layout command there like this (using tabulator key to complete the filenames):

  echo ifup eth0 >> /etc/rc.local

or

  #(change ONBOOT from "no" to "yes")
  nano /etc/sysconfig/network-scripts/ifcfg-eth0
  #(disable NetworkManager)
  mv /etc/rc5.d/S98NetworkManager /etc/rc5.d/K98NetworkManager

On build 432, the following is also needed to have the network automatically started on bootup:

  mv /etc/rc5.d/K90network /etc/rc5.d/S10network

It also helps sugar to find other people automatically upon startup.

Put your own keyboard layout for text terminals

  echo loadkeys Your_two_letter_country_code >> /etc/rc.local
  . /etc/rc.local

Type Ctrl-D to continue normal boot.

Keyboard layout and network should work automatically every time you start the QEMU image. --Tonyv 01:52, 13 January 2007 (EST)

Enabling the Network Alternative #2

 Make sure the the window has the focus (label should say QEMU - Press Ctrl-Alt to exit grab).
 If the following keys do not work try pushing also the Shift key down to exit the Sugar environment. 
 If it does not work see the sendkey method of Alternative #3
  1. Press Alt + Ctrl + F1 to enter the terminal mode of the OLPC.
  2. Make sure that you're logged in.
    • If not, just hit enter and it'll ask you to.
    • Login as root (no password is required)
  3. Type dhclient and press return.
  4. Press Alt + Ctrl + F7 to return to the graphical mode of the OLPC.
  5. Your browser / network connection should be working fine.

Enabling the Network Alternative #3

The steps below work on QEmu regardless of which operating system you are running.

If you are having trouble getting an internet connection inside QEmu:

Get the image running in QEmu so that you can see the normal view with the XO icon in the middle. Empty no apps no frame.png

Make sure your mouse is active in QEmu, then press ctrl+alt+2 together.

This will bring up a screen like a command line, called the QEmu monitor.

Type the following:

sendkey ctrl-alt-f1

And press return.

Then with the keyboard hold down the following keys: ctrl+alt+7

Another text based screen will appear, asking you to log-in. Sometimes there can be an extra "1" after the word "Login:", just delete it. Type root and press return

Then type:

dhclient

or

ifup eth0:

You should see the screen fill with text.

QEmu running dhclent.png

Some of the numbers have been removed from the screenshot above - they're not important.

Then hold down the following keys on the keyboard: ctrl+alt+2

and type the following:

sendkey ctrl-alt-f7

Justin: Using the latest disk image (Build 385), I found that it was "ctrl-alt-f3" that returned to the Sugar interface.

Then using the keyboard, hold down the following keys: ctrl+alt+1

Now open the browser and you should have internet access.

Sugar browser with frame google home page.png OLPC 20070104.png

Logging boot messages

qemu -serial stdio -hda olpc-redhat-stream-development-ext3.img | tee boot.log

The kernel params in /boot/grup/menu.lst are already set to send to console IO to both the screen and serial ( console=ttyS0,115200 console=tty0), so -serial stdio is all it takes to have it sent to stdout.

Running sugar activities from shell

Running sugar activities from the command-line, instead of via the gui, can be useful when debugging.

Log in as root, then:

su olpc
grep export /usr/bin/sugar > /tmp/env
source /tmp/env

You can then run activities:

sugar-activity web

Leftovers

On fedora linux, to get qemu working, you may have to start the service for it. As root run:

service qemu start
Why would this be needed?? Emulation works without it. And making .exe files self launching seems unfortunate. MitchellNCharity 21:21, 23 May 2007 (EDT)

On linux, if qemu complains about insufficient space in /dev/shm then

mount -t tmpfs -o remount,size=144m none /dev/shm

On debian, We have heard multiple people say that QEMU doesn't work with these images on the debian-derived distributions. The symptom is that the kernel hangs during boot. There's a problem with bochsbios version 2.2, version 2.3 works. As a quick fix, apm=off can be added to OLPC kernel arguments. (For more info, see the discussion.)