The first one is a Raspberry Pi/ARM cross compiler appliance on the cloud, and the second is a GParted appliance for Amazon which will let you expand your Linux partitions graphically on AWS EC2. We will talk about it later Let’s first understand where such an appliance will benefit. Now a days we can see a lot of ARM based devices gaining momentum. Be it the $35 credit card sized computer, the Raspberry Pi. or the old and loved Arduino boards for prototyping. Or be it the new age smart TVs, and setup boxes. Or for that matter the mobile phones. Most of such devices run on Android.
Now, let’s assume you own a piece of software and want to recompile it on ARM. Am sure it will take a few iterations to get to the final versions. But while compiling you are limited to the processing power of the ARM device you own.
But what if I say, you can actually compile your ARM application on a traditional x86 machine with all the power of it? And the output will be a binary which can run on ARM. This is where a cross compiler comes into picture. Cross compilers are a chain of libraries and compilers which runs on an x86 environment but outputs the binary for the desired architecture.
Now, the pain with cross compilers is that they are hell complex and tedious to configure. And it’s mostly needs a sys-admin to do the job. So here we have created a cross compiler for ARM and customized for Raspberry Pi and alike devices.
This appliance can be run on any Amazon EC2 instance with whatever resource you desire based on your code size and how quickly you want to finish your compile. Or, you can even run it on the free Amazon EC2 micro instance. We have also give a quick demo of compiling a C code and testing it on a RasPi. The appliance can be accessed here.
https://aws.amazon.com/amis/raspberry-pi-cross-compiler-beta. Setting up is a cakewalk if you have basic understanding of using AWS cloud instance. Still we thought, it would be good to write a simple how-to on using this AMI. This how-to will help you in setting up a new AWS instance with the AMI and compile a simple C code to test the usage. So let’s begin.
Starting the Instance
Here we are assuming that you already have a valid and active AWS account. If you don’t, please go and register one at http://tinyurl.com/awo7r69. Once, you are ready with your AWS account. Go to this link http://tinyurl.com/ns3ztkb and you will see the Listing page for our Cross Compiler AMI. Now click on the Launch AMI drop down and you will see only one option to start the instance in the USA East region. Click on it.
[image_library_tag 962/88962, alt=”image01″ ,default]
The Next page will ask you to put your AWS credentials to log. Do that and you will see a page like this.
[image_library_tag 961/88961, alt=”image02″ ,default]
Click on Continue.Next screen will ask you to select the instance type. Now you can either start a Micro instance, which is free (One per account). Or you can go on and select a bigger size instance. This will depend how big codebase you want to compile on the cross compiler and how much performance you need. And to top it all how much you are ready to pay for this.[image_library_tag 956/88956, alt=”image03″ ,default]
I am going to continue with a Micro instance to keep my costs in limit. So I selected that. And clicked on Continue. The next two page can be passed with default values if you are new to AWS. Else choose whatever suites you. The next page will ask you to put in a name for the AMI. Put a name which you like and click on continue again.
[image_library_tag 963/88963, alt=”image04″ ,default]In the next page, select or create a public which you will use to log in to the shell of this instance. And click on continue.
[image_library_tag 957/88957, alt=”image05″ ,default]Next page will ask you to create a security group (firewall rules group) for this instance. Nothing harm in selecting the default group and proceeding if you are confused.
[image_library_tag 960/88960, alt=”image06″ ,default]And this par it done, next page will show you all configurations you have selected and review once and let you Launch the instance by clicking on the launch button. So click on it Launch button.
Connect to the Instance
Now go to your console home and click on the instance button.
[image_library_tag 958/88958, alt=”image07″ ,default] Here you will see all your running instances. Click on the instance you have just launched and you will be able to see it FQDN. Copy that.
[image_library_tag 959/88959, alt=”image08″ ,default]Now you need to connect to this FQDN with username Ubuntu and the public key which you have just created and downloaded. The ssh command for it would be
#ssh -i /your_public_key_here ubuntu@the_copied_FQDN_goes _here
And you should be able to login to the system.
Now run ‘sudo su -‘ to gain root privileges. And then cd into “/root/x-tools/arm-unknown-linux-gnueabi/bin” here you will see all the cross compiler’s binaries.
What you will also find here is the source code of the stripped down linpack called linpack.c . You can test the cross compiler on this C code by running the following command
#./arm-unknown-linux-gnueabi-gcc linpack.c -o linpack
This should create an arm binary called linpack. If you try running the binary on this machine you will see an error like this.
# ./linpack -su: ./linpack: cannot execute binary file
This is certain as this binary is not supposed to run on an x86 box. If you run the file command on this binary, you will see this
# file linpack
linpack: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.3.4, not stripped
To test this application, download it to any RasPi box or any compatible ARM device and run. It should run flawlessly.