alpine: add Makefile/Dockerfile to build the Linux perf utility

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2016-12-16 17:04:43 +00:00
parent 2cb9fc5223
commit e72977308c
4 changed files with 28 additions and 0 deletions

1
alpine/base/perf/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/bin

View File

@ -0,0 +1,17 @@
# Tag: 3da0b0ea0da2724232603094e67c75b41adab551
FROM mobylinux/alpine-build-c@sha256:0236d6599f6c8f7aa42829285e04202fbe99984df2818af0f5a453a59de8b090
ARG KERNEL_VERSION=4.8.14
# get kernel source and extract it under /linux
ENV KERNEL_SOURCE=https://www.kernel.org/pub/linux/kernel/v4.x/linux-${KERNEL_VERSION}.tar.xz
RUN curl -fsSL -o linux-${KERNEL_VERSION}.tar.xz ${KERNEL_SOURCE}
RUN cat linux-${KERNEL_VERSION}.tar.xz | tar --absolute-names -xJ && mv /linux-${KERNEL_VERSION} /linux
RUN mkdir -p /build/perf && \
make -C /linux/tools/perf O=/build/perf LDFLAGS=-static
WORKDIR /build/perf
CMD ["tar", "cf", "-", "perf"]

View File

@ -0,0 +1,9 @@
DEPS=Dockerfile
bin/perf: $(DEPS)
mkdir -p bin
BUILD=$$( docker build -q . ) && \
docker run --rm --net=none $$BUILD | tar xf - -C bin
clean:
rm -rf bin

View File

@ -0,0 +1 @@
Builds a statically linked version of the Linux kernel `perf` utility. You may want to/need to adjust the kernel version in the `Dockerfile` to match your kernel.