mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-25 19:54:38 +00:00
Merge pull request #502 from justincormack/kernel-make
Clean up kernel Makefile
This commit is contained in:
commit
0e2b57f108
@ -1,7 +1,6 @@
|
||||
FROM mobylinux/debian-build-kernel:a009a11bf0ad
|
||||
|
||||
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
|
||||
|
||||
@ -19,6 +18,16 @@ 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/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
|
||||
RUN cd /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.debug /linux/debug_config
|
||||
|
||||
ARG DEBUG=0
|
||||
|
||||
RUN if [ $DEBUG -ne "0" ]; then \
|
||||
cat /linux/debug_config >> /linux/arch/x86/configs/x86_64_defconfig; \
|
||||
fi
|
||||
@ -61,14 +72,7 @@ RUN jobs=$(nproc); \
|
||||
|
||||
# Build aufs tools, do this here as they need kernel headers and to match aufs
|
||||
# Fortunately they are built statically linked
|
||||
|
||||
# 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" && \
|
||||
RUN cd /aufs-util && \
|
||||
CPPFLAGS="-I/tmp/kernel-headers/include" CFLAGS=$CPPFLAGS LDFLAGS=$CPPFLAGS make && \
|
||||
DESTDIR=/tmp/aufs-utils make install && \
|
||||
rm -rf /tmp/aufs-utils/usr/lib /tmp/aufs-utils/usr/share && \
|
||||
|
@ -1,24 +1,17 @@
|
||||
ARCH = x86_64
|
||||
DEBUG ?= 0
|
||||
|
||||
all: $(ARCH)/vmlinuz64
|
||||
all: x86_64/vmlinuz64
|
||||
|
||||
$(ARCH)/mobykernel-build: Dockerfile kernel_config
|
||||
mkdir -p $(ARCH) && \
|
||||
x86_64/vmlinuz64: Dockerfile kernel_config
|
||||
mkdir -p $(ARCH) etc
|
||||
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 mobykernel:build cat /aufs-utils.tar | tar xf -
|
||||
docker run --rm mobykernel:build cat /kernel-source-info > etc/kernel-source-info
|
||||
mkdir -p etc
|
||||
docker run --rm --net=none mobykernel:build cat /aufs-utils.tar | tar xf -
|
||||
docker run --rm --net=none mobykernel:build cat /kernel-source-info > etc/kernel-source-info
|
||||
docker run --rm --net=none mobykernel:build cat /linux/arch/x86_64/boot/bzImage > $@
|
||||
cp -a patches etc/kernel-patches
|
||||
|
||||
$(ARCH)/vmlinuz64: $(ARCH)/bzImage
|
||||
cp $< $@
|
||||
|
||||
clean:
|
||||
rm -rf $(ARCH) lib etc usr sbin
|
||||
docker images -q mobykernel:build | xargs docker rmi -f || true
|
||||
rm -rf x86_64 lib etc usr sbin
|
||||
|
||||
.DELETE_ON_ERROR:
|
||||
|
Loading…
Reference in New Issue
Block a user