Skycoin Forum
ArchlinuxARM on OrangePiPrime + skywire - Printable Version

+- Skycoin Forum (https://skywug.net/forum)
+-- Forum: General Discussions (https://skywug.net/forum/Forum-General-Discussions)
+--- Forum: Skycoin Project (https://skywug.net/forum/Forum-Skycoin-Project)
+---- Forum: Skywire (https://skywug.net/forum/Forum-Skywire)
+---- Thread: ArchlinuxARM on OrangePiPrime + skywire (/Thread-ArchlinuxARM-on-OrangePiPrime-skywire)



ArchlinuxARM on OrangePiPrime + skywire - moe_narrow - 05-03-2019

Perhaps some of you have seen me around on telegram @moe_narrow

I don't get e-mails from skywug so you can contact me on telegram if you have questions.

I would like to document how I created ArchlinuxARM images for the OrangePiPrime
(or the general process which works for other boards)

Once you have archlinux on your board; setting up skywire is trvial because I have submitted PKGBUILD scripts for various skycoin repos to the Archlinux User Repos.
This means that all the hard parts are handled by the AUR package manager (such as yay)
Or you can (in just three steps) build and install the package yourself.

The other, major advantage of archlinux is that you can install a current version of golang with the following command:
```
sudo pacman -S go-pie
```

or

```
sudo pacman -S go
```

It's recommended to use go-pie


CREATING THE IMAGE

The hardest part is getting an archlinuxARM image that will boot on your board. The rest is very easy.
The officially supplied images (for archlinux on orangepiprime) do not work.
Perhaps you might have better luck with by default working images for different boards. 

This method is a bit of a Frankenstein method, but it works (eventually).

To start; take a working image which will boot on your board

For the prime, let's start with this armbian image:
https://dl.armbian.com/orangepiprime/Debian_stretch_next.7z.torrent

And then get the archlinuxARM you want to use:
http://fl.us.mirror.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz


I recommend this one, however with the orangePiPrime it seems that I cannot mount USBs with this.
I will try this with the generic armv7 tarball and see if that fixes the USB issues for the prime.

*EDIT*
There are several sources you can use for archlinuxarm which don't work right or you will later observe have some kind of ip conflict because of mac addresses being the same.
This one didn't seem to be the right one for me with the prime for whatever reason. I am going to link to a working image on github; if you are trying to repeat this process; I have gotten it to work before but I don't recall the correct sources.
*EDIT*

For the next step, I use gnome-disks-utility. You can use something else if you wish.

Extract the armbian image and attach it as a disk image using gnome-disks.
Just so you can see what you are looking at


https://ibb.co/hK8mVdM
https://ibb.co/B3bJm70



next, create a new disk image of the same size. Name it whatever you like


https://ibb.co/R2fndqh
https://ibb.co/dcbzk4X
https://ibb.co/Sv6VPNK

Note the location in `/dev` as shown.

https://ibb.co/sCJ5FV9

then, open up a terminal in the directory where you extracted armbian and execute the following:
```
sudo dcfldd if=Armbian_5.75_Orangepiprime_Debian_stretch_next_4.19.20.img of=/dev/loop1
```
If you do not have dcfldd you can use dd

Click the triangle 'play' button to mount the root filesystem and follow the link that says 'Mounted at' to view the root filesystem.
Either open a terminal in this location or open a file manager with sudo (sudo thunar, sudo nautilus, etc..) in this location.

https://ibb.co/ZKNq6J8

Remove every folder except /boot. Make sure you check for hidden and trash / lost+found files


https://ibb.co/RS17hVg

Now what you want to do is make a copy of ArchLinuxARM-aarch64-latest.tar.gz or whatever archlinuARM you downloaded.


Open the archive (without extracting it) of the copy you wish to modify and delete the /boot folder.

https://ibb.co/7bGBwSJ


Now, to extract the contents into the mounted disk image that you deleted everything but /boot from

YOU MUST BE ROOT FOR THIS (not with sudo)

```
bsdtar -xpf '/path/to/ArchLinuxARM-aarch64-latest-noboot.tar.gz' -C /path/to/mounted/image/rootfs/131e06c6-00b8-4657-8b48-6e6c806305bb/
```


Now if you have done everything correctly, you can unmount the images and you will have an archlinuxARM image you can write to a microsd and which will hopefully boot on your board.

So I will test what I have to make sure I did it right.

The default user:pass is alarm:alarm and root:root

RESULTS

The board boots, but strangely I could not ssh into it!

This happened before and I fixed it by using a different archlinuxarm rootfs. I forget which one, but I have already made a working image for this board.
The image for this posted already on https://github.com/0pcom/skyalarm in the releases.
I will update soon; in case you don't want to go through this whole process and figure out what is missing. However, the above is still useful for reference.

Here is a (mostly) unconfigured image for the orangepiprime:
https://github.com/0pcom/skyalarm/releases/download/alarm/alarm.img.tar.xz
sorry it' so big, there are some makedependancies for still installed. Go and yay are already installed.


INITIAL CONFIGURATION

When you have logged in via ssh, the first thing to do is initialize & populate the pacman keyring (as root)

```
pacman-key --init
pacman-key --populate archlinuxarm
```
then update the keyring

```
pacman -S archlinuxarm-keyring
```
then update the filesystem

```
pacman -Syy
pacman -Syu
```

If you get an error about a key; locally sign the key to trust it

```
pacman-key --lsign DE08F924EEE93832DABC642CA8DC761B1C0C0CFC
```

when your system is up to date and you make a user account; it's time to set up skywire.

But first we need an AUR package manager. And you must be a regular user (not root) for some of the following steps.
A wonderful command-line utility for AUR package management which is written in golang is Y.A.Y. (yet another yaourt aur package manager)

yay should be included in the skyalarm image, but lets's assume for a moment that you don't have yay.
What do you do? Here is the simple 3 step process of making a package from the Archlinux User repos.

```
wget https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yay
mv PKGBUILD?h=yay PKGBUILD
makepkg -scif
```

You will be prompted for the sudo password to install yay, once it is built.

When that has taken place, yay will do what you just did for you (from now on).

To install skywire

```
yay -S skywire
```

I have just today updated the PKGBUILD for skywire to include the system.d services.

```
sudo systemctl start skywire-manager
```
starts the node and manager.

```
sudo systemctl start skywire-node
```

starts a node pointed at 192.168.0.2

If you have a different manager IP address for your DIY setup; edit the script at /usr/bin/skywire-node-miner with the IP address of your manager instance.


BUT WAIT, THERE'S MORE!

```
yay -S skywire-mainnet
```
run a node on the mainnet. After installation with the above command; run the setup with
```
skywire-setup
```

Or, run a skycoin node:

```
yay -S skycoin

```

I have also packaged cx, cxo, and the skywire-discovery server.

UPDATING
For now, the package version for skywire is autogenerated at the time of the build.
To update, simply reinstall the package. You will get the latest commits from either master or mainnet.


CONFIGURING LOCAL PACKAGE REPOS

Something you can do for bootstrapping or to update faster is to make a repository for built packages.
They can be built once and installed on every board rather than having to pull the sources from github and build for each board.

To do this, probably the simplest way, use darkhttpd to serve the directory containing your package repo.
Build the package with one board, then put the built package in that directory. I recommend signing the packages you create; then use the repo-add tool to create your package repo

You can configure pacman.conf to include your repo, take a look at skytergos repo on my github and feel free to message me if you have any questions.