Skip to content

Instantly share code, notes, and snippets.

@patterns
Created February 25, 2017 12:53
Show Gist options
  • Save patterns/a7094716f873c5eeda1cc6ad0c82a9ed to your computer and use it in GitHub Desktop.
Save patterns/a7094716f873c5eeda1cc6ad0c82a9ed to your computer and use it in GitHub Desktop.
Build Bitcoin full node on BeagleBone Black
#!/bin/sh
# Download latest Debian image for microSD from https://beagleboard.org/latest-images
# List drives before inserting microSD
df -h
# Insert microSD, then Look for the newly listed SD drive (disk2s1)
df -h
# Unmount the microSD
sudo diskutil unmount /dev/disk2s1
# Write image adjust the device name carefully
sudo dd bs=1m if=~/Downloads/bone-debian-8.6-lxqt-4gb-armhf-2016-11-06-4gb.img of=/dev/rdisk2
# OSX may prompt you when finished, choose Eject
# After multiple attempts, may be necessary to clear ssh host entry
ssh-keygen -R 192.168.1.102
# ethernet + router admin to detect dhcp assigned IP (192.168.1.102)
ssh debian@192.168.1.102
# Unless you have a separate boot partition, can't extend microSD partition
# can't use (http://elinux.org/Beagleboard:Expanding_File_System_Partition_On_A_microSD)
# Instead, leave root partition. Create other partitions for mount points
# use the Debian hardening guide (https://www.debian.org/doc/manuals/securing-debian-howto/)
# Looks straight to use parted according to http://askubuntu.com/a/517365/657386
# There is a limit on the max partitions value of 8 (MMC_BLOCK_MINORS)
# and using extended+logical makes the value jump (so plan ahead or skip /tmp, /opt)
sudo lsblk -o name,mountpoint,label,size,uuid
sudo fdisk /dev/mmcblk0
#/ 4 (Exist)
#/tmp 2 ext2 (skip)
#/home 4 ext4 (skip)
#/var 11+ - 20570112 45735935
#/usr/local 8 - 45735936 end
##sudo partprobe
sudo shutdown -h now
sudo mkfs -t ext4 -L "msdvar" /dev/mmcblk0p2
sudo mkfs -t ext4 -L "msdloc" /dev/mmcblk0p3
# Follow the guide from https://help.ubuntu.com/community/Partitioning/Home/Moving
# to mount and copy /usr/local, then repeat for /var
# Update DNS resolver list
sudo vi /etc/dhcp/dhclient.conf
# Remove sym link
sudo rm /etc/resolv.conf
sudo cp /var/run/connman/resolv.conf /etc/resolv.conf
sudo vi /etc/resolv.conf
sudo apt-get update
# Remove a slow package from upgrade, C9 SDK
##sudo apt-mark hold c9-core-installer
sudo rm -rf /root/.c9/*
sudo apt-get remove --purge c9-core-installer
sudo apt-get autoremove
# Takes forever, serial console would be good instead of ssh connect
screen
sudo apt-get upgrade
# ctl-A-d to leave
# screen -r to re-attach
# Use get-started guide on golang to get go1.8-linux-armv6l
# Use the documentation on github for btcsuite/btcwallet to build btcd+btcwallet
# If USB drive needs, format with ext4 http://askubuntu.com/a/517365/657386
# Copy db/chainstate from desktop full node to USB
# then mount USB to BBB's file sys (see for why perm may not change for vfat http://askubuntu.com/q/251206/657386)
#todo some sudo vi /etc/fstab steps go here
sudo mount /dev/sda1 /opt/btcd/data -o umask=000
# Make world writable, if needed
sudo chmod 777 /opt/btcd/data
sudo chmod 777 /opt/btcd/data/mainnet
cp /var/opt/src/github.com/btcsuite/btcd/sample-btcd.conf ~/.btcd/btcd.conf
cp /var/opt/src/github.com/btcsuite/btcwallet/sample-btcwallet.conf ~/.btcwallet/btcwallet.conf
# Edit datadir and rpc user/pass
vi ~/.btcd/btcd.conf
#todo disabled apach2ctl steps (sudo vi /etc/init.d/apache2)
-----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment