Editing Running Scratchbox in KVM

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-
= Preface =
+
= Running Scratchbox in KVM =
 +
 
 +
== Preface ==
This is currently (mostly) a personal notes page, but you're welcome to edit, comment and make corrections or additions to it. Hopefully (and after some editing) it might become a complete HOWTO guide at some point.
This is currently (mostly) a personal notes page, but you're welcome to edit, comment and make corrections or additions to it. Hopefully (and after some editing) it might become a complete HOWTO guide at some point.
-
This is still a work in progress, <s>meaning that I don't have a working installation yet. (I don't expect any problems in the setup though, I just have had limited time to put into this.)</s>
+
This is still a work in progress, meaning that I don't have a working installation yet. (I don't expect any problems in the setup though, I just have had limited time to put into this.)
I'm also a KVM newbie, so I could be doing some things wrong or in an unnecessarily complicated way. (Being new to this is also the reason why I decided to start writing down what I do; otherwise I'd have no way to backtrack and repeat my steps if I screw up somewhere along the way...)
I'm also a KVM newbie, so I could be doing some things wrong or in an unnecessarily complicated way. (Being new to this is also the reason why I decided to start writing down what I do; otherwise I'd have no way to backtrack and repeat my steps if I screw up somewhere along the way...)
-
== Why run scratchbox in KVM? ==
+
=== Why run scratchbox in KVM? ===
There are several reasons why you might want to do this:
There are several reasons why you might want to do this:
-
* You might be running a 64-bit distribution, and be uncomfortable force-installing 32-bit packages on it
+
* You might be running a 64-bit distribution, and be uncomfortable force-installing 32-bit packages on it (or at least unwilling to reboot in order to set the vdso32=0 parameter which is apparently required for the current Maemo 5 SDK)
* You might not like installing software that hasn't gone through your distro's usual package management and QA process
* You might not like installing software that hasn't gone through your distro's usual package management and QA process
* You might want to be able to snapshot your environment when it's ready, to be able to reinstall easily and/or migrate it to another machine.
* You might want to be able to snapshot your environment when it's ready, to be able to reinstall easily and/or migrate it to another machine.
Line 21: Line 23:
* Or using a separate, standalone, non-virtualized installation would of course work too, if you have a machine to spare for that or don't mind rebooting, but that's beside the point of this article.
* Or using a separate, standalone, non-virtualized installation would of course work too, if you have a machine to spare for that or don't mind rebooting, but that's beside the point of this article.
-
= Requirements =
+
== Requirements ==
Firstly, your CPU must support virtualization. This can be checked with:
Firstly, your CPU must support virtualization. This can be checked with:
-
  $ egrep '^flags.*(vmx|svm)' /proc/cpuinfo
+
  $ grep -e vmx -e svm /proc/cpuinfo
