From 8d45a96f34da115c25b33a18f25d1b2dbc35f98e Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Thu, 31 Aug 2017 17:09:49 +0100 Subject: [PATCH] kernel: Add zfs kmod build to the kernel build This adds building the zfs-kmod package to the kernel build. The zfs-kmod packages contains the matching ZFS kernel modules for a given kernel in /lib/modules/$(uname -r)/extra. The zfs-kmod package also contains the standard kernel modules and depmod is run over them so that modprobe works The zfs-kmod package is not build by default due to unclarity about licenses. Users will have to build it themselves. Signed-off-by: Rolf Neugebauer --- kernel/Makefile | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/kernel/Makefile b/kernel/Makefile index 25ca0fcdf..0da485528 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -16,6 +16,7 @@ ORG?=linuxkit IMAGE:=kernel IMAGE_PERF:=kernel-perf +IMAGE_ZFS:=zfs-kmod # You can specify an extra options for the Makefile. This will: # - append a kernel_config$(EXTRA) to the kernel config for your kernel/arch @@ -118,11 +119,13 @@ push: push_$(2)$(3) show-tags: show-tag_$(2)$(3) fetch: sources/linux-$(1).tar.xz -ifneq ($(2), 4.4.x) # 'docker build' with the FROM image supplied as --build-arg # *and* with DOCKER_CONTENT_TRUST=1 currently does not work # (https://github.com/moby/moby/issues/34199). So, we pull the image # with DCT and then build with DOCKER_CONTENT_TRUST explicitly set to 0. + +ifneq ($(2), 4.4.x) +# perf does not build out of the box for 4.4.x and 4.4.x is not that relevant anymore to work on a fix build_perf_$(2)$(3): build_$(2)$(3) docker pull $(ORG)/$(IMAGE_PERF):$(1)$(3)-$(TAG)$(SUFFIX) || \ (docker pull $(ORG)/$(IMAGE):$(1)$(3)-$(TAG)$(SUFFIX) && \ @@ -143,6 +146,26 @@ build: build_perf_$(2)$(3) push: push_perf_$(2)$(3) endif +ifneq ($(3), -dbg) +# ZFS does not compile against -dbg kernels because CONFIG_DEBUG_LOCK_ALLOC +# is incompatible with CDDL, apparently (this is ./configure check) +build_zfs_$(2)$(3): build_$(2)$(3) + docker pull $(ORG)/$(IMAGE_ZFS):$(1)$(3)-$(TAG)$(SUFFIX) || \ + (docker pull $(ORG)/$(IMAGE):$(1)$(3)-$(TAG)$(SUFFIX) && \ + DOCKER_CONTENT_TRUST=0 docker build -f Dockerfile.zfs \ + --build-arg IMAGE=$(ORG)/$(IMAGE):$(1)$(3)-$(TAG)$(SUFFIX) \ + --no-cache $(LABEL) -t $(ORG)/$(IMAGE_ZFS):$(1)$(3)-$(TAG)$(SUFFIX) .) + +push_zfs_$(2)$(3): build_zfs_$(2)$(3) + @if [ x"$(DIRTY)" != x ]; then echo "Your repository is not clean. Will not push image"; exit 1; fi + docker pull $(ORG)/$(IMAGE_ZFS):$(1)$(3)-$(TAG)$(SUFFIX) || \ + (docker push $(ORG)/$(IMAGE_ZFS):$(1)$(3)-$(TAG)$(SUFFIX) && \ + docker tag $(ORG)/$(IMAGE_ZFS):$(1)$(3)-$(TAG)$(SUFFIX) $(ORG)/$(IMAGE_ZFS):$(1)$(3)$(SUFFIX) && \ + docker push $(ORG)/$(IMAGE_ZFS):$(1)$(3)$(SUFFIX) && \ + $(PUSH_MANIFEST) $(ORG)/$(IMAGE_ZFS):$(1)$(3)-$(TAG) $(DOCKER_CONTENT_TRUST) && \ + $(PUSH_MANIFEST) $(ORG)/$(IMAGE_ZFS):$(1)$(3) $(DOCKER_CONTENT_TRUST)) +endif + endef #