[center]How to build peercoin wallet on ArchArm platform (armv6h, raspberry pi)[/center]
This guide is first step of my plan’s to create safe and secure OS for minting/running nodes on Raspberry Pi.
This is needed to build trust, if we are to have official repository one day this kind of testing is needed to confirm safety of packages. More people know how to do it, the safer it is.
Please note this guide is relatively complicated and I write it only because I need people to be able to replicate my results, mostly due to hash sums of binaries I’ll provide here.
[center]After you are done please post link with binaries you compiled and sha hash of it so we can compare the results.[/center]
[center]This guide is made with assumption you have linux installation and have basic knowledge on how to use it, it would really be too much to go into all the fine details.[/center]
Stuff you need:
- 1 SD card, at least 4GB in size and class 6
- 1 raspberry pi computer (any model, the one with 256MB of RAM is fine too)
- to be able to use google and use https://wiki.archlinux.org/ (the finest source of linux knowledge on the internets) if you are stuck with something.
- SSH client
- Gparted (http://gparted.org/) partition manager
- My attachments (forum did not let me) https://dl.dropboxusercontent.com/u/9689469/attach.zip
- It would be best to use Manjaro/Arch Linux as your OS while you do this (compatibility and all)
1) Install the OS on SD card
Download the image
http://archlinuxarm.org/platforms/armv6/raspberry-pi
On this website you can also find command you will use to install it on SD card.
2) Make adjustments to filesystem layout
Since install will not use all of your SD card, now we will enlarge root partition and give it a big swap space (1gb at least, you will see why later).
You can do this in gparted, just create new partition-swap size at least 1024MB. Then, resize the root partition (ext4) one to fill the SD card.
Now you will need to edit /etc/fstab, too add swap partition (you can do this right now just mount the root partition on SD card and edit it as root).
In fstab make entry like you can see in my attachments, where UUID is UUID of you new swap partition (find it by right clicking on partition in gparted, then just copy/paste).
4) Configure the OS
https://wiki.archlinux.org/index.php/beginners'_guide
Arch is different beast, unlike Raspbian it comes very very minimal. Very few packages installed and without user. Also, there is no GUI. Everything you will do will be in command line.
After booted and connected to network. Use ssh client to connect to it, use “root”, “root” as username/password
5) Update system
Just copy/past this into console.
pacman -Syy
pacman -Su
- Make crosstools (optional if you can leave you Pi to compile this for a day)
Master == Raspberry Pi
Slave == your PC
Since RasPi is powered by very very weak ARM cpu, compiling program like peercoin wallet can take several hours (6-12h), and we don’t have time to wait. Crosstools is cross-compiler, with help of this program you can use your PC to aid poor RasPi do to it quicker.
I will describe how to do it on ArchLinux/Manjaro since it is very easy, ok not easy but I did so many trial and error that I’m expert now. You can check google on guides how to do this on Ubuntu/Debian/Mint.
On your PC, install and configure pre-built crosstool-ng toolchains (https://github.com/WarheadsSE/PKGs/tree/master/distccd-alarm).
When you pull everything from that git repo, move to that directory, open console and “makepkg”. In a while you will get your packages, then just “sudo pacman -U *.tar.xz”. Or, install this package I’ve built (https://dl.dropboxusercontent.com/u/9689469/distccd-alarm-armv6h-4.8.2-7-x86_64.pkg.tar.xz)
Now, follow this guide.
http://archlinuxarm.org/developers/distributed-compiling
Replace IP addresses with actual addresses of both your devices, or LAN ip ranges (ie 192.168.1.1/24). In attachments you can find my distccd configs if you are not sure how to continue.
Now start distccd services on both devices.
Raspberry:
systemctl start distccd
PC:
sudo systemctl start distccd-armv6h
Check status of both with “systemctl status -l distccd / distccd-armv6h”
7) Build Peercoin client Finally fun stuff.
You do this on Raspberry Pi.
Crosstools are here to speed up, and that swap space is for GCC (compiler) to be able to work. GCC needs a lot of RAM, and if we have only 256 swap is there to compensate.
You’ll need PKGBUILD first, so here take mine https://dl.dropboxusercontent.com/u/9689469/ppcoind-v0.4.0-1.src.tar.gz
Just uncompress it (tar xvzf ppcoind…) and move into it and fire up “makepgk”.
When script pulls down all the stuff needed compiler starts, now check if your crosstool is OK, on your PC enter “sudo systemctl status -l distccd-armv6h” and look for GCC output. If there is nothing something is wrong with distccd (and I’m sure you will get to this problem).
Compilation is now started, after some 30min it’ll finish and ask you to install the package.
8) Test sha256 hashsum
sha256sum ppcoind-v0.4.0ppc-1-armv6h.pkg.tar.xz
fcf33410d68836bfc9d10a31b30e11846275f572e718582c28d8a271ec2c27bd
Now post this, and you are done.
- Optional - Run the wallet
First, we need to create directory where peercoin wallet files will reside (wallet.dat and blockchain).
mkdir /var/lib/ppcoind
chown -R ppcoind:ppcoind /var/lib/ppcoind
Now, run the service.
systemctl start ppcoind
Monitor it with top, and it’ll take at least an hour to complete downloading the blockchain.