diff --git a/Makefile.unix.amd b/Makefile.unix.amd new file mode 100644 index 0000000..afe4afa --- /dev/null +++ b/Makefile.unix.amd @@ -0,0 +1,31 @@ +LIBS=-lpcre -lcrypto -lm -lpthread -L/opt/AMDAPP/lib -L/opt/AMDAPP/lib/x86_64 +CFLAGS=-ggdb -O3 -Wall -I/opt/AMDAPP/include +OBJS=vanitygen.o oclvanitygen.o oclvanityminer.o oclengine.o keyconv.o pattern.o util.o +PROGS=vanitygen keyconv oclvanitygen oclvanityminer + +PLATFORM=$(shell uname -s) +ifeq ($(PLATFORM),Darwin) +OPENCL_LIBS=-framework OpenCL +else +OPENCL_LIBS=-lOpenCL +endif + + +most: vanitygen keyconv + +all: $(PROGS) + +vanitygen: vanitygen.o pattern.o util.o + $(CC) $^ -o $@ $(CFLAGS) $(LIBS) + +oclvanitygen: oclvanitygen.o oclengine.o pattern.o util.o + $(CC) $^ -o $@ $(CFLAGS) $(LIBS) $(OPENCL_LIBS) + +oclvanityminer: oclvanityminer.o oclengine.o pattern.o util.o + $(CC) $^ -o $@ $(CFLAGS) $(LIBS) $(OPENCL_LIBS) -lcurl + +keyconv: keyconv.o util.o + $(CC) $^ -o $@ $(CFLAGS) $(LIBS) + +clean: + rm -f $(OBJS) $(PROGS) $(TESTS) diff --git a/oclengine.c b/oclengine.c index 4a6a232..a31ab34 100644 --- a/oclengine.c +++ b/oclengine.c @@ -447,6 +447,8 @@ vg_ocl_get_quirks(vg_ocl_context_t *vocp) dvn = vg_ocl_device_getstr(vocp->voc_ocldid, CL_DEVICE_NAME); + if (!strcmp(dvn, "Tahiti") || !strcmp(dvn, "Barts") || !strcmp(dvn, "Pitcairn")) + quirks &= ~VG_OCL_AMD_BFI_INT; if (!strcmp(dvn, "ATI RV710")) { quirks &= ~VG_OCL_OPTIMIZATIONS; quirks |= VG_OCL_NO_BINARIES; diff --git a/oclvanitygen.c b/oclvanitygen.c index 9755ef6..be236e1 100644 --- a/oclvanitygen.c +++ b/oclvanitygen.c @@ -16,10 +16,12 @@ * along with Vanitygen. If not, see . */ +#include +#include #include #include -#include -#include +#include +#include #include #include @@ -76,7 +78,8 @@ usage(const char *name) "-f File containing list of patterns, one per line\n" " (Use \"-\" as the file name for stdin)\n" "-o Write pattern matches to \n" -"-s Seed random number generator from \n", +"-s Seed random number generator from \n" +"-O Save PID in \n", version, name); } @@ -107,10 +110,11 @@ main(int argc, char **argv) int verify_mode = 0; int safe_mode = 0; vg_context_t *vcp = NULL; - vg_ocl_context_t *vocp = NULL; - EC_POINT *pubkey_base = NULL; - const char *result_file = NULL; + vg_ocl_context_t *vocp = NULL; + EC_POINT *pubkey_base = NULL; + const char *result_file = NULL; const char *key_password = NULL; + const char *pidfile = NULL; char *devstrs[MAX_DEVS]; int ndevstrs = 0; int opened = 0; @@ -123,7 +127,7 @@ main(int argc, char **argv) int i; while ((opt = getopt(argc, argv, - "vqik1NTX:eE:p:P:d:w:t:g:b:VSh?f:o:s:D:")) != -1) { + "vqik1NTX:eE:p:P:d:w:t:g:b:VSh?f:o:O:s:D:")) != -1) { switch (opt) { case 'v': verbose = 2; @@ -282,7 +286,10 @@ main(int argc, char **argv) } seedfile = optarg; break; - default: + case 'O': + pidfile = optarg; + break; + case 'h': case '?': default: usage(argv[0]); return 1; } @@ -322,6 +329,18 @@ main(int argc, char **argv) } } + if (pidfile) { + FILE *fd = fopen(pidfile, "wb"); + if (!fd) { + fprintf(stderr, "Could not write pid, open file failure: %s\n", pidfile); + return 1; + } + char buf[8]; + snprintf(buf, sizeof(buf), "%d", getpid()); + fwrite(buf, strlen(buf), 1, fd); + fclose(fd); + } + if (regex) { vcp = vg_regex_context_new(addrtype, privtype);