From 34d78b901c25517d730c7678ac54b8c2190d322a Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Mon, 13 Mar 2017 23:25:22 +0100 Subject: tegrarcm: allow target and native build, work with rss - adapt to the changes introduced with recipe specific sysroots - tegrarcm can now also be built for a target - tegrarcm can now also be built for nativesdk Signed-off-by: Max Krummenacher Acked-by: Marcel Ziswiler --- recipes-bsp/tegrarcm/tegrarcm.bb | 11 ++- ...pp-use-relative-path-for-cryptopp-headers.patch | 105 +++++++++++++++++++++ ...ecify-cryptopp-include-path-relative-to-s.patch | 27 ++++++ 3 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 recipes-bsp/tegrarcm/tegrarcm/0001-cryptopp-use-relative-path-for-cryptopp-headers.patch create mode 100644 recipes-bsp/tegrarcm/tegrarcm/0001-makefile-specify-cryptopp-include-path-relative-to-s.patch diff --git a/recipes-bsp/tegrarcm/tegrarcm.bb b/recipes-bsp/tegrarcm/tegrarcm.bb index 186593c..b4864dd 100644 --- a/recipes-bsp/tegrarcm/tegrarcm.bb +++ b/recipes-bsp/tegrarcm/tegrarcm.bb @@ -1,7 +1,7 @@ SUMMARY = "TegraRCM" DESCRIPTION = "Utility used to upload payloads to a NVIDIA Tegra based device in recovery mode (RCM)." SECTION = "bootloader" -DEPENDS = "libusb1-native libcryptopp-native" +DEPENDS = "libusb1 libcryptopp" LICENSE = "NVIDIA-Public" LIC_FILES_CHKSUM = "file://LICENSE;md5=395fe5affb633ad84474e42989a8e5be" @@ -10,7 +10,11 @@ BBCLASSEXTEND = "native nativesdk" SRC_URI = " \ git://github.com/NVIDIA/tegrarcm.git \ + file://0001-makefile-specify-cryptopp-include-path-relative-to-s.patch \ +" +SRC_URI_append_class-native = " \ file://0001-configure.ac-link-crypotpp-as-a-static-library.patch \ + file://0001-cryptopp-use-relative-path-for-cryptopp-headers.patch \ " SRCREV = "ec1eeac53420de6b34e814ebd28e92099b257487" @@ -21,9 +25,10 @@ EXTRA_OEMAKE = 'PREFIX="${prefix}" LIBDIR="${libdir}"' LDFLAGS_append = " -static-libstdc++" #we want tegrarcm binary to run on a 32-bit architecture, on x86_64 this requires the 32-bit compatibility libs -EXTRA_OEMAKE_class-native = "CC='${CC} -m32' CXX='${CXX} -m32 -I${includedir}/cryptopp'" +EXTRA_OEMAKE_class-native = "CC='${CC} -m32' CXX='${CXX} -m32'" +EXTRA_OEMAKE_class-nativesdk = "CC='${CC}' CXX='${CXX}'" S = "${WORKDIR}/git" -inherit autotools native +inherit autotools pkgconfig diff --git a/recipes-bsp/tegrarcm/tegrarcm/0001-cryptopp-use-relative-path-for-cryptopp-headers.patch b/recipes-bsp/tegrarcm/tegrarcm/0001-cryptopp-use-relative-path-for-cryptopp-headers.patch new file mode 100644 index 0000000..743bfee --- /dev/null +++ b/recipes-bsp/tegrarcm/tegrarcm/0001-cryptopp-use-relative-path-for-cryptopp-headers.patch @@ -0,0 +1,105 @@ +From 42e6130629fef6802839df51911f76a66da9c986 Mon Sep 17 00:00:00 2001 +From: Max Krummenacher +Date: Mon, 13 Mar 2017 22:02:59 +0100 +Subject: [PATCH] cryptopp: use relative path for cryptopp headers + +This works around having to specify an additional include directory +into the native recipe specific sysroot. + +Signed-off-by: Max Krummenacher +--- + src/aes-cmac.cpp | 12 ++++++------ + src/rsa-pss.cpp | 20 ++++++++++---------- + 2 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/src/aes-cmac.cpp b/src/aes-cmac.cpp +index 24c89f8..f8171da 100644 +--- a/src/aes-cmac.cpp ++++ b/src/aes-cmac.cpp +@@ -40,26 +40,26 @@ using std::string; + #include + using std::exit; + +-#include "cryptlib.h" ++#include "cryptopp/cryptlib.h" + using CryptoPP::Exception; + +-#include "cmac.h" ++#include "cryptopp/cmac.h" + using CryptoPP::CMAC; + +-#include "aes.h" ++#include "cryptopp/aes.h" + using CryptoPP::AES; + +-#include "hex.h" ++#include "cryptopp/hex.h" + using CryptoPP::HexEncoder; + using CryptoPP::HexDecoder; + +-#include "filters.h" ++#include "cryptopp/filters.h" + using CryptoPP::StringSink; + using CryptoPP::StringSource; + using CryptoPP::HashFilter; + using CryptoPP::HashVerificationFilter; + +-#include "secblock.h" ++#include "cryptopp/secblock.h" + using CryptoPP::SecByteBlock; + + extern "C" int cmac_hash(const unsigned char *msg, int len, unsigned char *cmac_buf) +diff --git a/src/rsa-pss.cpp b/src/rsa-pss.cpp +index ab0a680..1025cc3 100644 +--- a/src/rsa-pss.cpp ++++ b/src/rsa-pss.cpp +@@ -40,36 +40,36 @@ using std::string; + #include + using std::exit; + +-#include "cryptlib.h" ++#include "cryptopp/cryptlib.h" + using CryptoPP::Exception; + +-#include "integer.h" ++#include "cryptopp/integer.h" + using CryptoPP::Integer; + +-#include "files.h" ++#include "cryptopp/files.h" + using CryptoPP::FileSource; + +-#include "filters.h" ++#include "cryptopp/filters.h" + using CryptoPP::StringSink; + using CryptoPP::SignerFilter; + +-#include "queue.h" ++#include "cryptopp/queue.h" + using CryptoPP::ByteQueue; + +-#include "rsa.h" ++#include "cryptopp/rsa.h" + using CryptoPP::RSA; + using CryptoPP::RSASS; + +-#include "pssr.h" ++#include "cryptopp/pssr.h" + using CryptoPP::PSS; + +-#include "sha.h" ++#include "cryptopp/sha.h" + using CryptoPP::SHA256; + +-#include "secblock.h" ++#include "cryptopp/secblock.h" + using CryptoPP::SecByteBlock; + +-#include "osrng.h" ++#include "cryptopp/osrng.h" + using CryptoPP::AutoSeededRandomPool; + + #include "rsa-pss.h" +-- +2.6.6 + diff --git a/recipes-bsp/tegrarcm/tegrarcm/0001-makefile-specify-cryptopp-include-path-relative-to-s.patch b/recipes-bsp/tegrarcm/tegrarcm/0001-makefile-specify-cryptopp-include-path-relative-to-s.patch new file mode 100644 index 0000000..99fa8e7 --- /dev/null +++ b/recipes-bsp/tegrarcm/tegrarcm/0001-makefile-specify-cryptopp-include-path-relative-to-s.patch @@ -0,0 +1,27 @@ +From 06b764d9d9503c3ec8c7635ec9a6128d7904cfe5 Mon Sep 17 00:00:00 2001 +From: Max Krummenacher +Date: Mon, 6 Mar 2017 00:20:46 +0100 +Subject: [PATCH] makefile: specify cryptopp include path relative to sysroot + +That way, neither for native nor target compilation the hosts +cryptopp headers are picked up. + +Signed-off-by: Max Krummenacher +--- + src/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Makefile.am b/src/Makefile.am +index 3dad0e6..5e9b110 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -1,5 +1,5 @@ + AM_CFLAGS = -Wall -std=c99 +-AM_CPPFLAGS = -isystem /usr/include/$(CRYPTOLIB) $(LIBUSB_CFLAGS) ++AM_CPPFLAGS = -I=$(prefix)/include/$(CRYPTOLIB) $(LIBUSB_CFLAGS) + + bin_PROGRAMS = tegrarcm + tegrarcm_SOURCES = \ +-- +2.6.6 + -- cgit v1.2.3