summaryrefslogtreecommitdiff
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2020-08-08 18:46:43 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2020-10-18 19:08:32 +0200
commit2037b837f81485770fcb066adea70b1d22e9b727 (patch)
tree41d15b95f38843dfe5fb45327c25d3a116731b05 /rbutil
parent815b289cb3438ed566b3e9dc5074fe12e4b98f46 (diff)
downloadrockbox-2037b837f81485770fcb066adea70b1d22e9b727.tar.gz
rockbox-2037b837f81485770fcb066adea70b1d22e9b727.zip
sbtools: convert crypto to libtomcrypt.
Replace the use of crypto++ with tomcrypt, which is much smaller and C. This gets rid of various build issues for systems that don't ship crypo++ (i.e. everything except Linux.) Change-Id: Ic0799e17b94935c71b14765cf9a2a7ea2b0adc7a
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/mkimxboot/Makefile33
-rw-r--r--rbutil/rbutilqt/Makefile.libs4
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro6
3 files changed, 23 insertions, 20 deletions
diff --git a/rbutil/mkimxboot/Makefile b/rbutil/mkimxboot/Makefile
index 9ad21a1966..d2c487c475 100644
--- a/rbutil/mkimxboot/Makefile
+++ b/rbutil/mkimxboot/Makefile
@@ -8,24 +8,18 @@
8# We use the SB code available in the Rockbox utils/sbtools directory 8# We use the SB code available in the Rockbox utils/sbtools directory
9 9
10IMXTOOLS_DIR=../../utils/imxtools/sbtools/ 10IMXTOOLS_DIR=../../utils/imxtools/sbtools/
11CFLAGS += -I$(IMXTOOLS_DIR) -Wall
12# std=gnu99 is required by MinGW on Windows (c99 is sufficient for Linux / MXE)
13CFLAGS += -std=gnu99 -g -O3
14 11
15# Location to pkg-config binary. 12COMPILEFLAGS := -Wall -g -O3 -I$(IMXTOOLS_DIR)
16PKGCONFIG := pkg-config 13
14# std=gnu99 is required by MinGW on Windows (c99 is sufficient for Linux / MXE)
15CFLAGS += -std=gnu99 $(COMPILEFLAGS)
16CXXFLAGS += $(COMPILEFLAGS)
17 17
18# Distros could use different names for the crypto library. We try a list 18TOMCRYPT_DIR := ../../utils/tomcrypt
19# of candidate names, only one of them should be the valid one.
20LIBCRYPTO_NAMES = libcryptopp libcrypto++ cryptopp crypto++
21 19
22$(foreach l,$(LIBCRYPTO_NAMES),\ 20CXXFLAGS += -I$(TOMCRYPT_DIR)/src/headers
23 $(eval LDOPTS += $(shell $(PKGCONFIG) --silence-errors --libs $(l)))) 21CFLAGS += -I$(TOMCRYPT_DIR)/src/headers
24$(foreach l,$(LIBCRYPTO_NAMES),\ 22LDOPTS += -lpthread $(TOMCRYPT_DIR)/librbtomcrypt.a
25 $(eval CFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))
26$(foreach l,$(LIBCRYPTO_NAMES),\
27 $(eval CXXFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))
28LDOPTS += -lpthread
29 23
30OUTPUT = mkimxboot 24OUTPUT = mkimxboot
31 25
@@ -33,6 +27,10 @@ OUTPUT = mkimxboot
33IMXTOOLS_SOURCES = misc.c sb.c crypto.cpp crc.c elf.c 27IMXTOOLS_SOURCES = misc.c sb.c crypto.cpp crc.c elf.c
34LIBSOURCES := dualboot.c mkimxboot.c md5.c \ 28LIBSOURCES := dualboot.c mkimxboot.c md5.c \
35 $(addprefix $(IMXTOOLS_DIR),$(IMXTOOLS_SOURCES)) 29 $(addprefix $(IMXTOOLS_DIR),$(IMXTOOLS_SOURCES))
30
31# for now build tomcrypt as part of the lib.
32LIBSOURCES += $(addprefix $(TOMCRYPT_DIR),$(TOMCRYPT_SOURCES))
33
36# inputs for binary only 34# inputs for binary only
37SOURCES := $(LIBSOURCES) main.c 35SOURCES := $(LIBSOURCES) main.c
38# dependencies for binary 36# dependencies for binary
@@ -43,3 +41,8 @@ include ../libtools.make
43# explicit dependencies on dualboot.{c,h} and mkimxboot.h 41# explicit dependencies on dualboot.{c,h} and mkimxboot.h
44$(OBJDIR)mkimxboot.o: dualboot.h dualboot.c mkimxboot.c mkimxboot.h 42$(OBJDIR)mkimxboot.o: dualboot.h dualboot.c mkimxboot.c mkimxboot.h
45$(OBJDIR)main.o: dualboot.h dualboot.c main.c mkimxboot.h 43$(OBJDIR)main.o: dualboot.h dualboot.c main.c mkimxboot.h
44$(BINARY): librbtomcrypt.a
45
46librbtomcrypt.a:
47 $(MAKE) -C ../../utils/tomcrypt
48
diff --git a/rbutil/rbutilqt/Makefile.libs b/rbutil/rbutilqt/Makefile.libs
index 6d5c8c5354..938426f124 100644
--- a/rbutil/rbutilqt/Makefile.libs
+++ b/rbutil/rbutilqt/Makefile.libs
@@ -33,12 +33,14 @@ export CC=$(EXTRALIBS_CC)
33export CXX=$(EXTRALIBS_CXX) 33export CXX=$(EXTRALIBS_CXX)
34export AR=$(EXTRALIBS_AR) 34export AR=$(EXTRALIBS_AR)
35 35
36libs: librbspeex libucl libipodpatcher libsansapatcher libmkamsboot libmktccboot libmkmpioboot libchinachippatcher libmkimxboot libmks5lboot libbzip2 libbspatch 36libs: librbspeex libucl libipodpatcher libsansapatcher libmkamsboot libmktccboot libmkmpioboot libchinachippatcher libmkimxboot libmks5lboot libbzip2 libbspatch librbtomcrypt
37 37
38# To support cross compiles, we explicitly pass the CC flag below for 38# To support cross compiles, we explicitly pass the CC flag below for
39# all tools which override CC or CXX in their makefiles. CXX is only 39# all tools which override CC or CXX in their makefiles. CXX is only
40# used by mkimxboot. 40# used by mkimxboot.
41 41
42librbtomcrypt:
43 $(SILENT) $(MAKE) -C $(RBBASE_DIR)/utils/tomcrypt BUILD_DIR=$(BUILD_DIR)/tomcrypt librbtomcrypt.a
42librbspeex: 44librbspeex:
43 $(SILENT) $(MAKE) -C $(RBBASE_DIR)/tools/rbspeex BUILD_DIR=$(BUILD_DIR)/libspeex librbspeex.a 45 $(SILENT) $(MAKE) -C $(RBBASE_DIR)/tools/rbspeex BUILD_DIR=$(BUILD_DIR)/libspeex librbspeex.a
44 46
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index d07c1e01bc..9d7da92dbf 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -85,7 +85,8 @@ extralibs.commands = $$SILENT \
85# Note: order is important for RBLIBS! The libs are appended to the linker 85# Note: order is important for RBLIBS! The libs are appended to the linker
86# flags in this order, put libucl at the end. 86# flags in this order, put libucl at the end.
87RBLIBS = rbspeex ipodpatcher sansapatcher mkamsboot mktccboot \ 87RBLIBS = rbspeex ipodpatcher sansapatcher mkamsboot mktccboot \
88 mkmpioboot chinachippatcher mkimxboot mks5lboot bspatch ucl 88 mkmpioboot chinachippatcher mkimxboot mks5lboot bspatch ucl \
89 rbtomcrypt
89# NOTE: Linking bzip2 causes problems on Windows (Qt seems to export those 90# NOTE: Linking bzip2 causes problems on Windows (Qt seems to export those
90# symbols as well, similar to what we have with zlib.) Only link that on 91# symbols as well, similar to what we have with zlib.) Only link that on
91# non-Windows for now. 92# non-Windows for now.
@@ -139,9 +140,6 @@ for(rblib, RBLIBS) {
139 LIBS += -l$$rblib 140 LIBS += -l$$rblib
140} 141}
141 142
142# We need libcrypto++
143LIBS += -lcryptopp
144
145# on win32 libz is linked implicitly. 143# on win32 libz is linked implicitly.
146!win32 { 144!win32 {
147 LIBS += -lz 145 LIBS += -lz