From 4e384a86a4668946605378408c8c24ae7087536b Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Mon, 6 Jan 2025 20:16:25 +0200 Subject: [PATCH] fix tss compilation with patches Signed-off-by: Avi Deitcher --- pkg/tss/Dockerfile | 7 ++++++- pkg/tss/src/glibc_stubs/Makefile | 2 ++ pkg/tss/src/glibc_stubs/getpwent_r.h | 17 +++++++++++++++++ pkg/tss/src/patch/tspps.patch | 4 ++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 pkg/tss/src/glibc_stubs/getpwent_r.h create mode 100644 pkg/tss/src/patch/tspps.patch diff --git a/pkg/tss/Dockerfile b/pkg/tss/Dockerfile index ef7cfa457..f1725e66c 100644 --- a/pkg/tss/Dockerfile +++ b/pkg/tss/Dockerfile @@ -15,6 +15,7 @@ RUN apk add --no-cache --initdb \ linux-headers \ gcc \ make \ + patch \ openssl-dev \ util-linux \ && true @@ -24,11 +25,14 @@ COPY src/glibc_stubs/ /usr/src/glibc_stubs WORKDIR /usr/src/glibc_stubs RUN make && make install +COPY src/patch/ /usr/src/patch + RUN git clone https://git.code.sf.net/p/trousers/trousers /usr/src/trousers-trousers && cd /usr/src/trousers-trousers && git checkout $TROUSERS_COMMIT RUN git clone https://git.code.sf.net/p/trousers/tpm-tools /usr/src/trousers-tpm-tools && cd /usr/src/trousers-tpm-tools && git checkout $TPM_TOOLS_COMMIT WORKDIR /usr/src/trousers-trousers RUN sh bootstrap.sh && \ ./configure --prefix=/ --sysconfdir=/etc LDFLAGS="-L/out/lib/ -lgetpwent_r" && \ + for patch in /usr/src/patch/*.patch; do patch -p1 < $patch; done && \ make && \ make install prefix=/out WORKDIR /usr/src/trousers-tpm-tools @@ -57,7 +61,8 @@ RUN busybox chmod 0644 /etc/passwd /etc/group && \ busybox chmod 0640 /etc/shadow && \ busybox touch /etc/tcsd.conf && \ busybox chmod 0600 /etc/tcsd.conf && \ - busybox chown -R tss.tss /var/lib/tpm/ /etc/tcsd.conf && \ + busybox chown -R tss /var/lib/tpm/ /etc/tcsd.conf && \ + busybox chgrp -R tss /var/lib/tpm/ /etc/tcsd.conf && \ busybox rm /bin/busybox /bin/sh CMD ["/sbin/tcsd","-f"] diff --git a/pkg/tss/src/glibc_stubs/Makefile b/pkg/tss/src/glibc_stubs/Makefile index 5364edd6a..cb031aa80 100644 --- a/pkg/tss/src/glibc_stubs/Makefile +++ b/pkg/tss/src/glibc_stubs/Makefile @@ -2,6 +2,7 @@ .PHONY: all clean install SOLIB = libgetpwent_r.so +HEADER = getpwent_r.h DEPS = getpwent_r.o @@ -16,3 +17,4 @@ $(SOLIB): $(DEPS) install: mkdir -p /out/lib cp $(SOLIB) /out/lib + cp $(HEADER) /usr/include diff --git a/pkg/tss/src/glibc_stubs/getpwent_r.h b/pkg/tss/src/glibc_stubs/getpwent_r.h new file mode 100644 index 000000000..ebd04029c --- /dev/null +++ b/pkg/tss/src/glibc_stubs/getpwent_r.h @@ -0,0 +1,17 @@ +#ifndef GETPWENTR_H +#define GETPWENTR_H + +#include // For size_t +#include // For struct passwd + +#ifdef __cplusplus +extern "C" { +#endif + +int getpwent_r(struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **pwbufp); + +#ifdef __cplusplus +} +#endif + +#endif // GETPWENTR_H \ No newline at end of file diff --git a/pkg/tss/src/patch/tspps.patch b/pkg/tss/src/patch/tspps.patch new file mode 100644 index 000000000..1ccc943b2 --- /dev/null +++ b/pkg/tss/src/patch/tspps.patch @@ -0,0 +1,4 @@ +--- a/src/tspi/ps/tspps.c 2025-01-06 12:00:00.000000000 +0000 ++++ b/src/tspi/ps/tspps.c 2025-01-06 12:10:00.000000000 +0000 +@@ -50,0 +51 @@ ++#include