Difference between revisions of "Compiling for Raspberry Pi"

From The Powder Toy
Jump to: navigation, search
(Spelling Errors fixed, removed workaround section.)
(Overclocking: Simplified)
Line 6: Line 6:
 
==== Overclocking ====
 
==== Overclocking ====
  
Before you do anything, if you want these compiles to run a bit faster, you can overclock to 800 MHz. This won't void your warranty, only overvolting does. To do this is fairly simple, just a few commands.  
+
Overclocking is not required however it can improve build times significantly as building with stock settings and limited RAM can take over 10 minutes. By overclocking your Raspberry PI you are not voiding your warranty but overvolting will (Overvolting increases the amount of power going to the CPU). Many extensive overclocking tutorials are out there however below is a very basic guide.
  
First, log in (If you aren't already) and then type in 'sudo raspi-config'. Type in your password if it asks for it. This will bring you to a menu, press the down arrow a few times until you highlight overclocking. Press enter, read the text and enter again. Then move your cursor down one to modest, which will give you a 800 MHz core and that is it. It will run a few degrees warmer now, but it will improve compile times.
+
1. Log in to your distribution
 +
2. Open terminal if not already open
 +
3. Type in 'sudo raspi-config' and enter your root password. This 'COULD' be different to your user password.
 +
4. On the menu select 'overclocking'
 +
5. Read the text and follow instructions until you come to a selection where you are able to select 'Modest'. This overclock will set the processor to 800mhz.
 +
6. Tab to 'OK' and after a short wait you will be able to exit back the main menu and force the Raspberry PI to reboot.
  
Enter out of it by tabbing to OK, waiting a bit, and navigate back to the main menu. Tab down to finish and enter, and once reboot by selecting Yes.
+
If for any reason the Raspberry PI no longer works, you can reset the overclock by putting the SD card into a computer and changing the configuration file back to what it is meant to be. It is not possible to damage your Raspberry PI with a frequency overclock alone.
 
 
Done! You have overclocked your Pi to a safe, 800 MHz. If your Pi gets too hot it will auto un-overclock.
 
  
 +
It is unlikely that your Raspberry PI will overheat with this new overclock, if it does the PI will automatically set itself to the normal overclock setting. You can use heat sinks or a fan to apply additional cooling if needed.
  
 
==== Preparing to compile ====  
 
==== Preparing to compile ====  

Revision as of 19:18, 31 May 2013

Please note, this has been copy / pasted a bit from the Linux compile tutorial and with some help from the IRC (Mainly Jacob1, Triclops) Guide written by Candunc. Feel free to edit and come on the IRC if you have errors.

  • PLEASE NOTE: All of this will be done command line. Either log out or use the terminal if you are in the Raspbian GUI


Overclocking

Overclocking is not required however it can improve build times significantly as building with stock settings and limited RAM can take over 10 minutes. By overclocking your Raspberry PI you are not voiding your warranty but overvolting will (Overvolting increases the amount of power going to the CPU). Many extensive overclocking tutorials are out there however below is a very basic guide.

1. Log in to your distribution 2. Open terminal if not already open 3. Type in 'sudo raspi-config' and enter your root password. This 'COULD' be different to your user password. 4. On the menu select 'overclocking' 5. Read the text and follow instructions until you come to a selection where you are able to select 'Modest'. This overclock will set the processor to 800mhz. 6. Tab to 'OK' and after a short wait you will be able to exit back the main menu and force the Raspberry PI to reboot.

If for any reason the Raspberry PI no longer works, you can reset the overclock by putting the SD card into a computer and changing the configuration file back to what it is meant to be. It is not possible to damage your Raspberry PI with a frequency overclock alone.

It is unlikely that your Raspberry PI will overheat with this new overclock, if it does the PI will automatically set itself to the normal overclock setting. You can use heat sinks or a fan to apply additional cooling if needed.

Preparing to compile

You will need the following packages:

git-core - GIT control system, lets you connect to the repo

libsdl1.2-dev - SDL Libaries

libbz2-dev - BZip2 Libaries - 64bit systems use lib64bz2-dev

liblua5.1-0-dev - Lua libaries

build-essential - Compiling tools

libfftw3-dev - In latest compiles it's necessary.


To install all of these packages, all you need to do is the following command

sudo apt-get install git-core build-essential libsdl1.2-dev libbz2-dev liblua5.1.0-dev fftw3-dev screen

Next, you need to free up core RAM for the compile. if you have a model B rev 3 or later (ones with 512 MB RAM), you can skip this step.

Type in 'sudo raspi-config' typing in your password if it asks for it. Then navigate down to memory split. If you are using your pi hooked up to a display, try with 32 or 16, otherwise put in 8 to free up as much RAM for the compile as possible. Tab down to ok, and save everything and quit. Select yes if it asks you to reboot.

If you skipped the above step, type in sudo reboot, putting your password in if it asks

Now that you've reboot, you should download the latest source.

Type in 'wget https://github.com/FacialTurd/The-Powder-Toy/archive/master.zip'

This will download the latest source. You can unzip it by typing 'unzip master.zip'

This will create a folder called The-Powder-Toy-master. Rename it to something simple with this command: 'mv The-Powder-Toy-master/ TPT/'

Done! Readied the compile environment for compiling.

Compiling the source

Now that you've got it down, it will need to compile. This will take a while to compile, so if you are ssh'ing to the raspberry pi you may want to type screen before the command.

To compile, you'll need to type in these following commands:


cd TPT

scons --rpi --release

OR if you plan to leave the session

screen scons --rpi --release

You can close the window and come back to your compile by typing 'screen -r'

This will take a while, and it will have a lot of text spew out of it.

If it doesn't compile and says 'You must specify a platform to target', the source hasn't been merged. You can work around it though. Skip to 'Workaround' if this happens, its below this section


If it does compile right, you will have something called 'powder-legacy' in your build folder. You can view this by typing in 'ls build/' if it isn't there, something went wrong. To start it, move it to another computer or you can try it (with very poor fps) by going into the gui, cd'ing to the folder, and typing ./powder-legacy

You are done and have compiled! If you didn't, continue down.


Credits

If you feel like there is something missing, or needed to be edited, please do and place your name (if you want) in the credits.

Guide written by Candunc

Special Thanks to Jacob1 and Triclops200 on IRC for helping me out, as well as the guys on Stack Exchange and the Raspberry Pi Forums.