HowTo – Use the RasPi Cross Compiler AMI


Article originally published at http://raspiresources.com

So, we have got the RasPi CrossCompiler for AWS hosted on Amazon’s AMI store. This means you can directly start an instance using this AMI on AWS right from this link

 

https://aws.amazon.com/amis/raspberry-pi-cross-compiler-beta

 

Though, it’s as easy as a cakewalk if you have basic understanding of using AWS cloud instance. Still we though, it would be good to write a simple howto on using this AMI. This howto 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 Here

Once, you are ready with your AWS account. Go here 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

 

 

The Next page will ask you to put your AWS credentials to log. Do that and you will see a page like this

Click on Continue. Next sceeen 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 bigget 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 😉

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

 

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

 

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.

And this par it done, next page will show you all configurations you have selected and review once and let you Launcg the instance by clicking on the launch button.

So click on it Launch button.

 

Connect to the Instance

 

Now go to the your console home and click on the instance button.

 

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

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 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 a 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 compatable ARM device and run. It should run flawlessly.

 

In case if you want to test the binary file and don’t have a RasPi readily available, you can get one here for free

Advertisement

One thought on “HowTo – Use the RasPi Cross Compiler AMI

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: