Mono on external drive
Contents |
Preamble
Here are a set of instructions on how to simulate an external drive in VMWare and use it to install Mono. Please bear in mind the following points:
- This is a first draft; corrections / additions will be made if anybody has problems.
- Using a separate hardware device to do the installation is clunky and over the top (even more so than using Mono on OLPC normally ;).
- This may not be a final solution, but will allow further investigation into the suitability of this software platform.
To make life much easier, the majority of the tedious work will be done by a pre-written script, lucky you!
Ingredients
To build the image
- A Linux PC with QEMU installed
- This shell script
- The Mono binary installer for Linux
To use the image
- Any PC with VMWare Player installed
- OLPC already set up in VMWare
Preparation
On the Linux PC (not the OLPC), you can set up your directory structure however you like. As an example, I will be using:
-olpc |-vmware | <- This is the OLPC install | |-olpc.vmdk | which you have already | |-olpc.vmx | set up | |-(possibly other VMWare generated files) | | |-opt | <- This is what will go into | |-mono-installer.bin | the /opt directory on the | |-test-files | OLPC | |-test-program1.cs | | |-test-program1.exe | | |-test-program2.cs | | |-make-image.sh | <- This is the downloaded script
In this example, we have already got a working OLPC VM installation, and we have a couple of example programs to test running and compiling in Mono. The contents of the data directory will be copied into the disk image.
Making the image
In the terminal, move to the olpc directory. Then run ./make-image.sh vmware/disk2.vmdk 256M opt.
The script requires root permissions (use either su or sudo, preferably the latter).
This will throw out a load of junk to the console, possibly including words like 'warning' and 'error',
don't worry. This is the normal behavior of the disk formatting program we are using to create
the image.
After the script has run, you should have a a 256M disk image called disk2.vmdk in the vmware directory
with the contents of the opt directory into it. Easy!
Your vmware directory will now look like this
-vmware |-olpc.vmdk |-disk2.vmdk |-olpc.vmx * |-(possibly other VMWare generated files)
* This is the file we will edit in the next section
Editing the VMX file
At this point, you have finished with qemu and the built in Linux tools, so the following instructions can be used on any PC.
To make VMWare see the new image, we will have to edit olpc.vmx.
In the file, remove the following line if it is present:
ide0:1.present = "FALSE"
Now insert these lines:
ide0:1.present = "TRUE" ide0:1.fileName = "disk2.vmdk" ide0:1.deviceType = "disk" ide0:1.mode = "persistent" ide0:1.redo = "" ide0:1.writeThrough = "TRUE" ide0:1.startConnected = "TRUE"
You may now run the virtual machine as normal. If VMWare restores a previous session, restart the machine from the 'Player' menu.
Installing Mono
In the emulator, use ctrl-alt-space/f1 to get to the terminal, then login as root. In most circumstances, you should then switch to a regular user - but we will need the root account.
Type the following to run the installer
mount /dev/hdb1 /opt cd /opt ./mono-installer.bin
You will then be invited to read through the GPL in all it's glory. When you have finished this the installation begins. You should just be able to tap enter at each question to accept the default values.
You can now switch to a regular user if you wish by typing
su olpc
Mono is now installed, but a couple of environment variables need to be set in order to run and compile Mono programs. (In reality you will be most likely compiling on a real Linux box, but you never know). (What do you mean "I'm using Visual Studio"? Tsh).
export LD_LIBRARY_PATH=/opt/mono-1.1.15/lib/ (So Mono can find it's DLLs) export PKG_CONFIG_DIR=/opt/mono-1.1.15/lib/pkgconfig/ (For the mcs compiler) export PATH=$PATH:/opt/mono-1.1.15/bin/ (So you can type 'mono' at any location)
To run any graphical program from the terminal, you must su to the 'olpc' user
and set the DISPLAY variable to :0.0, for example:
su olpc DISPLAY=:0.0 mono /opt/test-files/test-program1.exe
