Date:2012-03-05 03:19:17 (8 years 4 months ago)
Author:Xiangfu Liu
Commit:9feb48247d2fb45cacaaec5ac6fad506ad9a5191
Message:cgminer: most patches merged to upstream

Files: cgminer/Makefile (3 diffs)
cgminer/patches/0001-add-MIPSED-to-icarus-for-BIG_ENDIAN.patch.patch (1 diff)
cgminer/patches/0001-fix-the-name-to-3-chars-fix-the-multi-icarus-support.patch (1 diff)
cgminer/patches/0002-add-MIPSED-to-icarus-for-BIG_ENDIAN.patch.patch (1 diff)

Change Details

cgminer/Makefile
11#
2# Copyright (C) 2012 Xiangfu Liu <xiangfu@sharism.cc>
2# Copyright (C) 2012 Xiangfu Liu <xiangfu.z@gmail.com>
33# bitcoin: 1BQvUsuQBYUyVuX4jjFk4dVBpWJVQEUHTZ
44#
55# This is free software, licensed under the GNU General Public License v2.
...... 
99include $(TOPDIR)/rules.mk
1010
1111PKG_NAME:=cgminer
12PKG_VERSION:=20120226
13PKG_REV:=daf1eff13c5583770ed4a8e7a399924b1e208845
12PKG_VERSION:=20120305
13PKG_REV:=97ab111ec924e8812eaeff2f4f71940811a3cf1b
1414PKG_RELEASE:=1
1515PKG_INSTALL:=1
1616
...... 
2525include $(INCLUDE_DIR)/package.mk
2626
2727define Package/cgminer
28    MAINTAINER:="Xiangfu Liu" \
29        <xiangfu@sharism.cc> <1BQvUsuQBYUyVuX4jjFk4dVBpWJVQEUHTZ>
28    MAINTAINER:="Xiangfu Liu" <xiangfu@sharism.cc>
3029    SECTION:=utils
3130    CATEGORY:=Utilities
32    TITLE:=cgminer
31    TITLE:=cgminer (FPGA Miner)
3332    URL:=https://github.com/ckolivas/cgminer
3433    DEPENDS:=+libcurl +libpthread +libncurses +jansson
3534endef
3635
3736define Package/cgminer/description
37Cgminer is a multi-threaded multi-pool GPU, FPGA and CPU miner with ATI GPU
38monitoring, (over)clocking and fanspeed support for bitcoin and derivative
39coins. Do not use on multiple block chains at the same time!
3840endef
41# This package only enable the Icarus support. just connect your Icarus
42# FPGA miner board to OpenWrt router(with USB HOST support)
43# Run like:
44# cgminer -S /dev/ttyUSB0 -o http://MINING.POOL.URL -O USER:PASS
3945
4046CONFIGURE_ARGS += --disable-opencl --disable-adl --enable-icarus
41TARGET_CFLAGS +=
4247TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
4348
4449define Package/cgminer/install
cgminer/patches/0001-add-MIPSED-to-icarus-for-BIG_ENDIAN.patch.patch
1From 5d3d883703d8098537c248c797009247f51b116b Mon Sep 17 00:00:00 2001
2From: Xiangfu <xiangfu@openmobilefree.net>
3Date: Sun, 19 Feb 2012 22:20:22 +0800
4Subject: [PATCH] add-MIPSED-to-icarus-for-BIG_ENDIAN.patch
5
6---
7 icarus.c | 2 +-
8 1 files changed, 1 insertions(+), 1 deletions(-)
9
10diff --git a/icarus.c b/icarus.c
11index 1d59657..26f4927 100644
12--- a/icarus.c
13@@ -287,7 +287,7 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
14         if (nonce == 0 && ret)
15                 return 0xffffffff;
16
17-#ifndef __BIG_ENDIAN__
18+#if !defined (__BIG_ENDIAN__) && !defined(MIPSEB)
19     nonce = swab32(nonce);
20 #endif
21     work->blk.nonce = 0xffffffff;
22--
231.7.5.4
24
cgminer/patches/0001-fix-the-name-to-3-chars-fix-the-multi-icarus-support.patch
1From 88fae1c0217e68d43480c73d78efdcc2665c5f13 Mon Sep 17 00:00:00 2001
2From: Xiangfu <xiangfu@openmobilefree.net>
3Date: Sat, 25 Feb 2012 22:09:47 +0800
4Subject: [PATCH 1/2] fix the name to 3 chars, fix the multi-icarus support
5
6 icarus.c | 48 +++++++++++++++++++++++++-----------------------
7 1 files changed, 25 insertions(+), 23 deletions(-)
8
9diff --git a/icarus.c b/icarus.c
10index 7739395..1d59657 100644
11+++ b/icarus.c
12@@ -52,9 +52,6 @@
13
14 #define ICARUS_READ_FAULT_COUNT (8)
15
16-static int icarus_read_count;
17-static int icarus_write_fault;
18-
19 struct device_api icarus_api;
20
21 static void rev(unsigned char *s, size_t l)
22@@ -108,11 +105,10 @@ static int icarus_open(const char *devpath)
23 #endif
24 }
25
26-static void icarus_gets(unsigned char *buf, size_t bufLen, int fd)
27+static int icarus_gets(unsigned char *buf, size_t bufLen, int fd)
28 {
29     ssize_t ret = 0;
30-
31- icarus_read_count = 0;
32+ int rc = 0;
33
34     while (bufLen) {
35         ret = read(fd, buf, 1);
36@@ -122,23 +118,26 @@ static void icarus_gets(unsigned char *buf, size_t bufLen, int fd)
37             continue;
38         }
39
40- icarus_read_count++;
41- if (icarus_read_count == ICARUS_READ_FAULT_COUNT) {
42+ rc++;
43+ if (rc == ICARUS_READ_FAULT_COUNT) {
44             applog(LOG_WARNING,
45- "Icarus Read: No data in %d seconds",
46- ICARUS_READ_FAULT_COUNT);
47- break;
48+ "Icarus Read: No data in %d seconds", rc);
49+ return 1;
50         }
51     }
52+
53+ return 0;
54 }
55
56-static void icarus_write(int fd, const void *buf, size_t bufLen)
57+static int icarus_write(int fd, const void *buf, size_t bufLen)
58 {
59     size_t ret;
60
61     ret = write(fd, buf, bufLen);
62     if (unlikely(ret != bufLen))
63- icarus_write_fault = 1;
64+ return 1;
65+
66+ return 0;
67 }
68
69 #define icarus_close(fd) close(fd)
70@@ -179,7 +178,7 @@ static bool icarus_detect_one(const char *devpath)
71         if (strncmp(nonce_hex, golden_nonce, 8)) {
72             applog(LOG_ERR,
73                    "Icarus Detect: "
74- "Test failed at %s : get %s, should: %s",
75+ "Test failed at %s: get %s, should: %s",
76                    devpath, nonce_hex, golden_nonce);
77             free(nonce_hex);
78             return false;
79@@ -197,7 +196,8 @@ static bool icarus_detect_one(const char *devpath)
80     icarus->threads = 1;
81     devices[total_devices++] = icarus;
82
83- icarus_write_fault = 0;
84+ applog(LOG_INFO, "Found Icarus at %s, mark as %d",
85+ devpath, icarus->device_id);
86
87     return true;
88 }
89@@ -239,6 +239,7 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
90 {
91     struct cgpu_info *icarus;
92     int fd;
93+ int ret;
94
95     unsigned char ob_bin[64], nonce_bin[4];
96     char *ob_hex, *nonce_hex;
97@@ -257,32 +258,33 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
98 #ifndef WIN32
99     tcflush(fd, TCOFLUSH);
100 #endif
101- icarus_write(fd, ob_bin, sizeof(ob_bin));
102- if (icarus_write_fault)
103+ ret = icarus_write(fd, ob_bin, sizeof(ob_bin));
104+ if (ret)
105         return 0; /* This should never happen */
106
107     ob_hex = bin2hex(ob_bin, sizeof(ob_bin));
108     if (ob_hex) {
109         t = time(NULL);
110- applog(LOG_DEBUG, "Icarus send : %s", ob_hex);
111+ applog(LOG_DEBUG, "Icarus %s send: %s",
112+ icarus->device_id, ob_hex);
113         free(ob_hex);
114     }
115
116     /* Icarus will return 8 bytes nonces or nothing */
117     memset(nonce_bin, 0, sizeof(nonce_bin));
118- icarus_gets(nonce_bin, sizeof(nonce_bin), fd);
119+ ret = icarus_gets(nonce_bin, sizeof(nonce_bin), fd);
120
121     nonce_hex = bin2hex(nonce_bin, sizeof(nonce_bin));
122     if (nonce_hex) {
123         t = time(NULL) - t;
124- applog(LOG_DEBUG, "Icarus return (elapse %d seconds): %s",
125- t, nonce_hex);
126+ applog(LOG_DEBUG, "Icarus %d return (elapse %d seconds): %s",
127+ icarus->device_id, t, nonce_hex);
128         free(nonce_hex);
129     }
130
131     memcpy((char *)&nonce, nonce_bin, sizeof(nonce_bin));
132
133- if (nonce == 0 && icarus_read_count == ICARUS_READ_FAULT_COUNT)
134+ if (nonce == 0 && ret)
135                 return 0xffffffff;
136
137 #ifndef __BIG_ENDIAN__
138@@ -324,7 +326,7 @@ static void icarus_shutdown(struct thr_info *thr)
139 }
140
141 struct device_api icarus_api = {
142- .name = "Icarus",
143+ .name = "ICA",
144     .api_detect = icarus_detect,
145     .thread_prepare = icarus_prepare,
146     .scanhash = icarus_scanhash,
1471.7.5.4
148
cgminer/patches/0002-add-MIPSED-to-icarus-for-BIG_ENDIAN.patch.patch
1From bed5510daca0a751e264da14367d3389f4f93dbd Mon Sep 17 00:00:00 2001
2From: Xiangfu <xiangfu@openmobilefree.net>
3Date: Sun, 19 Feb 2012 22:20:22 +0800
4Subject: [PATCH 2/2] add-MIPSED-to-icarus-for-BIG_ENDIAN.patch
5
6 icarus.c | 2 +-
7 1 files changed, 1 insertions(+), 1 deletions(-)
8
9diff --git a/icarus.c b/icarus.c
10index 1d59657..26f4927 100644
11+++ b/icarus.c
12@@ -287,7 +287,7 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
13         if (nonce == 0 && ret)
14                 return 0xffffffff;
15
16-#ifndef __BIG_ENDIAN__
17+#if !defined (__BIG_ENDIAN__) && !defined(MIPSEB)
18     nonce = swab32(nonce);
19 #endif
20     work->blk.nonce = 0xffffffff;
211.7.5.4
22

Archive Download the corresponding diff file



interactive