1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-12-22 09:12:24 +02:00

cgminer: most patches merged to upstream

This commit is contained in:
Xiangfu Liu 2012-03-05 10:19:17 +08:00
parent 99d94ccfe1
commit 9feb48247d
3 changed files with 14 additions and 160 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2012 Xiangfu Liu <xiangfu@sharism.cc>
# Copyright (C) 2012 Xiangfu Liu <xiangfu.z@gmail.com>
# bitcoin: 1BQvUsuQBYUyVuX4jjFk4dVBpWJVQEUHTZ
#
# This is free software, licensed under the GNU General Public License v2.
@ -9,8 +9,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=cgminer
PKG_VERSION:=20120226
PKG_REV:=daf1eff13c5583770ed4a8e7a399924b1e208845
PKG_VERSION:=20120305
PKG_REV:=97ab111ec924e8812eaeff2f4f71940811a3cf1b
PKG_RELEASE:=1
PKG_INSTALL:=1
@ -25,20 +25,25 @@ PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
define Package/cgminer
MAINTAINER:="Xiangfu Liu" \
<xiangfu@sharism.cc> <1BQvUsuQBYUyVuX4jjFk4dVBpWJVQEUHTZ>
MAINTAINER:="Xiangfu Liu" <xiangfu@sharism.cc>
SECTION:=utils
CATEGORY:=Utilities
TITLE:=cgminer
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
# This package only enable the Icarus support. just connect your Icarus
# FPGA miner board to OpenWrt router(with USB HOST support)
# Run like:
# cgminer -S /dev/ttyUSB0 -o http://MINING.POOL.URL -O USER:PASS
CONFIGURE_ARGS += --disable-opencl --disable-adl --enable-icarus
TARGET_CFLAGS +=
TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
define Package/cgminer/install

View File

@ -1,7 +1,7 @@
From bed5510daca0a751e264da14367d3389f4f93dbd Mon Sep 17 00:00:00 2001
From 5d3d883703d8098537c248c797009247f51b116b Mon Sep 17 00:00:00 2001
From: Xiangfu <xiangfu@openmobilefree.net>
Date: Sun, 19 Feb 2012 22:20:22 +0800
Subject: [PATCH 2/2] add-MIPSED-to-icarus-for-BIG_ENDIAN.patch
Subject: [PATCH] add-MIPSED-to-icarus-for-BIG_ENDIAN.patch
---
icarus.c | 2 +-

View File

@ -1,151 +0,0 @@
From 88fae1c0217e68d43480c73d78efdcc2665c5f13 Mon Sep 17 00:00:00 2001
From: Xiangfu <xiangfu@openmobilefree.net>
Date: Sat, 25 Feb 2012 22:09:47 +0800
Subject: [PATCH 1/2] fix the name to 3 chars, fix the multi-icarus support
---
icarus.c | 48 +++++++++++++++++++++++++-----------------------
1 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/icarus.c b/icarus.c
index 7739395..1d59657 100644
--- a/icarus.c
+++ b/icarus.c
@@ -52,9 +52,6 @@
#define ICARUS_READ_FAULT_COUNT (8)
-static int icarus_read_count;
-static int icarus_write_fault;
-
struct device_api icarus_api;
static void rev(unsigned char *s, size_t l)
@@ -108,11 +105,10 @@ static int icarus_open(const char *devpath)
#endif
}
-static void icarus_gets(unsigned char *buf, size_t bufLen, int fd)
+static int icarus_gets(unsigned char *buf, size_t bufLen, int fd)
{
ssize_t ret = 0;
-
- icarus_read_count = 0;
+ int rc = 0;
while (bufLen) {
ret = read(fd, buf, 1);
@@ -122,23 +118,26 @@ static void icarus_gets(unsigned char *buf, size_t bufLen, int fd)
continue;
}
- icarus_read_count++;
- if (icarus_read_count == ICARUS_READ_FAULT_COUNT) {
+ rc++;
+ if (rc == ICARUS_READ_FAULT_COUNT) {
applog(LOG_WARNING,
- "Icarus Read: No data in %d seconds",
- ICARUS_READ_FAULT_COUNT);
- break;
+ "Icarus Read: No data in %d seconds", rc);
+ return 1;
}
}
+
+ return 0;
}
-static void icarus_write(int fd, const void *buf, size_t bufLen)
+static int icarus_write(int fd, const void *buf, size_t bufLen)
{
size_t ret;
ret = write(fd, buf, bufLen);
if (unlikely(ret != bufLen))
- icarus_write_fault = 1;
+ return 1;
+
+ return 0;
}
#define icarus_close(fd) close(fd)
@@ -179,7 +178,7 @@ static bool icarus_detect_one(const char *devpath)
if (strncmp(nonce_hex, golden_nonce, 8)) {
applog(LOG_ERR,
"Icarus Detect: "
- "Test failed at %s : get %s, should: %s",
+ "Test failed at %s: get %s, should: %s",
devpath, nonce_hex, golden_nonce);
free(nonce_hex);
return false;
@@ -197,7 +196,8 @@ static bool icarus_detect_one(const char *devpath)
icarus->threads = 1;
devices[total_devices++] = icarus;
- icarus_write_fault = 0;
+ applog(LOG_INFO, "Found Icarus at %s, mark as %d",
+ devpath, icarus->device_id);
return true;
}
@@ -239,6 +239,7 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
{
struct cgpu_info *icarus;
int fd;
+ int ret;
unsigned char ob_bin[64], nonce_bin[4];
char *ob_hex, *nonce_hex;
@@ -257,32 +258,33 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
#ifndef WIN32
tcflush(fd, TCOFLUSH);
#endif
- icarus_write(fd, ob_bin, sizeof(ob_bin));
- if (icarus_write_fault)
+ ret = icarus_write(fd, ob_bin, sizeof(ob_bin));
+ if (ret)
return 0; /* This should never happen */
ob_hex = bin2hex(ob_bin, sizeof(ob_bin));
if (ob_hex) {
t = time(NULL);
- applog(LOG_DEBUG, "Icarus send : %s", ob_hex);
+ applog(LOG_DEBUG, "Icarus %s send: %s",
+ icarus->device_id, ob_hex);
free(ob_hex);
}
/* Icarus will return 8 bytes nonces or nothing */
memset(nonce_bin, 0, sizeof(nonce_bin));
- icarus_gets(nonce_bin, sizeof(nonce_bin), fd);
+ ret = icarus_gets(nonce_bin, sizeof(nonce_bin), fd);
nonce_hex = bin2hex(nonce_bin, sizeof(nonce_bin));
if (nonce_hex) {
t = time(NULL) - t;
- applog(LOG_DEBUG, "Icarus return (elapse %d seconds): %s",
- t, nonce_hex);
+ applog(LOG_DEBUG, "Icarus %d return (elapse %d seconds): %s",
+ icarus->device_id, t, nonce_hex);
free(nonce_hex);
}
memcpy((char *)&nonce, nonce_bin, sizeof(nonce_bin));
- if (nonce == 0 && icarus_read_count == ICARUS_READ_FAULT_COUNT)
+ if (nonce == 0 && ret)
return 0xffffffff;
#ifndef __BIG_ENDIAN__
@@ -324,7 +326,7 @@ static void icarus_shutdown(struct thr_info *thr)
}
struct device_api icarus_api = {
- .name = "Icarus",
+ .name = "ICA",
.api_detect = icarus_detect,
.thread_prepare = icarus_prepare,
.scanhash = icarus_scanhash,
--
1.7.5.4