diff --git a/kernel/Dockerfile.4.4 b/kernel/Dockerfile.4.4 index 82eb095b6..be702ba7f 100644 --- a/kernel/Dockerfile.4.4 +++ b/kernel/Dockerfile.4.4 @@ -1,7 +1,6 @@ FROM mobylinux/alpine-build-kernel:0e893fbf6fa7638d2f23354de03ea11017bb8065@sha256:3ef3f9d11f0802b759dbd9c43a7706cf0ec37263c99ae90e2b10c29ea85739fa -ARG KERNEL_VERSION -ARG DEBUG=0 +ARG KERNEL_VERSION=4.4.53 ENV KERNEL_SOURCE=https://www.kernel.org/pub/linux/kernel/v4.x/linux-${KERNEL_VERSION}.tar.xz @@ -14,6 +13,8 @@ COPY kernel_config.debug /linux/debug_config COPY kernel_config.4.4 /linux/kernel_config.4.4 RUN cat /linux/kernel_config.4.4 >> /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; \ diff --git a/kernel/Dockerfile.aufs b/kernel/Dockerfile.aufs deleted file mode 100644 index bee56e4bc..000000000 --- a/kernel/Dockerfile.aufs +++ /dev/null @@ -1,99 +0,0 @@ -FROM mobylinux/alpine-build-kernel:0e893fbf6fa7638d2f23354de03ea11017bb8065@sha256:3ef3f9d11f0802b759dbd9c43a7706cf0ec37263c99ae90e2b10c29ea85739fa - -ARG KERNEL_VERSION -ARG DEBUG=0 - -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.9 20170220 -ENV AUFS_REPO https://github.com/sfjro/aufs4-standalone -ENV AUFS_BRANCH aufs4.9 -ENV AUFS_COMMIT 97ef00a26bd2e098fb91d87852cc926e517ec8f7 - -# 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 - -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-4.9/* /patches/ -RUN cd /linux && \ - set -e && for patch in /patches/*.patch; do \ - echo "Applying $patch"; \ - patch -p1 < "$patch"; \ - done - -RUN cd /linux && \ - make defconfig && \ - make oldconfig && \ - make -j "$(getconf _NPROCESSORS_ONLN)" KCFLAGS="-fno-pie" -RUN cd /linux && \ - make INSTALL_MOD_PATH=/tmp/kernel-modules modules_install && \ - ( DVER=$(basename $(find /tmp/kernel-modules/lib/modules/ -mindepth 1 -maxdepth 1)) && \ - cd /tmp/kernel-modules/lib/modules/$DVER && \ - rm build source && \ - ln -s /usr/src/linux-headers-$DVER build ) && \ - mkdir -p /tmp/kernel-headers/usr && \ - make INSTALL_HDR_PATH=/tmp/kernel-headers/usr headers_install && \ - ( cd /tmp/kernel-headers && tar cf /kernel-headers.tar usr ) && \ - ( cd /tmp/kernel-modules && tar cf /kernel-modules.tar lib ) && \ - cp vmlinux arch/x86_64/boot/bzImage / - -RUN DVER=$(basename $(find /tmp/kernel-modules/lib/modules/ -mindepth 1 -maxdepth 1)) && \ - dir=/tmp/usr/src/linux-headers-$DVER && \ - mkdir -p $dir && \ - cp /linux/.config $dir && \ - cd /linux && \ - cp -a include "$dir" && \ - mkdir -p "$dir"/arch/x86 && cp -a arch/x86/include "$dir"/arch/x86/ && \ - ( cd /tmp && tar cf /kernel-dev.tar usr/src ) - -# 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 diff --git a/kernel/Makefile b/kernel/Makefile index d3c8cb2bb..97d401588 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -2,10 +2,6 @@ DEBUG ?= 0 all: bzImage push -ifdef AUFS -KERNEL_VERSION=4.9.14 -DEPS=Dockerfile.aufs Makefile kernel_config kernel_config.debug kernel_config.aufs patches-4.9 -else ifdef LTS4.4 KERNEL_VERSION=4.4.53 DEPS=Dockerfile.4.4 Makefile kernel_config kernel_config.debug kernel_config.4.4 patches-4.4 @@ -13,7 +9,6 @@ else KERNEL_VERSION=4.9.14 DEPS=Dockerfile Makefile kernel_config kernel_config.debug patches-4.9 endif -endif kernel.tag: $(DEPS) BUILD=$$( tar cf - $^ | docker build -f $< --build-arg DEBUG=$(DEBUG) --build-arg KERNEL_VERSION=$(KERNEL_VERSION) -q - ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && echo "$$BUILD" > $@