The Simple Guide To Compiling In Linux
Introduction
This guide was written by a Linux n00b, for Linux newbies. :) It's purpose is to guide users through the steps to acquire a copy of the source code and build their own copy of Rockbox. I will do my best to write instructions with the assumption that the user has virtually NO familiarity with Linux at all; but that they DO have a few basic computer skills in place. Also, the only distribution of Linux the author has used is Ubuntu - specifically, versions 7.04 and 7.10. Users of Debian-based distributions should be able to follow these instructions almost exactly; and users of other distros shouldn't have any problems either, so long as they know how to open a terminal window.
Oh, by the way, if something is in italics, replace it with something appropriate. For example, username means to put your User Name there; most people make it their first name, without any capitalization. (Note: sometimes username might not be in italics, but it should still be replaced.)
If something is bold, it usually means you should type it in EXACTLY as shown, punctuation and all. It also means that this is the exact name of something, such as a menu.
One more thing: If you highlight something in a window, then switch to the terminal window, clicking the mouse wheel will copy what you highlighted and put it on the terminal. This will make it easy
So, if you're ready, let's take it from the top. ;)
Getting Ready
First things first: make sure that you have at least a free gigabyte or so of space on your hard drive (or Linux partition, if you partitioned your hard drive). In Ubuntu, this is easy to check: open any file browser window (like your Home folder: click on Places at the top, then click Home Folder) and make sure no files are selected, then read the bottom of the window: "Free space: [some number]".
Okay, so you've got some space. Let's open a terminal window: At the top of the screen, click on Applications. Mouse over Accessories, then click on Terminal. A window (mostly white) will pop up. It should say username_@_computername; for example, mine says michael@CarrDesktop.
Let's check something. Type pwd and press Enter. It should say /home/username on the next line. If it doesn't, type cd and press Enter.
Getting Started
Okay, now the fun begins.
Get the subversion package, so that you can easily download the rockbox source from the svn repository:
sudo apt-get install subversion
Now type (or copy) this into the terminal and press Enter:
svn co svn://svn.rockbox.org/rockbox/trunk rockbox
Wait a while. This command will download the entire Rockbox source code, which can take a long time depending on the speed of your Internet connection. There's about 250 MB to download, so over a wireless connection (like mine), figure on it taking up to an hour. Try not to do any web surfing while it does this. It'll be slow if you do. :) Also, do not try to mess with the terminal while the downloading is going on. Just wait until the lines stop scrolling.
Okay, so it's done downloading. We need to make a few more preparations now. Type sudo apt-get install build-essential libc6-dev and wait for a few more things to be downloaded.
Now, type cd rockbox/tools. Type chmod +x rockboxdev.sh, then type sudo ./rockboxdev.sh.
You now need to choose the platform you'll want to compile for. If you are unsure, take all. However, taking all will make it take even longer
Next, we need to mess with something called your PATH. Type cd /home/username, then type nano ~/.bashrc and press Page Down a few times. You should see a blinking cursor on an empty line. Paste this onto the line:
export PATH=$PATH:/usr/local/arm-elf/bin:/usr/local/m68k-elf/bin:/usr/local/sh-elf/bin
Then press [CTRL + X] (CTRL and X at the same time), then type Y (for "Yes", to save the file). Now type exit, then go and reopen the terminal.
Compiling
Type ls and press Enter. A list of the files and folders in the current directory (in this case, your home directory) will show up in the window. Make sure rockbox is in that list, then type cd rockbox.
The last line in your terminal should read username@computername:~/rockbox$ . Type mkdir build (mkdir means "make directory"), then type cd build . Your current line should say username@computername:~/rockbox/build$ Now type ../tools/configure - and make sure you include those two periods.
A table of ALL the devices Rockbox supports will come up, and each device will have a number beside it. Simply type the number for the device you want to make a build for. I use a Sansa c200, so I would type 52.
Next, you'll see a few choices for the type of build you'd like to make. Let's make a normal build: type n. Wait for a few seconds. When it says "Created makefile", type make and wait. "Making" Rockbox takes a while, so go get a snack. :) When you get back, hopefully it'll be done. Type make zip to prepare a rockbox.zip and wait a little more. That's your build, ready to install onto a real device. Use it like you would for a manual update (that is, unzip its contents into the root of your device, overwriting old files if necessary). When it's done, congratulations! You've compiled your own copy of Rockbox, and made a .zip file like the one you download from the website!
More information/ Going Further
When you're ready to take these skills further and apply patches, take a look at http://www.rockbox.org/twiki/bin/view/Main/SimpleGuideToCompiling#Adding_Patches . Just be careful. :)
You can consider compiling a simulator. too. Read more here: http://www.rockbox.org/twiki/bin/view/Main/UiSimulator
If you want, you can read the tutorial at http://www.linuxcommand.org/index.php and learn how to use the command line to the fullest. It's really easy to follow, don't worry.
One last thing: It's a good idea to update your copy of the subversion every once in a while. Just open a terminal and type cd rockbox, then svn update. Your copy of the sources will be updated (and if you've applied patches, the program will try to keep them in, so you won't have to repatch).
-- MichaelCarr -- Thanks to everyone who fixed my errors! :)
Michael Carr is Strife89 on the forums and on IRC.
|