If you are one of those people who are impatient (want to compile firmware NOW) but only have one computer and use it for other things (video games) during your waking hours, you may find Amazon EC2 to be a convenient platform for compiling firmware. Whatever the reason, you may at least find it worthwhile as an educational exercise to give this a try.
Amazon offers a free tier of EC2 services1). You can use a single linux 'micro' instance without having to pay anything for the first year. The largest 'High-CPU' instance is $0.68 / hr. The great thing about EC2 is that you can start your instance as a 'micro' size to download the source and configure your build environment, and then bring it back up as a High CPU for the few hours that you need the horse power. Just remember to shut it down when you are finished.
This step requires a credit card. Go to http://aws.amazon.com and click "Sign Up Now". Choose a secure password!!
This is the most important step. You want to secure this account as much as possible. If someone steals your ID and uses it to spin up a bunch of CUDA instances, you can be on the hook for hundreds of dollars per day, not to mention legally responsible for any abuse that might occur from the instance. Why would someone steal your ID for an EC2 cluster? Two words: Bitcoin Mining 2). As ridiculous as it sounds, it could happen to you. So be smart and lock up your AWS account!
The best way to secure your account is to use a 2-factor auth token. These can be purchased for $12.99 (+ $2.98 shipping) and are well worth the cost. To buy one, sign into your AWS Console and click Account > Security Credentials. Down below 'AWS Multi-Factor Authentication', click "Learn more about AWS Multi-Factor Authentication'. On the right, under Quick Start click "1. Purchase Device." Click "Add to Cart", then click "Begin Checkout". The rest of this process should be familiar if you shop with Amazon.
In a few days the auth token will arrive by mail. Sign back into your AWS Console and add it under the Security Credentials menu.
You will need this token each time you sign into the AWS Console, as this is your gateway for using their services. You don't need the token to sign into your actual AWS virtual machines once they are created, only for the AWS Console which controls the overall security/firewall and the stuff that can cost you money.
There are two types of instances. Those with 'instance' storage only, and those with EBS storage. Instance storage is stored on Amazon S3 and is not persistent. That is, your changes disappear after you shut down the instance. Since you are installing packages for the build environment, you will need persistent storage. EBS is the answer. As of writing, it costs around $0.10 per GB per month. With the free tier account, you get 12 GB per month for free. So far I'm using around 3 GB of storage and haven't been charged. So don't be afraid to use EBS.
Your instance will eventually show up as "Running" in the My Instances overview. Click Refresh till it shows up.
I have Windows so these instructions are written for Windows. If you are using Linux, I assume you can figure out how to deal with SSH Keys.
Before you can connect we need to add your SSH Key to PuTTY. If you don't allready have PuTTY, download and install it 5).
You can now connect to your instance.
Run PuTTY from the start menu. Enter the Instance IP address or hostname. To find it, go back to the AWS Console, right-click on your instance and select Connect. The "Public DNS" will be in that popup under Step 4. Use that hostname.
Now, at this point you can *probably* use the EC2 Instance storage for your build. But if you end up building the entire world, you will probably need a lot more than the 8 GB that came with the instance. So lets create another storage volume.
Back on your instance, you should have a /dev/sdc now. We'll need to format it.
sudo fdisk /dev/sdc n p 1 default default p wYou should now have a /dev/sdc1 object. Format it:
sudo mkfs.ext3 /dev/sdc1
Your disk is now formatted and ready to mount.
sudo mkdir /mnt/sdc sudo mount -t ext3 /dev/sdc1 /mnt/sdc cd /mnt/sdc df -h sudo mkdir openwrt sudo chown ubuntu:ubuntu openwrt cd openwrt
Once you have downloaded all of the build environment and sources, you are ready to build. At this point you can make a decision. You can build with the micro instance, which is free but slow; or, if you are super impatient, and don't mind paying $0.68/hr for a few hours, you can change the instance to a High CPU version.
This is the "Extra Large High CPU" instance type with 8 virtual cores with 2.5 ECUs each10). This should compile much faster with the "-j 9" option, like so:
nohup make -j 9 &Remember, the second you 'start' a High-CPU instance you will pay for 1 full hour for any fraction used. So when you click start you will pay. Don't forget to shut it down when it is finished and change it back to t1.micro. :)
These build times are based on a simple AR71XX configuration with wireless drivers, no LuCI. YMMV.
Cost is based on US East (Virginia) pricing as of 2011-05-31.
Trunk source adds options for Compile certain packages parallelized and Number of package submake jobs (2-512). I enabled this and set it to 8, look for it under Global build settings. (Credit to Mazilo for pointing this out11))
|Instance Type||Spec||Cost / Hr||Build Time||Total|
|t1.micro||1 ECU, 1 Core, 650M RAM||$0.02 / Free||~14h 00m||$0.28|
|m1.small||1 ECU, 1 Core, 1.7G RAM||$0.12||???||???|
|m1.large||4 ECUs, 2 Cores, 7.5G RAM||$0.34||???||???|
|m1.xlarge||8 ECUs, 4 Cores, 15G RAM||$0.68||???||???|
|c1.medium||5 ECUs, 2 Cores, 1.7G RAM||$0.17||???||???|
|c3.xlarge||20 ECUs, 8 Cores, 7G RAM||$0.68||~3h 20m (backfire)||$2.72|
|c3.xlarge||20 ECUs, 8 Cores, 7G RAM||$0.68||~0h 40m (trunk)||$0.68|