Linux guide on arm devices

From Gridcoin
Jump to: navigation, search

Setting up the core system

First of all you need a running ubuntu version on your RaspberryPi 2

You can use the Image from here http://www.finnie.org/software/raspberrypi/2015-04-06-ubuntu-trusty.zip The next steps are a summary from the original how to for setting up your sd card.

The image is without ssh so if you want to work remotely on the RPI you need to install it first with

 sudo apt-get install openssh-server 

The next step is needed, when you are using a sd card which is bigger then 4gb. There is no automated script for using the whole space. You need to run the following commands:

 sudo fdisk /dev/mmcblk0

You need to delete the second partition by pressing d and then 2. Then re-create the partition by pressing n, p, 2, enter, enter and to write the changes to the disk w.

Reboot the system, then:

sudo resize2fs /dev/mmcblk0p2

You need to add a swap-file. The easiest way is to install dphys-swapfile

sudo apt-get install dphys-swapfile


Dependencies

For the above Ubuntu-img:

sudo apt-get install ntp git build-essential libssl-dev libdb-dev libdb++-dev libboost-all-dev libqrencode-dev libcurl4-openssl-dev curl libzip-dev libzip2 libboost1.55-all-dev

Build Gridcoin Daemon

To be able to compile, you need to tweak the source until it is updated in the git repo. First of all, get the source.

cd ~
git clone https://github.com/gridcoin/Gridcoin-Research

NOTE: If you already have Gridcoin, do this:

git fetch --all
git reset --hard origin/master

If you have trouble updating source from git:

git config --global http.sslverify false

After downloading the source we go into tweaking it.

 nano Gridcoin-Research/src/curlbuild.h

At line 530 add || defined(__arm__) so you get

#  if defined(__i386__) || defined(__ppc__) || defined(__arm__)

then run

mkdir ~/Gridcoin-Research/src/obj && cd ~/Gridcoin-Research/src && chmod 755 leveldb/build_detect_platform && make -f makefile.unix USE_UPNP=-

The compiling will take some time. When its finished you find the gridcoinresearchd in the src/ folder. Do the following steps.

strip gridcoinresearchd

sudo install -m 755 gridcoinresearchd /usr/bin/gridcoinresearchd

mkdir ~/.GridcoinResearch

cd ~/

chmod 700 .GridcoinResearch

cd .GridcoinResearch

Creating config file

nano ~/.GridcoinResearch/gridcoinresearch.conf

Copy and paste the following into the file:

email=<your email, must match your BOINC projects>
server=1
daemon=1
rpcallowip=127.0.0.1
rpcuser=<username (anything you want, does not need to match BOINC)>
rpcpassword=<password (anything you want, does not need to match BOINC)>
addnode=node.gridcoin.us

If you chose the "nano" command line editor, press CTRL+O to write the file information, and then CTRL+X to exit. For any other editor, just save the file and exit. To test type:

   gridcoinresearchd

Wait for the server to start and then type:

   gridcoinresearchd getmininginfo

This should return the current difficulty and other network settings.

Blockchain snapshot (optional)

If this is a clean installation, you can improve the time it takes to get into sync with the chain by downloading a snapshot. The snapshot is never perfectly up to date, but it will get you most of the way there. Save this file in your ~/.GridcoinResearch folder:

   http://download.gridcoin.us/download/downloadstake/signed/snapshot.zip

Extract the snapshot, making sure the 3 folders and the blk001.dat file are in the ~/.GridcoinResearch folder, not a snapshot sub-folder.

Restart the daemon.

Known Issues and further Guides

If you get the error

terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Aborted 

you need to

sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales