Compac A1 Setup Linux/ Raspberry Pi

Preparation

For the successful setup of CGMiner for the Compac A1 for Linux, I recommend the following operating system versions

  • Ubuntu 24.04 LTS (Noble Numbat) or higher
  • Raspberry PI OS Legacy, 32-bit (Bullseye) for Raspberry Pi 4, Pi 5 or Pi Zero 2 W

Note: As of July 2024, the latest version of the Raspberry PI OS based on Debian Bookworm has problems building and integrating the CGMiner API. I therefore recommend using the previous version based on Debian Bullseye.

First update your system and already installed packages:

sudo apt-get update
sudo apt-get upgrade -y

Package dependencies

The following packages must be installed to resolve the package dependencies of CGMiner:

  • build-essential: Compiler and Compile-Tools
  • autoconf: Required for building from GIT.
  • automake: Required for building from GIT.
  • libtool: shared library access for CGMiner
  • pkg-config: Required for build and compilation
  • libcurl4-openssl-dev: http connectivity for CGMiner
  • libudev-dev: USB support for CGMiner
  • libusb-1.0-0-dev: USB support for CGMiner
  • libncurses5-dev: Text-based user interface for CGMiner
  • zlib1g-dev: Compression Library
  • git: source code repository
sudo apt-get install -y build-essential autoconf automake libtool pkg-config libcurl4-openssl-dev libudev-dev libusb-1.0-0-dev libncurses5-dev zlib1g-dev git

Build

Now clone the CGMiner branch from Kano’s GIT repository:

mkdir -p mining/compaca1; cd mining/compaca1
git clone https://github.com/kanoi/cgminer.git
cd cgminer

Then compile the cgminer binary (may take a few minutes depending on the hardware used):

CFLAGS="-O2 -march=native -fcommon" ./autogen.sh --enable-gekko --enable-icarus
make

Finally, install OpenJDK to use the Java API:

sudo apt-get install -y openjdk-8-jre-headless

If you want to install CGMiner as a command system-wide (without having to switch to the build folder every time), add:

sudo make install

After that, I recommend testing the newly compiled binary as follows:

sudo ./cgminer -n

or if you have CGMiner installed system-wide (executable from any folder):

sudo cgminer -n

This command lists the detected miners. Example output “Compac A1 BM1362 Bitcoin Miner”.

Setup

I recommend setting up a configuration file, it is much clearer than starting CGMiner with console parameters.

Example of a gekko.conf configuration file:

{
"pools" : [
{
"url" : "stratum+tcp://stratum.kano.is:3333",
"user" : "benutzername.worker",
"pass" : "x"
}
],
"gekko-compaca1-start-freq" : "300",
"gekko-compaca1-freq" : "300",
"gekko-compaca1-corev" : "300",
"gekko-compaca1-detect" : true,
"gekko-r909-freq" : "450",
"gekko-r909-detect" : true,
"gekko-compacf-freq" : "400",
"gekko-compacf-detect" : true,
"gekko-tune2" : "60",
"suggest-diff" : "442",
"failover-only" : true,
"api-listen" : true,
"api-port" : "4028",
"api-allow" : "W:192.168.1.0/24,W:127.0.0.1"
}

How to start CGMiner with configuration file:

./cgminer -c gekko.conf 

This is how the command line looks like without a configuration file

./cgminer --o stratum+tcp://stratum.kano.is:3333 -u 1BURGERAXHH6Yi6LRybRJK7ybEm5m5HwTr -p x --suggest-diff 442 --gekko-compaca1-freq 300 --gekko-compaca1-detect true

In the examples above, please replace the pool data as well as the user name and worker with your own pool data, user data and worker.

Depending on the intended use, it is recommended to log the output of CGMiner in a log file:

./cgminer -c gekko.conf 2> "run-`date +%Y%m%d%H%M%S`.log"

Alternatively, you can put CGMiner into a shell script that writes a log file:

touch cgminer.sh
sudo nano cgminer.sh

Content of the shell script:

#!/bin/sh
#
while true ; do
now="`date +%Y%m%d%H%M%S`"
#
./cgminer -c gekko.conf "$@" 2> "run.$now.log"
#
echo "Sleeping for 5 seconds ..."
sleep 5
done

Then make the shell script executable:

chmod +x cgminer.sh

The “$@” means that you can pass additional parameters to the shell script to be added to the running cgminer, e.g. to disable asicboost.

./cgminer.sh --gekko-noboost

Accessories

Der Miner benötigt insbesondere zum Betrieb mit einem Raspberry Pi einen USB Hub mit aktiver Stromversorgung, der in der Lage ist, mindestens 3 A pro USB Port zur Verfügung zu stellen. Gute Erfahrungen haben wir mit USB 2.0 Geräten von Anker und Orico gemacht. Unser 7-Port USB Hub verfügt über selbstrückstellende Sicherungen an jedem Port und kann bis zu 6 Ampere pro Port zur Verfügung stellen.

The Compac A1 hardware design is geared towards high performance and requires good cooling. Although the Compac A1 is the first USB stick miner to have a thermal fuse, I recommend good cooling to increase the lifespan of the components. We have had good experiences with the Arctic Breeze Mobile 92 mm. Very quiet, powerful and durable.

Alternatively, we also offer the Compac A1 with a snap-on fan, which can be powered directly on the circuit board. The Sunon 40 mm fan installed here provides sufficient cooling at a noise level of just 23 decibels.