Merge pull request #3211 from rn/kern19

Add 4.19 kernels (and remove 4.18 for arm64 and s390x)
This commit is contained in:
Rolf Neugebauer 2018-10-29 18:46:16 +00:00 committed by GitHub
commit ddb0fa509e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 12466 additions and 9 deletions

View File

@ -175,9 +175,11 @@ RUN DVER=$(basename $(find /tmp/kernel-modules/lib/modules/ -mindepth 1 -maxdept
RUN printf "KERNEL_SOURCE=${KERNEL_SOURCE}\n" > /out/kernel-source-info
# perf
# Skip for 4.4.x (the compile is broken and tedious to fix) and 4.9.x (the
# compile broke with 4.9.93)
RUN if [ "${KERNEL_SERIES}" != "4.4.x" ] && [ "${KERNEL_SERIES}" != "4.9.x" ]; then \
# Only build perf for the latest LTS and the latest stable kernel.
# There were intermittent breakage for 4.4.x and 4.9.x on some arches
# Skip arm64 for now as perf for 4.19 fails to build.
RUN if [ \( "${KERNEL_SERIES}" == "4.14.x" || "${KERNEL_SERIES}" == "4.19.x" \) \
&& $(uname -m) != aarch64 ]; then \
mkdir -p /build/perf && \
make -C tools/perf LDFLAGS=-static O=/build/perf && \
strip /build/perf/perf && \

View File

@ -157,8 +157,10 @@ fetch: sources/linux-$(1).tar.xz
# with DCT as part of the dependency on build_$(2)$(3)$(4) and then build
# with DOCKER_CONTENT_TRUST explicitly set to 0
ifneq ($(2), $(filter $(2),4.4.x 4.9.x))
# perf does not build out of the box for 4.4.x and 4.9.x
ifeq ($(2), $(filter $(2),4.14.x 4.19.x))
# Only build perf for the latest LTS and the latest stable kernel.
ifneq ($(ARCH),aarch64)
# Skip arm64 for now as perf for 4.19 fails to build.
build_perf_$(2)$(3)$(4): build_$(2)$(3)$(4)
docker pull $(ORG)/$(IMAGE_PERF):$(1)$(3)$(4)-$(TAG)$(SUFFIX) || \
DOCKER_CONTENT_TRUST=0 docker build -f Dockerfile.perf \
@ -192,11 +194,12 @@ forcebuild: forcebuild_perf_$(2)$(3)$(4)
push: push_perf_$(2)$(3)$(4)
forcepush: forcepush_perf_$(2)$(3)$(4)
endif
endif
# For BCC, only build on x86 and only on latest LTS and latest stable.
# That's 4.14.x and 4.18.x at time of authorship.
# That's 4.14.x and 4.19.x at time of authorship.
ifeq ($(ARCH),x86_64)
ifeq ($(2), $(filter $(2),4.14.x 4.18.x))
ifeq ($(2), $(filter $(2),4.14.x 4.19.x))
build_bcc_$(2)$(3)$(4): build_$(2)$(3)$(4)
docker pull $(ORG)/$(IMAGE_BCC):$(1)$(3)$(4)-$(TAG)$(SUFFIX) || \
DOCKER_CONTENT_TRUST=0 docker build -f Dockerfile.bcc \
@ -259,6 +262,7 @@ endef
# Debug targets only for latest stable and LTS stable
#
ifeq ($(ARCH),x86_64)
$(eval $(call kernel,4.19,4.19.x,$(EXTRA),$(DEBUG)))
$(eval $(call kernel,4.18.16,4.18.x,$(EXTRA),$(DEBUG)))
$(eval $(call kernel,4.14.78,4.14.x,$(EXTRA),$(DEBUG)))
$(eval $(call kernel,4.14.78,4.14.x,,-dbg))
@ -267,12 +271,12 @@ $(eval $(call kernel,4.9.135,4.9.x,$(EXTRA),$(DEBUG)))
$(eval $(call kernel,4.4.162,4.4.x,$(EXTRA),$(DEBUG)))
else ifeq ($(ARCH),aarch64)
$(eval $(call kernel,4.18.16,4.18.x,$(EXTRA),$(DEBUG)))
$(eval $(call kernel,4.19,4.19.x,$(EXTRA),$(DEBUG)))
$(eval $(call kernel,4.14.78,4.14.x,$(EXTRA),$(DEBUG)))
$(eval $(call kernel,4.14.71,4.14.x,-rt,))
else ifeq ($(ARCH),s390x)
$(eval $(call kernel,4.18.16,4.18.x,$(EXTRA),$(DEBUG)))
$(eval $(call kernel,4.19,4.19.x,$(EXTRA),$(DEBUG)))
$(eval $(call kernel,4.14.78,4.14.x,$(EXTRA),$(DEBUG)))
endif

4518
kernel/config-4.19.x-aarch64 Normal file

File diff suppressed because it is too large Load Diff

3446
kernel/config-4.19.x-s390x Normal file

File diff suppressed because it is too large Load Diff

4331
kernel/config-4.19.x-x86_64 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
#!/bin/sh
# SUMMARY: Sanity check on the kernel config file
# LABELS:
# REPEAT:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=kconfig
clean_up() {
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
linuxkit build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run ${NAME})"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@ -0,0 +1,15 @@
kernel:
image: linuxkit/kernel:4.19
cmdline: "console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:6eb0158059b056a1567236280880cb87f03ff008
- linuxkit/runc:6cf26a0403376de3b5396cb676b88eea4f37aff8
onboot:
- name: check-kernel-config
image: linuxkit/test-kernel-config:1aaef970b5f70791d74d6f980ad38af4035948f8
- name: poweroff
image: linuxkit/poweroff:afe8f7dd0d47a7991c54519b0f09124cb8c4e300
command: ["/bin/sh", "/poweroff.sh", "3"]
trust:
org:
- linuxkit

View File

@ -0,0 +1,23 @@
# This Dockerfile extracts the kernel headers from the kernel image
# and then compiles a simple hello world kernel module against them.
# In the last stage, it creates a package, which can be used for
# testing.
FROM linuxkit/kernel:4.19 AS ksrc
# Extract headers and compile module
FROM linuxkit/alpine:3683c9a66cd4da40bd7d6c7da599b2dcd738b559 AS build
RUN apk add build-base libelf-dev
COPY --from=ksrc /kernel-dev.tar /
RUN tar xf kernel-dev.tar
WORKDIR /kmod
COPY ./src/* ./
RUN make all
# Package
FROM alpine:3.8
COPY --from=build /kmod/hello_world.ko /
COPY check.sh /check.sh
ENTRYPOINT ["/bin/sh", "/check.sh"]

View File

@ -0,0 +1,15 @@
#!/bin/sh
function failed {
printf "Kernel module test suite FAILED\n"
/sbin/poweroff -f
}
uname -a
modinfo hello_world.ko || failed
insmod hello_world.ko || failed
[ -n "$(dmesg | grep -o 'Hello LinuxKit')" ] || failed
rmmod hello_world || failed
printf "Kernel module test suite PASSED\n"
/sbin/poweroff -f

View File

@ -0,0 +1,6 @@
obj-m += hello_world.o
KVER=$(shell basename /usr/src/linux-headers-*)
all:
make -C /usr/src/$(KVER) M=$(PWD) modules
clean:
make -C /usr/src/$(KVER) M=$(PWD) clean

View File

@ -0,0 +1,22 @@
/*
* A simple Hello World kernel module
*/
#include <linux/module.h>
#include <linux/kernel.h>
int init_hello(void)
{
printk(KERN_INFO "Hello LinuxKit\n");
return 0;
}
void exit_hello(void)
{
printk(KERN_INFO "Goodbye LinuxKit.\n");
}
module_init(init_hello);
module_exit(exit_hello);
MODULE_AUTHOR("Rolf Neugebauer <rolf.neugebauer@docker.com>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("A simple Hello World kernel module for testing");

View File

@ -0,0 +1,31 @@
#!/bin/sh
# SUMMARY: Test build and insertion of kernel modules
# LABELS:
# REPEAT:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=kmod
IMAGE_NAME=kmod-test
clean_up() {
docker rmi ${IMAGE_NAME} || true
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Make sure we have the latest kernel image
docker pull linuxkit/kernel:4.19
# Build a package
docker build -t ${IMAGE_NAME} .
# Build and run a LinuxKit image with kernel module (and test script)
linuxkit build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run ${NAME})"
echo "${RESULT}" | grep -q "Hello LinuxKit"
exit 0

View File

@ -0,0 +1,20 @@
kernel:
image: linuxkit/kernel:4.19
cmdline: "console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:6eb0158059b056a1567236280880cb87f03ff008
- linuxkit/runc:6cf26a0403376de3b5396cb676b88eea4f37aff8
onboot:
- name: check
image: kmod-test
binds:
- /dev:/dev
- /lib/modules:/lib/modules
capabilities:
- all
- name: poweroff
image: linuxkit/poweroff:afe8f7dd0d47a7991c54519b0f09124cb8c4e300
command: ["/bin/sh", "/poweroff.sh", "3"]
trust:
org:
- linuxkit