diff --git a/kernel/.gitignore b/kernel/.gitignore index 5ef1dc73e..69529a9eb 100644 --- a/kernel/.gitignore +++ b/kernel/.gitignore @@ -1 +1,2 @@ vmlinuz64 +aufs-utils.tar diff --git a/kernel/Dockerfile b/kernel/Dockerfile index 6d60326d2..1cf0f03cc 100644 --- a/kernel/Dockerfile +++ b/kernel/Dockerfile @@ -1,6 +1,6 @@ FROM debian:jessie -ENV KERNEL_VERSION 4.1.13 +ENV KERNEL_VERSION 4.1.12 RUN apt-get update && apt-get -y upgrade && apt-get -y install \ unzip \ @@ -18,15 +18,56 @@ RUN apt-get update && apt-get -y upgrade && apt-get -y install \ isolinux \ automake \ pkg-config \ + git \ + ncurses-dev \ p7zip-full ADD https://www.kernel.org/pub/linux/kernel/v4.x/linux-${KERNEL_VERSION}.tar.xz . RUN cat linux-${KERNEL_VERSION}.tar.xz | tar --absolute-names -xJ && mv /linux-${KERNEL_VERSION} /linux +# http://aufs.sourceforge.net/ +ENV AUFS_REPO https://github.com/sfjro/aufs4-standalone +ENV AUFS_BRANCH aufs4.1 +ENV AUFS_COMMIT 4912d6da07e3e24d7a8484e0e8a4c1315adbc8fd +# we use AUFS_COMMIT to get stronger repeatability guarantees + +# Download AUFS and patch kernel +RUN git clone -b "$AUFS_BRANCH" "$AUFS_REPO" /aufs && \ + cd /aufs && \ + git checkout -q "$AUFS_COMMIT" && \ + 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 \ + ; do \ + patch -p1 < "$patch"; \ + done + COPY kernel_config /linux/.config RUN jobs=$(nproc); \ cd /linux && \ make -j ${jobs} oldconfig && \ - make -j ${jobs} bzImage + make -j ${jobs} bzImage && \ + make INSTALL_HDR_PATH=/tmp/kernel-headers headers_install + +# Build aufs tools, do this here as they need kernel headers and to match aufs +# Fortunately they are build statically linked + +ENV AUFS_TOOLS_COMMIT 5e0c348bd8b1898beb1e043b026bcb0e0c7b0d54 + +RUN git clone https://github.com/Distrotech/aufs-util.git && \ + cd /aufs-util && \ + git checkout "$AUFS_TOOLS_COMMIT" && \ + CPPFLAGS="-I/tmp/kernel-headers/include" CLFAGS=$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 && tar cf /aufs-utils.tar . + diff --git a/kernel/Makefile b/kernel/Makefile index 2bbe42c56..60451bd31 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,8 +1,13 @@ -all: vmlinuz64 +all: vmlinuz64 aufs-utils.tar -vmlinuz64: kernel_config - docker build -t mobykernel:test . - docker run mobykernel:test cat /linux/arch/x86_64/boot/bzImage > vmlinuz64 +kernel: kernel_config Dockerfile + docker build -t mobykernel:build . + +vmlinuz64: kernel + docker run mobykernel:build cat /linux/arch/x86_64/boot/bzImage > vmlinuz64 + +aufs-utils.tar: kernel + docker run mobykernel:build cat /aufs-utils.tar > aufs-utils.tar clean: - rm -f vmlinuz64 + rm -f vmlinuz64 aufs-utils.tar diff --git a/kernel/kernel_config b/kernel/kernel_config index d379df912..5d31af889 100644 --- a/kernel/kernel_config +++ b/kernel/kernel_config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86 4.1.13 Kernel Configuration +# Linux/x86 4.1.12 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -223,7 +223,6 @@ CONFIG_VM_EVENT_COUNTERS=y # CONFIG_COMPAT_BRK is not set CONFIG_SLAB=y # CONFIG_SLUB is not set -# CONFIG_SLOB is not set # CONFIG_SYSTEM_TRUSTED_KEYRING is not set CONFIG_PROFILING=y CONFIG_TRACEPOINTS=y @@ -2563,6 +2562,23 @@ CONFIG_PSTORE=y # CONFIG_PSTORE_RAM is not set # CONFIG_SYSV_FS is not set # CONFIG_UFS_FS is not set +CONFIG_AUFS_FS=y +# CONFIG_AUFS_BRANCH_MAX_127 is not set +# CONFIG_AUFS_BRANCH_MAX_511 is not set +# CONFIG_AUFS_BRANCH_MAX_1023 is not set +CONFIG_AUFS_BRANCH_MAX_32767=y +CONFIG_AUFS_SBILIST=y +# CONFIG_AUFS_HNOTIFY is not set +# CONFIG_AUFS_EXPORT is not set +CONFIG_AUFS_XATTR=y +# CONFIG_AUFS_FHSM is not set +# CONFIG_AUFS_RDU is not set +# CONFIG_AUFS_SHWH is not set +# CONFIG_AUFS_BR_RAMFS is not set +# CONFIG_AUFS_BR_FUSE is not set +# CONFIG_AUFS_BR_HFSPLUS is not set +CONFIG_AUFS_BDEV_LOOP=y +# CONFIG_AUFS_DEBUG is not set CONFIG_NETWORK_FILESYSTEMS=y CONFIG_NFS_FS=y CONFIG_NFS_V2=y