Jump to content

How to Build Custom Raspbian Image [Denarius] [pi] denariian pi-gen


Recommended Posts

Basic setup to building your own custom Raspbian Image from the offician pi-gen repo using you Denarius daemon wallet as the example. I like that someone can build completely from source and compile the entire OS on their own for their precious crypto.



Go to https://github.com/RPi-Distro/pi-gen. Read this a few times how it works.

I am using Windows 10, so I downloaded VirtualBox and created an Ubuntu 16.04 VM with 2 cpu's, 100GB hard drive, and 3GB of ram.

git clone https://github.com/RPi-Distro/pi-gen

You want to build the stock image to make sure this works from the get go.

nano config

Put this one line in for your image name, ex. testimage


Once this is done building you can find the image in the work folder with a date and name of image. The image is in /pi-gen/work/date-imagename/export-image


For the first run I wanted to build only the lite command line Raspbian with denariusd daemon. This is found in stage2 directory.

I made a new directory called 04-denariusd. And put the files required in there.

cd ~/pi-gen/stage2
mkdir 04-denariusd
cd 04-denariusd
nano 00-packages
dependencies to compile denariusd and openssl 1.0.1j
git unzip
libdb++-dev libboost-all-dev libqrencode-dev libminiupnpc-dev libevent-dev
autogen automake libtool 

Next create a file to compile openssl 1.0.1j and denariusd.

nano 04-run.sh
#!/bin/bash -e
on_chroot << EOF
  apt-get install make
  wget https://www.openssl.org/source/openssl-1.0.1j.tar.gz
  tar -xzvf openssl-1.0.1j.tar.gz
  cd openssl-1.0.1j
  make depend
#  make test
  make install
  sudo ln -sf /usr/local/ssl/bin/openssl `which openssl`

  git clone https://github.com/carsenk/denarius
  cd denarius
  git checkout v3.4
  git pull
  cd src
  OPENSSL_INCLUDE_PATH=/usr/local/ssl/include OPENSSL_LIB_PATH=/usr/local/ssl/lib make -f makefile.arm
  strip denariusd
  cp denariusd /usr/local/bin/denariusd
chmod +x 04-run.sh

Now the basic setup is done. Go back to ~/pi-gen, run some commands to skip stages after stage2 and run the build command.

# Example for building denariian lite system
touch ./stage3/SKIP ./stage4/SKIP ./stage5/SKIP
touch ./stage4/SKIP_IMAGES ./stage5/SKIP_IMAGES
sudo ./build.sh


Grab your image from /pi-gen/work/date-imagename/export-image, etch to microsd card and go tinker away with your raspberry pi.

tip: this is a really easy way to cross compile for your raspberry pi. This uses qemu so you get 1 cpu and minimal ram, but outside of compiling everything else is maxing out the VM.

  • Like 1
Link to comment
Share on other sites

stage 3, qt wallet place hodler

#02-denariusqt folder layout




nano 00-packages
libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools qt5-default
nano 05-run.sh

Throw in custom denarius lava pi by icanhaz and setup the Denarius QT compile. After compile copy Denarius binary to user pi desktop.

#!/bin/bash -e

install -m 644 files/Lava-PI-2.jpg "{ROOTFS_DIR}/usr/share/rpd-wallpaper/"

  on_chroot << EOF
  cd denarius
  export QT_SELECT=qt5
  qmake -v
  qmake "USE_NATIVETOR=-" "USE_UPNP=1" "USE_QRCODE=1" OPENSSL_INCLUDE_PATH=/usr/local/ssl/include OPENSSL_LIB_PATH=/usr/local/ssl/lib denarius-qt.pro
  cp Denarius /home/pi/Desktop/Denarius
chmod +x 05-run.sh



  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

An example of how to create a directory and put files into there. Trying to keep the config as stock as possible, so FIRST_USER_NAME is staying "pi". The idea here is to put the compiled QT into a Denarius folder and also put the desktop wallpaper there. Still trying to figure out how to properly set the default wallpaper to something besides road.jpg.



#!/bin/sh -e
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/Denarius"
install -v -o 1000 -g 1000 -m 755 "${ROOTFS_DIR}/usr/local/bin/Denarius" "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/Denarius/"
install -v -o 1000 -g 1000 -m 644 "files/Lava-PI-2.jpg" "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/Denarius/"


Link to comment
Share on other sites

The QT and wallpaper is in home/pi/Denarius which you probably have to chmod to execute the QT file.

Or both QT and daemon are in /usr/local/bin and should work from there

This all is a work in progress as it takes nearly 10 hours to do a full build and then burn the image and test it out.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...