Building From Source

'''This page has information from an early design. This page is kept for informational purposes but the information is no longer current. See Getting_Started for up to date information.'''

= Building from source =

Step 1: Get the prebuilt image for ubuntu and install it.
Complete directions are here: http://elinux.org/BeagleBoardUbuntu#Demo_Image

I installed an image from the link above. After I did I was unable to install g++ in Step 3. A dependencie for g++, a kernel library, could not be retrieved. I resolved the issue by updating to a new kernel and repeating Step 3 below. --Dan Myers (talk) 16:49, 20 October 2012 (PDT)

Step 2: Change the user name and password.
Login as default user (ubuntu):

ssh -l ubuntu __IP__ Password: temppwd

Then change to root:

su Password: root

Add a temporary user:

useradd -m temp passwd temp Password: temppwd adduser temp sudo

Switch to temp user then change primary account name/password:

logout; if ubuntu still logged in:

su, then: pkill -KILL -u ubuntu

ssh -l temp __IP__ su usermod -l rov -m -d /home/rov ubuntu passwd rov Password: OpenROV exit exit

Login as new user (rov):

ssh -l rov __IP__ Password: OpenROV

Delete temporary user:

su userdel -r temp exit

su vi /etc/hostname (change to openrov) vi /etc/hosts (change to openrov) reboot

Step 3: Update/upgrade software and install rerequisits
sudo apt-get update sudo apt-get install g++ curl cmake pkg-config libv4l-dev libjpeg-dev git build-essential subversion libssl-dev vim

Step 4: Install nvm (Node Version Manager):
cd ~ git clone git://github.com/creationix/nvm.git ~/.nvm echo ". ~/.nvm/nvm.sh" >> .bashrc echo "export LD_LIBRARY_PATH=/usr/local/lib" >> .bashrc echo "export PATH=$PATH:/opt/node/bin" >> .bashrc export LD_LIBRARY_PATH=/usr/local/lib export PATH=$PATH:/opt/node/bin

Step 5: Try to install Node.js (it will not compile V8 properly)
nvm install v0.8.2

Step 6: Fix V8 to compile
We use a patch that was done to let Node.js run on a Raspberry PI (very simillar hardware):

git clone https://github.com/gflarity/node_pi.git cd ~/.nvm/src/node-v0.8.2

Now apply the patch appropriate for your version of Node.js:

git apply --stat ~/node_pi/v0.8.2-release-raspberrypi.patch

Then set the following exports for use during compilation:

export GYP_DEFINES='armv7=0' export CXXFLAGS='-march=armv6 -marm -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT' export CCFLAGS='-march=armv6 -marm -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT'

Step 7: Install Node.js
./configure make sudo GYP_DEFINES="armv7=0" CCFLAGS='-march=armv6' CXXFLAGS='-march=armv6' make install

echo "nvm use v0.8.2" >> .bashrc

Step 8: Download and Install OpenCV
git clone git://code.opencv.org/opencv.git cd opencv mkdir release && cd release cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TESTS=OFF -D BUILD_EXAMPLES=ON .. make && sudo make install

Step 9: Download OpenROV ROVision
cd ~ git clone git://github.com/OpenROV/openrov-software.git

''Note: Current version of openrov software has a problem with the current version of node express. codewithpassion's development branch has a preliminary fix. repo is here: https://github.com/codewithpassion/openrov-software.git''

cd openrov-software/ edit ~/.bashrc

export LD_LIBRARY_PATH=/usr/local/lib

Step 10: Fix SSL errors and download required Node.js modules
Fix SSL (just don't use secure connection...):

npm config set registry http://registry.npmjs.org/

Download modules:

npm install express socket.io serialport

Step 11: Try it out!
NODE_ENV=production node app.js

From the browser of another computer on the network, navigate to http://openrov:8080 (or use the IP address of the Beagleboard)

Step 12: Back it up!
If you want to make a backup of the image, plug the microSD card back in your pc and enter the command (replace /dev/sdX with the correct device for your SD card):