[OpenWrt-Devel] [PATCH V2 6/6] cgminer: it is a multi-threaded multi-pool GPU, FPGA and CPU bitcoin miner

xiangfu at openmobilefree.net xiangfu at openmobilefree.net
Wed Jun 20 05:49:35 CEST 2012


From: Xiangfu <xiangfu at openmobilefree.net>

For this package it's only enable the FPGA support
---
 utils/cgminer/Makefile                 |   64 ++++++++++++++++++++++++++++++++
 utils/cgminer/files/20-cgminer.hotplug |   15 ++++++++
 utils/cgminer/files/cgminer-monitor    |    6 +++
 utils/cgminer/files/cgminer.init       |   17 +++++++++
 4 files changed, 102 insertions(+)
 create mode 100644 utils/cgminer/Makefile
 create mode 100644 utils/cgminer/files/20-cgminer.hotplug
 create mode 100755 utils/cgminer/files/cgminer-monitor
 create mode 100755 utils/cgminer/files/cgminer.init

diff --git a/utils/cgminer/Makefile b/utils/cgminer/Makefile
new file mode 100644
index 0000000..5e4d9c9
--- /dev/null
+++ b/utils/cgminer/Makefile
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2012 Xiangfu Liu <xiangfu at openmobilefree.net>
+#                            bitcoin: 12h6gdGnThW385JaX1LRMA8cXKmbYRTP8Q
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=cgminer
+PKG_VERSION:=20120516
+PKG_REV:=b69d735cfe468c489a24677ffef1d6d998818cac
+# this is upstream version 2.4.1
+PKG_RELEASE:=4
+PKG_INSTALL:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz
+PKG_SOURCE_URL:=git://github.com/ckolivas/cgminer.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cgminer
+	MAINTAINER:="Xiangfu Liu" <xiangfu at sharism.cc>
+	SECTION:=utils
+	CATEGORY:=Utilities
+	TITLE:=cgminer (FPGA Miner)
+	URL:=https://github.com/ckolivas/cgminer
+	DEPENDS:=+libcurl +libpthread +libncurses +jansson
+endef
+
+define Package/cgminer/description
+Cgminer is a multi-threaded multi-pool GPU, FPGA and CPU miner with ATI GPU
+monitoring, (over)clocking and fanspeed support for bitcoin and derivative
+coins. Do not use on multiple block chains at the same time!
+endef
+
+CONFIGURE_ARGS += --disable-opencl --disable-adl --enable-icarus --enable-bitforce
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Build/Compile
+	$(call Build/Compile/Default)
+	( cd $(PKG_BUILD_DIR) && $(TARGET_CC) api-example.c -I compat/jansson -o cgminer-api; )
+endef
+
+
+define Package/cgminer/install
+	$(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/hotplug.d/usb
+
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/cgminer-api $(1)/usr/bin
+
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cgminer $(1)/usr/bin
+	$(INSTALL_BIN) $(FILES_DIR)/cgminer-monitor       $(1)/usr/bin
+	$(INSTALL_BIN) $(FILES_DIR)/cgminer.init          $(1)/etc/init.d/cgminer
+
+	$(CP)          $(FILES_DIR)/20-cgminer.hotplug $(1)/etc/hotplug.d/usb/20-cgminer
+endef
+
+$(eval $(call BuildPackage,cgminer))
diff --git a/utils/cgminer/files/20-cgminer.hotplug b/utils/cgminer/files/20-cgminer.hotplug
new file mode 100644
index 0000000..523defb
--- /dev/null
+++ b/utils/cgminer/files/20-cgminer.hotplug
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Copyright (C) 2012 Xiangfu (BTC: 12h6gdGnThW385JaX1LRMA8cXKmbYRTP8Q)
+
+if [ "${PRODUCT}" = "67b/2303/400" ] && [ "$TYPE" = "0/0/0" ] && [ "$INTERFACE" = "255/0/0" ]; then   
+	case "$ACTION" in
+		add)
+			killall -s 9 sleep
+			killall -s 9 cgminer
+			sleep 30 && /etc/init.d/cgminer start &
+			;;
+		remove)
+			;;
+	esac
+fi
diff --git a/utils/cgminer/files/cgminer-monitor b/utils/cgminer/files/cgminer-monitor
new file mode 100755
index 0000000..ecb81bb
--- /dev/null
+++ b/utils/cgminer/files/cgminer-monitor
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# This file is for cron job
+if ! pidof cgminer; then
+	/etc/init.d/cgminer start 
+fi
diff --git a/utils/cgminer/files/cgminer.init b/utils/cgminer/files/cgminer.init
new file mode 100755
index 0000000..48d1ca3
--- /dev/null
+++ b/utils/cgminer/files/cgminer.init
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+START=99
+
+POOL1="-o http://us.ozco.in:8331 -O xiangfu.0:x"
+POOL2="-o http://pool.ABCPool.co:8332 -O xiangfu.0:x"
+POOL3="-o http://pit.deepbit.net:8332 -O xiangfu.z at gmail.com_0:x"
+
+POOLS="$POOL1 $POOL2 $POOL3"
+
+start() {
+	DEVS=`find /dev/ -type c -name "ttyUSB*"  | sed 's/^/-S/' |  sed ':a;N;$!ba;s/\n/ /g'`
+	cgminer -q -T --api-network --api-listen $POOLS $DEVS &
+}
+
+stop() {
+	killall -s 9 cgminer
+}
-- 
1.7.9.5



More information about the openwrt-devel mailing list