mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
kernel: Use local kernel source if available
The kernel build currently downloads the source tar ball every time, which is a little tedious when experimenting with kernel configs or when compiling the kernel multiple times. This commit adds a new 'fetch' make target which downloads the kernel sources into ./sources. Then in the Dockerfile we add the directory and only download the source if it is not present. The tarballs signature is till checked on each build. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
9362de0adb
commit
ffcf5db6ee
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@ Dockerfile.media
|
|||||||
*.vmdk
|
*.vmdk
|
||||||
*.vmdk.lck
|
*.vmdk.lck
|
||||||
*.tar
|
*.tar
|
||||||
|
*.tar.xz
|
||||||
*.gz
|
*.gz
|
||||||
*.vhdx
|
*.vhdx
|
||||||
*.efi
|
*.efi
|
||||||
|
@ -46,11 +46,12 @@ ENV WIREGUARD_URL=https://git.zx2c4.com/WireGuard/snapshot/WireGuard-${WIREGUARD
|
|||||||
COPY keys.asc keys.asc
|
COPY keys.asc keys.asc
|
||||||
|
|
||||||
# Download and verify kernel
|
# Download and verify kernel
|
||||||
|
COPY sources/ /
|
||||||
RUN curl -fsSLO ${KERNEL_SHA256_SUMS} && \
|
RUN curl -fsSLO ${KERNEL_SHA256_SUMS} && \
|
||||||
gpg2 -q --import keys.asc && \
|
gpg2 -q --import keys.asc && \
|
||||||
gpg2 --verify sha256sums.asc && \
|
gpg2 --verify sha256sums.asc && \
|
||||||
KERNEL_SHA256=$(grep linux-${KERNEL_VERSION}.tar.xz sha256sums.asc | cut -d ' ' -f 1) && \
|
KERNEL_SHA256=$(grep linux-${KERNEL_VERSION}.tar.xz sha256sums.asc | cut -d ' ' -f 1) && \
|
||||||
curl -fsSLO ${KERNEL_SOURCE} && \
|
[ -f linux-${KERNEL_VERSION}.tar.xz ] || curl -fsSLO ${KERNEL_SOURCE} && \
|
||||||
echo "${KERNEL_SHA256} linux-${KERNEL_VERSION}.tar.xz" | sha256sum -c - && \
|
echo "${KERNEL_SHA256} linux-${KERNEL_VERSION}.tar.xz" | sha256sum -c - && \
|
||||||
xz -d linux-${KERNEL_VERSION}.tar.xz && \
|
xz -d linux-${KERNEL_VERSION}.tar.xz && \
|
||||||
curl -fsSLO ${KERNEL_PGP2_SIGN} && \
|
curl -fsSLO ${KERNEL_PGP2_SIGN} && \
|
||||||
|
@ -51,11 +51,16 @@ LABELS=$(REPO_LABEL) $(COMMIT_LABEL)
|
|||||||
|
|
||||||
.PHONY: check tag push
|
.PHONY: check tag push
|
||||||
# Targets:
|
# Targets:
|
||||||
# build: builds all kernels
|
# fetch: Downloads the kernel sources into ./sources
|
||||||
# push: pushes and sign all tagged kernel images to hub
|
# build: Builds all kernels
|
||||||
|
# push: Pushes and sign all tagged kernel images to hub
|
||||||
|
fetch:
|
||||||
build:
|
build:
|
||||||
push:
|
push:
|
||||||
|
|
||||||
|
sources:
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
# A template for defining kernel build
|
# A template for defining kernel build
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# $1: Full kernel version, e.g., 4.9.22
|
# $1: Full kernel version, e.g., 4.9.22
|
||||||
@ -68,7 +73,12 @@ push:
|
|||||||
# build_4.9.x_dbg and adds "_dbg" to the hub image name.
|
# build_4.9.x_dbg and adds "_dbg" to the hub image name.
|
||||||
define kernel
|
define kernel
|
||||||
|
|
||||||
build_$(2)$(3): Dockerfile Makefile $(wildcard patches-$(2)/*) $(wildcard kernel_config-$(2)*) kernel_config.debug
|
ifeq ($(3),)
|
||||||
|
sources/linux-$(1).tar.xz: Makefile | sources
|
||||||
|
curl -fsSLo sources/linux-$(1).tar.xz https://www.kernel.org/pub/linux/kernel/v4.x/linux-$(1).tar.xz
|
||||||
|
endif
|
||||||
|
|
||||||
|
build_$(2)$(3): Dockerfile Makefile $(wildcard patches-$(2)/*) $(wildcard kernel_config-$(2)*) kernel_config.debug | sources
|
||||||
docker pull $(ORG)/$(IMAGE):$(1)$(3)-$(TAG)$(SUFFIX) || \
|
docker pull $(ORG)/$(IMAGE):$(1)$(3)-$(TAG)$(SUFFIX) || \
|
||||||
docker build \
|
docker build \
|
||||||
--build-arg KERNEL_VERSION=$(1) \
|
--build-arg KERNEL_VERSION=$(1) \
|
||||||
@ -92,6 +102,7 @@ show-tag_$(2)$(3):
|
|||||||
build: build_$(2)$(3)
|
build: build_$(2)$(3)
|
||||||
push: push_$(2)$(3)
|
push: push_$(2)$(3)
|
||||||
show-tags: show-tag_$(2)$(3)
|
show-tags: show-tag_$(2)$(3)
|
||||||
|
fetch: sources/linux-$(1).tar.xz
|
||||||
|
|
||||||
ifneq ($(2), 4.4.x)
|
ifneq ($(2), 4.4.x)
|
||||||
build_perf_$(2)$(3): build_$(2)$(3)
|
build_perf_$(2)$(3): build_$(2)$(3)
|
||||||
|
Loading…
Reference in New Issue
Block a user