Files
linuxkit/alpine/kernel/Dockerfile.aufs
Justin Cormack 3b774e3657 Make AUFS optional and ship choice of kernels
This seems the best option, although none are great

- build with `make AUFS=1` to build with AUFS support, currently with 4.8 kernel
- default is to build without AUFS support, with 4.9 kernel

This recognises that AUFS supprot is temporary #620 and only there until
we can phase it out on desktop editions, and allow the other editions that
never shipped with AUFS to ship something very close to mainline.

However we do still apply the patches so that the non AUFS branch runs fine on
all platforms, so it can be tested elsewhere.

We may be able to move the kernel versions back in line when 4.9 aufs support is out.

Plan is to shift CI to build both sets of images, and get the Desktop editions to
pick up the aufs set automatically, once this is merged.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-12-13 18:23:45 -08:00

86 lines
3.1 KiB
Docker

# Tag: 36aecb5cf4738737634140eec9abebe1f6559a39
FROM mobylinux/alpine-build-c@sha256:d66b9625abc831f28f8c584991a9cb6975e85d3bb3d3768474b592f1cf32a3a6
ARG KERNEL_VERSION=4.8.14
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
# this is aufs4.8 20161010
ENV AUFS_REPO https://github.com/sfjro/aufs4-standalone
ENV AUFS_BRANCH aufs4.8
ENV AUFS_COMMIT e9fd128dcb16167417683e199a5feb14f3c9eca8
# Download AUFS
RUN git clone -b "$AUFS_BRANCH" "$AUFS_REPO" /aufs && \
cd /aufs && \
git checkout -q "$AUFS_COMMIT"
# aufs-util 20151116
ENV AUFS_TOOLS_REPO https://github.com/ncopa/aufs-util.git
ENV AUFS_TOOLS_COMMIT 3b7c5e262b53598a8204a915e485489c46d4e7a4
# Download aufs tools
RUN git clone ${AUFS_TOOLS_REPO} && \
cd /aufs-util && \
git checkout "$AUFS_TOOLS_COMMIT"
#BUILD
# patch kernel with aufs
RUN cd /linux && \
cp -r /aufs/Documentation /linux && \
cp -r /aufs/fs /linux && \
cp -r /aufs/include/uapi/linux/aufs_type.h /linux/include/uapi/linux/ && \
set -e && for patch in \
/aufs/aufs*-kbuild.patch \
/aufs/aufs*-base.patch \
/aufs/aufs*-mmap.patch \
/aufs/aufs*-standalone.patch \
/aufs/aufs*-loopback.patch \
/aufs/lockdep-debug.patch \
; do \
patch -p1 < "$patch"; \
done
COPY kernel_config /linux/arch/x86/configs/x86_64_defconfig
COPY kernel_config.debug /linux/debug_config
COPY kernel_config.aufs /linux/aufs_config
RUN cat /linux/aufs_config >> /linux/arch/x86/configs/x86_64_defconfig
ARG DEBUG=0
RUN if [ $DEBUG -ne "0" ]; then \
sed -i 's/CONFIG_PANIC_ON_OOPS=y/# CONFIG_PANIC_ON_OOPS is not set/' /linux/arch/x86/configs/x86_64_defconfig; \
cat /linux/debug_config >> /linux/arch/x86/configs/x86_64_defconfig; \
fi
# Apply local patches
COPY patches-aufs /patches
RUN cd /linux && \
set -e && for patch in /patches/*.patch; do \
echo "Applying $patch"; \
patch -p1 < "$patch"; \
done
WORKDIR /linux
RUN make defconfig && \
make oldconfig && \
make -j "$(getconf _NPROCESSORS_ONLN)" KCFLAGS="-fno-pie"
RUN make INSTALL_MOD_PATH=/tmp/kernel-modules modules_install && \
make INSTALL_HDR_PATH=/tmp headers_install && \
( cd /tmp && tar cf /kernel-headers.tar include ) && \
( cd /tmp/kernel-modules && tar cf /kernel-modules.tar . )
# Build aufs tools, do this here as they need kernel headers and to match aufs
# Fortunately they are built statically linked
RUN cd /aufs-util && \
CPPFLAGS="-I/tmp/include" CFLAGS=$CPPFLAGS LDFLAGS=$CPPFLAGS make && \
DESTDIR=/tmp/aufs-utils make install && \
rm -rf /tmp/aufs-utils/usr/lib /tmp/aufs-utils/usr/share && \
cd /tmp/aufs-utils && rm libau* && tar cf /aufs-utils.tar .
RUN printf "KERNEL_SOURCE=${KERNEL_SOURCE}\nAUFS_REPO=${AUFS_REPO}\nAUFS_BRANCH=${AUFS_BRANCH}\nAUFS_COMMIT=${AUFS_COMMIT}\nAUFS_TOOLS_REPO=${AUFS_TOOLS_REPO}\nAUFS_TOOLS_COMMIT=${AUFS_TOOLS_COMMIT}\n" > /kernel-source-info