Merge pull request #502 from justincormack/kernel-make

Clean up kernel Makefile
This commit is contained in:
Justin Cormack 2016-09-13 22:18:39 +01:00 committed by GitHub
commit 0e2b57f108
2 changed files with 22 additions and 25 deletions

View File

@ -1,7 +1,6 @@
FROM mobylinux/debian-build-kernel:a009a11bf0ad FROM mobylinux/debian-build-kernel:a009a11bf0ad
ARG KERNEL_VERSION=4.4.20 ARG KERNEL_VERSION=4.4.20
ARG DEBUG=0
ENV KERNEL_SOURCE=https://www.kernel.org/pub/linux/kernel/v4.x/linux-${KERNEL_VERSION}.tar.xz ENV KERNEL_SOURCE=https://www.kernel.org/pub/linux/kernel/v4.x/linux-${KERNEL_VERSION}.tar.xz
@ -19,6 +18,16 @@ RUN git clone -b "$AUFS_BRANCH" "$AUFS_REPO" /aufs && \
cd /aufs && \ cd /aufs && \
git checkout -q "$AUFS_COMMIT" git checkout -q "$AUFS_COMMIT"
# aufs-util 20151116
ENV AUFS_TOOLS_REPO https://github.com/Distrotech/aufs-util.git
ENV AUFS_TOOLS_COMMIT b5e7e204036da5e815ddec15a847a03c232771b4
# Download aufs tools
RUN git clone ${AUFS_TOOLS_REPO} && \
cd /aufs-util && \
git checkout "$AUFS_TOOLS_COMMIT"
#BUILD
# patch kernel with aufs # patch kernel with aufs
RUN cd /linux && \ RUN cd /linux && \
cp -r /aufs/Documentation /linux && \ cp -r /aufs/Documentation /linux && \
@ -38,6 +47,8 @@ RUN cd /linux && \
COPY kernel_config /linux/arch/x86/configs/x86_64_defconfig COPY kernel_config /linux/arch/x86/configs/x86_64_defconfig
COPY kernel_config.debug /linux/debug_config COPY kernel_config.debug /linux/debug_config
ARG DEBUG=0
RUN if [ $DEBUG -ne "0" ]; then \ RUN if [ $DEBUG -ne "0" ]; then \
cat /linux/debug_config >> /linux/arch/x86/configs/x86_64_defconfig; \ cat /linux/debug_config >> /linux/arch/x86/configs/x86_64_defconfig; \
fi fi
@ -61,14 +72,7 @@ RUN jobs=$(nproc); \
# Build aufs tools, do this here as they need kernel headers and to match aufs # Build aufs tools, do this here as they need kernel headers and to match aufs
# Fortunately they are built statically linked # Fortunately they are built statically linked
RUN cd /aufs-util && \
# aufs-util 20151116
ENV AUFS_TOOLS_REPO https://github.com/Distrotech/aufs-util.git
ENV AUFS_TOOLS_COMMIT b5e7e204036da5e815ddec15a847a03c232771b4
RUN git clone ${AUFS_TOOLS_REPO} && \
cd /aufs-util && \
git checkout "$AUFS_TOOLS_COMMIT" && \
CPPFLAGS="-I/tmp/kernel-headers/include" CFLAGS=$CPPFLAGS LDFLAGS=$CPPFLAGS make && \ CPPFLAGS="-I/tmp/kernel-headers/include" CFLAGS=$CPPFLAGS LDFLAGS=$CPPFLAGS make && \
DESTDIR=/tmp/aufs-utils make install && \ DESTDIR=/tmp/aufs-utils make install && \
rm -rf /tmp/aufs-utils/usr/lib /tmp/aufs-utils/usr/share && \ rm -rf /tmp/aufs-utils/usr/lib /tmp/aufs-utils/usr/share && \

View File

@ -1,24 +1,17 @@
ARCH = x86_64
DEBUG ?= 0 DEBUG ?= 0
all: $(ARCH)/vmlinuz64 all: x86_64/vmlinuz64
$(ARCH)/mobykernel-build: Dockerfile kernel_config x86_64/vmlinuz64: Dockerfile kernel_config
mkdir -p $(ARCH) && \ mkdir -p $(ARCH) etc
docker build --build-arg DEBUG=$(DEBUG) -t mobykernel:build . docker build --build-arg DEBUG=$(DEBUG) -t mobykernel:build .
touch $@
$(ARCH)/bzImage: $(ARCH)/mobykernel-build
docker run --rm mobykernel:build cat /linux/arch/$(ARCH)/boot/$(notdir $@) > $@ || ! rm $@
docker run --rm --net=none mobykernel:build cat /kernel-modules.tar | tar xf - docker run --rm --net=none mobykernel:build cat /kernel-modules.tar | tar xf -
docker run --rm mobykernel:build cat /aufs-utils.tar | tar xf - docker run --rm --net=none mobykernel:build cat /aufs-utils.tar | tar xf -
docker run --rm mobykernel:build cat /kernel-source-info > etc/kernel-source-info docker run --rm --net=none mobykernel:build cat /kernel-source-info > etc/kernel-source-info
mkdir -p etc docker run --rm --net=none mobykernel:build cat /linux/arch/x86_64/boot/bzImage > $@
cp -a patches etc/kernel-patches cp -a patches etc/kernel-patches
$(ARCH)/vmlinuz64: $(ARCH)/bzImage
cp $< $@
clean: clean:
rm -rf $(ARCH) lib etc usr sbin rm -rf x86_64 lib etc usr sbin
docker images -q mobykernel:build | xargs docker rmi -f || true
.DELETE_ON_ERROR: