[SailfishDevel] Howto: Sailfish SDK in Virtual Machines on Mac OS-X
Nathan
nettym28 at gmail.com
Thu Feb 28 14:55:45 UTC 2013
Thank-you sir!
N.B.
I hope the official SDK for OSX/Win is still coming by the end of Feb,
as promised by Jolla.
On 1/03/13 12:02 AM, Martin Grimme wrote:
> Hi all,
>
> I would like to share my setup of how I managed to run the Sailfish
> SDK on Mac OS-X. While you could of course run the SDK virtual machine
> inside a Linux virtual machine, this would be terribly slow.
> Instead, you want to run all three virtual machines, Linux, MerSDK,
> SailfishOS Emulator directly on Mac OS.
>
> This setup was tested on Mac OS-X 10.8.2. It may or may not work
> similarly on a Windows host.
>
> * Install VirtualBox on your host OS. Give it at least 1.5 GB of RAM.
> After the whole setup process, you may push this down to about 500 MB,
> if desired.
>
> * Install Linux in a VirtualBox. Ubuntu 12.10 32 bit works just fine.
> Don't forget to install the guest additions as well, because we will
> have to use shared folders.
>
> * Install VirtualBox on Linux and install the Sailfish SDK afterwards.
> The suggested installation path /home/<user>/SailfishOS is fine.
> Do not install the SDK into a shared folder as shared folders don't
> support creating symlinks.
>
> * Open the VirtualBox configurator on Linux and export the two virtual
> machines 'MerSDK' and 'SailfishOS Emulator' by selecting 'File ->
> Export Appliance'. This will take some time. Move the resulting .ova
> files to your host OS (Mac OS-X in my case).
>
> * Create a directory 'MerHome' on your host OS, e.g. /Users/<user>/MerHome.
> Inside MerHome, create three directories:
>
> - emulator
> - mersdk
> - projects
>
> * Copy the SailfishOS/emulator/ssh directory from Linux into the just
> created directory 'MerHome/emulator' on the host OS.
>
> * Copy the SailfishOS/mersdk/ssh directory from Linux into the just
> created directory 'MerHome/mersdk' on the host OS.
>
> * Copy the ~/.scratchbox2 directory from Linux into the just created
> directory 'MerHome' on the host OS.
>
> * Open a terminal on Linux and pack up the targets directory:
>
> cd SailfishOS/mersdk
> tar -czf targets.tar.gz targets
>
> * Move the file targets.tar.gz to your host OS into 'MerHome/mersdk'
> and unpack it there:
>
> cd MerHome/mersdk
> tar -xzf targets.tar.gz
>
> * Open the VirtualBox configurator on your host OS and import the two
> recently exported VirtualBox appliances by selecting 'File -> Import
> Appliance'.
>
> * Edit the shared folders settings of the 'MerSDK' virtual machine:
>
> home -> <your MerHome>
> ssh -> <your MerHome>/mersdk/ssh
> targets -> <your MerHome>/mersdk/targets
>
> Make sure that you don't change the mount names during this action.
>
> * Edit the shared folder settings of the 'SailfishOS Emulator' virtual machine:
>
> ssh -> <your MerHome>/emulator/ssh
>
> Make sure that you don't change the mount name during this action.
>
> * You may optionally also want to activate audio while in the
> 'SailfishOS Emulator' settings.
>
> * Test-run the MerSDK virtual machine on the host OS. Does it come up with the
> message 'mounted home and targets successfully'? Then the shared
> folders settings ought to be OK.
> Close the virtual machine (saving machine state instead of shutdown is fine).
>
> * Add the directory 'MerHome/projects' to the shared folders of your
> Linux virtual machine. This may be done while the machine is running.
>
> * In your Linux home directory create an empty directory with the same
> name 'projects'.
>
> * As root, add the following line to /etc/fstab on Linux:
>
> projects /home/<user>/projects vboxsf rw,uid=1000,gid=1000 0 0
>
> Replace <user> with your username and use the GID and UID of the user.
> On Ubuntu, the first user normally has GID = 1000 and UID = 1000.
>
> * As root, mount the projects shared folder:
>
> mount projects
>
> * Open the VirtualBox configurator on Linux and change the host
> keyboard key in the global settings to something different than on the
> VirtualBox on your host OS.
>
> * Start the two virtual machines on Linux with the VirtualBox
> configurator. They will be very slow (as you're running VirtualBox
> inside VirtualBox), so you need to have some patience until they're
> fully loaded. Fortunately this has to be done only once. You will
> later never have to use VirtualBox inside VirtualBox again.
>
> * Record the output of VBoxManage that the Sailfish SDK expects:
>
> VBoxManage showvminfo MerSDK --machinereadable
>> /var/tmp/VBoxManage_885215c435c21d083b077b43317cc642
> VBoxManage list runningvms
>> /var/tmp/VBoxManage_59f2c7dff31ccbe383c7cc12541bdf1b
> VBoxManage showvminfo "SailfishOS Emulator" --machinereadable
>> /var/tmp/VBoxManage_16de532e1ffcdb602a512c49138ccca1
> The names of the record files contain the md5 sum of the command, so
> they must match exactly.
>
> * Stop the two virtual machines.
>
> * In the Linux virtual machine, locate your VBoxManage program. On my
> Ubuntu installation, this is '/usr/share/virtualbox/VBoxManage'.
> Become root and move the file to VBoxManage.orig.
>
> sudo su
> cd /usr/share/virtualbox
> mv VBoxManage VBoxManage.orig
>
> * Save this script as VBoxManage. It will record the output of
> VBoxManage and later replay that output for the Sailfish SDK.
>
> #! /bin/bash
>
> VBOXMANAGE=`dirname $0`/VBoxManage.orig
> COMMAND=`echo "$@" | md5sum | cut -d" " -f1`
> RECORDFILE=/var/tmp/VBoxManage_${COMMAND}
>
> if [ ! -f ${RECORDFILE} ]; then
> ${VBOXMANAGE} $@
> exit $?
> else
> cat ${RECORDFILE}
> fi
>
> * Start the two virtual machines 'MerSDK' and 'SailfishOS Emulator' on
> your host OS. Their performance will be far better than inside the
> Linux virtual machine.
>
> * Make sure that your host OS runs a ssh server. Find out the host IP
> and connect to it from Linux, tunneling the ports used by the SDK.
>
> ssh -l <user> <host-ip> \
> -L 2222:localhost:2222 \
> -L 2223:localhost:2223 \
> -L 8080:localhost:8080 \
> -L 10000:localhost:10000 \
> -L 10001:localhost:10001 \
> -L 10002:localhost:10002 \
> -L 10003:localhost:10003 \
> -L 10004:localhost:10004 \
> -L 10005:localhost:10005 \
> -L 10006:localhost:10006 \
> -L 10007:localhost:10007 \
> -L 10008:localhost:10008 \
> -L 10009:localhost:10009 \
> -L 10010:localhost:10010 \
> -L 10011:localhost:10011 \
> -L 10012:localhost:10012 \
> -L 10013:localhost:10013 \
> -L 10014:localhost:10014 \
> -L 10015:localhost:10015 \
> -L 10016:localhost:10016 \
> -L 10017:localhost:10017 \
> -L 10018:localhost:10018 \
> -L 10019:localhost:10019
>
> This ssh connection needs to be established all the time while you're
> using the SDK.
>
> * Start the Sailfish SDK QtCreator on Linux. It should be able to
> connect and use the virtual machines on your host OS now. You cannot
> start the virtual machines via QtCreator, though.
>
> * IMPORTANT: Your Sailfish projects must all reside in the projects
> shared folder so that the MerSDK virtual machine will be able to find
> them.
>
>
> Cheers,
> Martin
> _______________________________________________
> SailfishOS.org Devel mailing list
>
More information about the Devel
mailing list