Preparing your Linux environment for VoCore development

Getting started with VoCore development can have quite a steep learning curve, so I am making this post and video to try and help others figure this out faster.  I tried to set up the dev environment on my MacBook, but due to an issue with MacPorts, I was unable to get it to successfully build OpenWRT.  Because of this, we will be using the Ubuntu VM set up in the previous posts to set up our environment and build OpenWRT.

To start off, you may be asking, “What is this OpenWRT thing you are talking about?  I thought this was about VoCore?”.  Well, VoCore is the chip itself, and it runs on the OpenWRT Operating System.  OpenWRT is an open source router firmware based on the Linux Kernel.  Because it is Linux based, it also makes more sense for us to use a Linux VM to ensure maximum compatibility.


The first step would be to install the necessary command-line tools for the OpenWRT build process.

sudo apt-get install zlib1g-dev libncurses5-dev gawk subversion libssl-dev git g++

This should take a few minutes.  Most of these tools could already be installed if you have done any kind of development work on this VM, but otherwise it will download and build the tools you need.

Next we are going to have to clone the OpenWRT source code so we can compile it and develop applications for the VoCore.  Navigate to your VoCore development directory, and use “git clone” to download the source.

git clone git://git.openwrt.org/openwrt.git

This will create a local git repository containing all OpenWRT source code for you to use.  There is some code that will need to be updated however, that is not part of the main OpenWRT source.  This will be update using the bundled “feeds” script.  From the base OpenWRT directory….

./scripts/feeds update -a

./scripts/feeds install luci

At this point, we are ready to configure and build OpenWRT for the VoCore platform.  To configure the build process,

make menuconfig

and ensure that the configuration matches the following.

Target System: Ralink RT288x/RT3xxx

Subtarget: RT3x5x/RT5350

Target Profile: VoCore

Save the configuration, and build it.

make

This process can take several hours.  When it is completed, you should have a fully built development environment for the VoCore system.  Soon I will have a video link describing this process, and a post up on writing your first program.

Project Euler #3

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

Simply factorize the target number and select the maximum value from the factors.  Should be pretty simple.  It should be noted, however, that simply iterating through every number is not going to suffice, because a number can have two of the same factors.

For example, the number 28 has a prime factorization of 2, 2, and 7.  The fact that there are two 2’s in the factorization should be taken into account when writing your solution.

Installing Ubuntu with VirtualBox

In this guide, we will be creating a virtual machine, using the VirtualBox software, and running the Linux distro Ubuntu inside of our host operating system.


 

To start, head on over to the VirtualBox website, and download the latest version of the VirtualBox software for your Operating System.  It should be a fairly straightforward install process.

Next, head to the Ubuntu download page, and download a Ubuntu .iso file.  You can select either the 64 bit version, or the 32 bit version.  I would recommend the 64 bit, because it is a more modern architecture built for better computers.


 

With both of these items fully downloaded to your computer, open up VirtualBox.  Hit “New” at the top-left, and name your Virtual Machine.  If the name you choose includes the word “Ubuntu”, then it should automatically fill in the two boxes below.  Otherwise, change “Type” to “Linux” and “Version” to “Ubuntu”.  Hit “Continue”.

Here, it will ask you to allocate RAM to your VM.  This can be any amount, but whatever number you choose will affect your VM’s speed.  I chose 2 Gb, to shorten my build times in later videos.

In the next screen, it will ask how you want it to do the Hard-Drives.  Opt to create a Virtual Hard Drive.  In the prompt that follows, choose to create a .VDI file, and choose an allocation type.  The two types have their own advantages/disadvantages, some of which I detail below:

Dynamically Allocated:

  • Pros: Takes up less space on your HDD if your Virtual Drive is not completely full.  Also takes less time to generate initially.
  • Cons: Slower IO times when running your VM, because VirtualBox has to allocate more space as you use it.

Fixed Size:

  • Pros: Faster IO times inside VirtualBox, because the file is already created, and you are just overwriting the data.
  • Cons: Full-Size file is created from the start, so it takes up more HDD space from the beginning.

It should then prompt you for a size.  Pick something large enough to store all you need to, but not large enough to be cumbersome to your host OS.  It is possible to resize a .VDI file later, as seen in this post, but this process is best to be avoided.


 

At this point, you should have completely set up your VM.  Go ahead and select your VM from the list on the left, and hit “Start“.  You will soon see a prompt asking you to locate your CD Image.  Navigate to your Ubuntu ISO, and select it.  VirtualBox will boot into the Live CD version of Ubuntu.  You should quickly see a prompt asking if you want to Try Ubuntu, or Install Ubuntu.  Choose to Install it, and follow the prompts.  It should be pretty straight forward from here, up until your desktop gets fully booted up.

Once you finally get to the Ubuntu desktop, there is one final step.  In order to ensure full compatibility with VirtualBox, Oracle has created a small software package for you to install to ensure the best experience.  Go to “Devices” in the Menu Bar of your host OS, and hit “Install Guest Additions“.  Let the process run its course, and you should be good to go.  Let me know in the video comments if any part of this was unclear!