Second, you need the modules '''kvm''' and either '''kvm-amd''' or '''kvm-intel''' available and loaded.
Second, you need the modules '''kvm''' and either '''kvm-amd''' or '''kvm-intel''' available and loaded.
Line 38: Line 40:
and do rest of your user-privileged setup in that terminal.
and do rest of your user-privileged setup in that terminal.
-
= Installation =
+
== Installation ==
-
Also refer to [http://www.linux-kvm.org/page/Documents the KVM documentation] and [http://www.linux-kvm.org/page/FAQ FAQ].
+
Also refer to [http://www.linux-kvm.org/page/Documents the KVM documentation].
-
TODO: Check the [http://www.linux-kvm.org/page/Management_Tools Management tools] listed on the KVM pages, to see if there's some better way for the setup. At least [http://sourceforge.net/projects/aqemu/ AQEMU] looks promising.
+
=== Network ===
-
 
+
-
== Network ==
+
As we're not setting up a virtual server farm here, you probably won't want to bridge your physical network interface; a virtual network will do just fine.
As we're not setting up a virtual server farm here, you probably won't want to bridge your physical network interface; a virtual network will do just fine.
Line 66: Line 66:
Now we're all set, proceed to:
Now we're all set, proceed to:
-
== Creating the virtual machine, option one ==
+
=== Creating the virtual machine, option one ===
There are at least two ways to initialize the virtual machine. The first one I tried was - if my memory (er, shell history) serves me right:
There are at least two ways to initialize the virtual machine. The first one I tried was - if my memory (er, shell history) serves me right:
Line 78: Line 78:
Also note that you could as well give a path to a bootable ISO image, but I happened to have a Deian-Lenny install CD lying around, so I used that.
Also note that you could as well give a path to a bootable ISO image, but I happened to have a Deian-Lenny install CD lying around, so I used that.
-
== Creating the virtual machine, option two ==
+
=== Creating the virtual machine, option two ===
I actually didn't finish the installation with the above command line, deciding instead to install newer versions of kvm and the tools from unstable - to check if the booting issue would be fixed. It wasn't, but with virt-manager 0.8.0-2 it's possible to create virtual machines through the GUI. (Actually I'm not sure if the version I had from 'testing' might have included that as well, but if it did, I didn't notice. Like said these are my installation notes, please comment or fix if what I'm saying is not correct.)
I actually didn't finish the installation with the above command line, deciding instead to install newer versions of kvm and the tools from unstable - to check if the booting issue would be fixed. It wasn't, but with virt-manager 0.8.0-2 it's possible to create virtual machines through the GUI. (Actually I'm not sure if the version I had from 'testing' might have included that as well, but if it did, I didn't notice. Like said these are my installation notes, please comment or fix if what I'm saying is not correct.)
Line 88: Line 88:
So off to the virt-manager GUI. Most of the setup is pretty straightforward and won't be covered here in detail, but unfortunately this has a couple of gotchas too:
So off to the virt-manager GUI. Most of the setup is pretty straightforward and won't be covered here in detail, but unfortunately this has a couple of gotchas too:
* The GUI insists on creating your disk image in /var/lib/libvirt/images. This may be a problem if your /var is on a separate partition, and doesn't have enough space free.
* The GUI insists on creating your disk image in /var/lib/libvirt/images. This may be a problem if your /var is on a separate partition, and doesn't have enough space free.
-
** To work around this, I bind-mounted $HOME/kvm there (a symlink didn't seem to do the trick, for some reason). Unfortunately the GUI still tries to be a bit too smart and limits the maximum image size to the space available on /var, so additionally you'll have to grep the python scripts included in the '*virt*' packages for the above path, and replace it with the real physical path in your homedir. I think there were two such files. (I could be wrong, but only editing them also didn't seem to work without the bind-mount.)
+
** To work around this, I bind-mounted $HOME/kvm there (a symlink didn't seem to do the trick, for some reason). Unfortunately the GUI still tries to be a bit too smart and limits the maximum image size to the space available on /var, so additionally you'll have to grep the python scripts included in the '*virt*' packages for the above path, and replace it with the real physical path to your homedir. (I could be wrong, but doing only this also didn't seem to work without the bind-mount.)
** A better workaround could be selecting to use an existing image file, if you have one from a previous virt-install attempt or can figure out the right command to create it otherwise, but I didn't try that...
** A better workaround could be selecting to use an existing image file, if you have one from a previous virt-install attempt or can figure out the right command to create it otherwise, but I didn't try that...
* Unless the cdrom booting issue has been fixed by the time you're doing this, your virtual machine will start but you will be greeted with the "No bootable device" message on the vnc console.
* Unless the cdrom booting issue has been fixed by the time you're doing this, your virtual machine will start but you will be greeted with the "No bootable device" message on the vnc console.
-
** To fix this, shut down (or force off) the virtual machine, and enter "virsh edit sb". Find the cdrom definition in the XML and change its bus attribute from 'virtio' to 'ide'. While you're at it, you might replace the path for the disk image with the real location, so you won't need to keep the bind-mount around. Save the file and you're all set.
+
** To fix this, shut down (or force off) the virtual machine, and enter "virsh edit sb". Find the cdrom definition in the XML and change its bus attribute from 'virtio' to 'ide'. While you're at it, you might replace the path for the disk image with the real location, so you won't need to keep the bind-mount around. Save the file and off you go.
-
You should now have a working virtual machine installation. Insert the installation cdrom, check that the Boot Device in virt-manager "Details" page is set to CDROM (don't forget to Apply the change if it's not), and proceed to the next step:
+
You should now have a working virtual machine installation. Insert the installation cdrom, check that the Boot Device in virt-manager "Details" page is set to CDROM (don't forget to Apply the change if it's not), and go.
-
== Installing the OS ==
+
=== Installing the OS ===
There shouldn't be anything special or noteworthy here. Just a plain normal Debian installation (you may need to change the virt-manager Boot Device back to Hard Disk after the installation is complete).
There shouldn't be anything special or noteworthy here. Just a plain normal Debian installation (you may need to change the virt-manager Boot Device back to Hard Disk after the installation is complete).
Line 103: Line 103:
This time I also installed the full Debian system in the virtual machine, complete with the GNOME desktop, OpenOffice, GIMP, Iceweasel, etc. which won't be needed on the virtual development box. So if I do this again, I'll probably use a much smaller virtual disk, and only install a minimal Debian system (and use ssh to complete the setup, instead of using the full desktop environment over vnc).
This time I also installed the full Debian system in the virtual machine, complete with the GNOME desktop, OpenOffice, GIMP, Iceweasel, etc. which won't be needed on the virtual development box. So if I do this again, I'll probably use a much smaller virtual disk, and only install a minimal Debian system (and use ssh to complete the setup, instead of using the full desktop environment over vnc).
-
One further question: I chose the default single-partition setup, which also seemed to create swap on the virtual disk. Does that ever make sense, or would it be better to just give the virtual machine "enough" ram and let the host handle swapping? How much would be enough for building stuff in the SDK? How much would be too much (with respect to the physical ram installed on the host)?
+
One further question: I chose the default single-partition setup, which also seemed to create swap on the virtual disk. Does that ever make sense, or would it be better to just give the vm "enough" ram and let the host handle swapping? How much would be enough for building stuff in the SDK?
-
 
+
-
== Installing the SDK ==
+
-
 
+
-
<s>With the OS in place, there shouldn't be anything unusual about the SDK installation either, but I didn't get that far yet. Up to now I had enough to do just learning to use KVM and working around the various bugs in the virtualization tools, and decided to stop here for today and write those steps down. If someone else has time to continue this before I do, please go ahead :-)</s>
+
-
EDIT: No problems with SDK installation, but didn't have time to continue with this page yet.
+
=== Installing the SDK ===
-
== Setting up a network filesystem ==
+
With the OS in place, there shouldn't be anything unusual about the SDK installation either, but I didn't get that far yet. Up to now I had enough to do just learning to use KVM and working around the various bugs in the virtualization tools, and decided to stop here for today and write those steps down. If someone else has time to continue this before I do, please go ahead :-)
-
To be able to edit sources on the host side (and not have to replicate my entire emacs setup). Could be done in either direction: sources on host, and exported to vm so scratchbox can access them, or sources on vm and exported to host.
+
=== Setting up a network filesystem ===
-
TODO, the biggest piece still missing from a fully functional setup. I'm not so familiar with network filesystems, any ideas what's the best way to do this?
+
To access sources stored on the host machine. TODO.
-
== Setting up Xephyr ==
+
=== Setting up Xephyr ===
-
In principle you could install Xephyr either on your host or in the virtual machine. I'm currently running it in the virtual machine over ssh, e.g.
+
TODO.
-
ssh -X ip.of.virtual.machine Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -kb
+
-
and then the usual "export DISPLAY=:2" and "af-sb-init.sh start" in scratchbox.
+
-
== OpenGL with the virtual setup ==
+
=== OpenGL with the virtual setup ===
TODO. Possible?
TODO. Possible?
-
== Finetuning ==
+
=== Finetuning ===
Putting the necessary steps from above into scripts so that the setup is easy to restart after a reboot. Maybe other scripts or tools to make the initial setup easier, or even a ready-to-run SDK image, if some kind person at Nokia or in the community decides to create such things? TODO.
Putting the necessary steps from above into scripts so that the setup is easy to restart after a reboot. Maybe other scripts or tools to make the initial setup easier, or even a ready-to-run SDK image, if some kind person at Nokia or in the community decides to create such things? TODO.
[[Category:Development]]
[[Category:Development]]
-
[[Category:Scratchbox]]
 

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)