Skip to content

Commit

Permalink
[WIP] cross build json-c and cryptsetup
Browse files Browse the repository at this point in the history
tlaurion CircleCI test:
Rebasing to master and outputing result of build into linuxboot#876 and pinging @root-hardenedvault to follow his github from CircleCI
  • Loading branch information
root-hardenedvault authored and tlaurion committed Nov 1, 2020
1 parent b60f881 commit 2cff842
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 10 deletions.
Empty file.
10 changes: 6 additions & 4 deletions modules/cryptsetup
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ cryptsetup_configure := ./configure \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--prefix "/" \
--disable-rpath \
--disable-gcrypt-pbkdf2 \
--enable-cryptsetup-reencrypt \
--with-crypto_backend=kernel \
--with-tmpfilesdir=$(INSTALL)/lib/tmpfiles.d

# but after building, replace prefix so that they will be installed
# in the correct directory.
Expand All @@ -28,10 +30,10 @@ cryptsetup_target := \
install

cryptsetup_output := \
src/.libs/cryptsetup \
src/.libs/cryptsetup-reencrypt \
src/.libs/veritysetup \
.libs/cryptsetup \
.libs/cryptsetup-reencrypt \
.libs/veritysetup \

cryptsetup_libraries := \
lib/.libs/libcryptsetup.so.12.6.0 \
.libs/libcryptsetup.so.12 \

24 changes: 21 additions & 3 deletions modules/json-c
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,30 @@ json-c_hash := 99914e644a25201d82ccefa20430f7515c110923360f9ef46755527c02412afa

# there is a bug in cmake-configure so that it can not be used with a "=", fxed in next
# release though (then it needs to read '--prefix="$(INSTALL)"' here instead
json-c_configure := mkdir -p build && \
define toolchain_file =
set\(CMAKE_SYSTEM_NAME Linux\)\n\
set\(CMAKE_SYSROOT $(INSTALL)\)\n\
set\(CMAKE_C_COMPILER $(CROSS)gcc\)\n\
set\(CMAKE_AR $(CROSS)ar\)\n\
set\(CMAKE_LINKER $(CROSS)ld\)\n\
set\(CMAKE_NM $(CROSS)nm\)\n\
set\(CMAKE_OBJCOPY $(CROSS)objcopy\)\n\
set\(CMAKE_OBJDUMP $(CROSS)objdump\)\n\
set\(INSTALL_PKGCONFIG_DIR $(INSTALL)/lib/pkgconfig\)\n\
set\(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER\)\n\
set\(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY\)\n\
set\(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY\)\n\
set\(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY\)
endef

json-c_configure := \
echo -e "$(toolchain_file)" | sed 's/\\//g' > toolchain && \
mkdir -p build && \
cd build && \
../cmake-configure --prefix "$(INSTALL)"
cmake .. -DCMAKE_INSTALL_PREFIX="$(INSTALL)" -DCMAKE_TOOLCHAIN_FILE=../toolchain

json-c_target := \
$(CROSS_TOOLS) -C $(build)/$(json-c_dir)/build \
all install

json-c_libraries := .libs/libjson-c.so.5.0.0
json-c_libraries := build/libjson-c.so.5
4 changes: 3 additions & 1 deletion modules/util-linux
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ util-linux_target := \
$(MAKE_JOBS) \
$(CROSS_TOOLS) \
DESTDIR="$(INSTALL)" \
install
install && \
rm $(INSTALL)/lib/libblkid.la && \
rm $(INSTALL)/lib/libuuid.la

util-linux_libraries += \
.libs/libuuid.so.1 \
Expand Down
23 changes: 21 additions & 2 deletions patches/cryptsetup-2.3.3.patch
Original file line number Diff line number Diff line change
Expand Up @@ -511,17 +511,36 @@ diff -u -r cryptsetup-2.3.3-clean/Makefile.in cryptsetup-2.3.3/Makefile.in
@CRYPTSETUP_TRUE@cryptsetup_LDADD = $(LDADD) \
@CRYPTSETUP_TRUE@ libcryptsetup.la \
@CRYPTSETUP_TRUE@ @POPT_LIBS@ \
+@CRYPTSETUP_TRUE@ @UUID_LIBS@ \
+@CRYPTSETUP_TRUE@ @DEVMAPPER_LIBS@ \
+@CRYPTSETUP_TRUE@ @JSON_C_LIBS@ \
@CRYPTSETUP_TRUE@ @PWQUALITY_LIBS@ \
@CRYPTSETUP_TRUE@ @PASSWDQC_LIBS@ \
@CRYPTSETUP_TRUE@ @UUID_LIBS@ \
@@ -1060,6 +1062,8 @@
@@ -1060,6 +1062,9 @@
@VERITYSETUP_TRUE@veritysetup_LDADD = $(LDADD) \
@VERITYSETUP_TRUE@ libcryptsetup.la \
@VERITYSETUP_TRUE@ @POPT_LIBS@ \
+@VERITYSETUP_TRUE@ @UUID_LIBS@ \
+@VERITYSETUP_TRUE@ @DEVMAPPER_LIBS@ \
+@VERITYSETUP_TRUE@ @JSON_C_LIBS@ \
@VERITYSETUP_TRUE@ @PWQUALITY_LIBS@ \
@VERITYSETUP_TRUE@ @PASSWDQC_LIBS@ \
@VERITYSETUP_TRUE@ @BLKID_LIBS@
@@ -1093,6 +1093,8 @@
@INTEGRITYSETUP_TRUE@ libcryptsetup.la \
@INTEGRITYSETUP_TRUE@ @POPT_LIBS@ \
@INTEGRITYSETUP_TRUE@ @UUID_LIBS@ \
+@INTEGRITYSETUP_TRUE@ @DEVMAPPER_LIBS@ \
+@INTEGRITYSETUP_TRUE@ @JSON_C_LIBS@ \
@INTEGRITYSETUP_TRUE@ @BLKID_LIBS@

@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@integritysetup_static_SOURCES = $(integritysetup_SOURCES)
@@ -1122,6 +1122,8 @@
@REENCRYPT_TRUE@ @POPT_LIBS@ \
@REENCRYPT_TRUE@ @PWQUALITY_LIBS@ \
@REENCRYPT_TRUE@ @PASSWDQC_LIBS@ \
+@REENCRYPT_TRUE@ @DEVMAPPER_LIBS@ \
+@REENCRYPT_TRUE@ @JSON_C_LIBS@ \
@REENCRYPT_TRUE@ @UUID_LIBS@ \
@REENCRYPT_TRUE@ @BLKID_LIBS@

0 comments on commit 2cff842

Please sign in to comment.