kernel: Build the perf utility as part of the kernel build

The perf utility is somewhat kernel specific so might as well
compile it when we compile the kernel. The resulting binary
is statically linked (and stripped for size) and is added the
resulting kernel packages.

Although we add alpine packages such as libunwind and other,
it seems that the config detection code for perf/tools does
not detect them.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-06-14 13:13:51 -07:00
parent 06c857fb16
commit baf32846d8

View File

@ -93,6 +93,13 @@ RUN DVER=$(basename $(find /tmp/kernel-modules/lib/modules/ -mindepth 1 -maxdept
RUN printf "KERNEL_SOURCE=${KERNEL_SOURCE}\n" > /out/kernel-source-info
# perf (Don't compile for 4.4.x, it's broken and tedious to fix)
RUN if [ "${KERNEL_SERIES}" != "4.4.x" ]; then \
mkdir -p /build/perf && \
make -C tools/perf LDFLAGS=-static O=/build/perf && \
strip /build/perf/perf && \
cp /build/perf/perf /out; \
fi
FROM scratch
ENTRYPOINT []