fix tss compilation with patches

Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
Avi Deitcher 2025-01-06 20:16:25 +02:00
parent 4165491275
commit 4e384a86a4
4 changed files with 29 additions and 1 deletions

View File

@ -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"]

View File

@ -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

View File

@ -0,0 +1,17 @@
#ifndef GETPWENTR_H
#define GETPWENTR_H
#include <stddef.h> // For size_t
#include <pwd.h> // 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

View File

@ -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 <getpwent_r.h>