Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel updates #3919

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

errordeveloper
Copy link
Contributor

No description provided.

@deitch
Copy link
Collaborator

deitch commented Apr 14, 2023

LGTM but @rn is the one who understands this part much better.

@thebsdbox
Copy link
Contributor

Ah nice, new kernels!

@rn
Copy link
Member

rn commented Apr 15, 2023

Thanks for updating. Looks good to me. Should probably remove 5.11 since it has been EOLed.

Also there are kernel config tests which need updating.

I'm not sure if the CI is building kernels these days but if not someone would need to build and push them before tests can be updates (well before updated tests would pass)

@errordeveloper
Copy link
Contributor Author

errordeveloper commented Apr 17, 2023

@rn thanks for the review!

Should probably remove 5.11 since it has been EOLed.

I dropped it.

Also there are kernel config tests which need updating.

I've not touched that stuff before. I had a quick look at test/pkg/kernel-config, but cannot see any obvious references to kernel versions.

I've updated all trivial refs to linuxkit/kernel images in test/cases, is there anything else?

@djs55
Copy link
Contributor

djs55 commented Apr 17, 2023

@errordeveloper (I‘m not an expert but) I think that’s correct: we have version numbers in individual test config files

@djs55
Copy link
Contributor

djs55 commented Apr 17, 2023

I tried to build and push the 5.4 on amd64 with:

$ make push_5.4.x
docker pull linuxkit/kernel:5.4.240-6e6863f25635960e76820a8ad9afe2152d20ad82-amd64 || docker build --build-arg KERNEL_VERSION=5.4.240 --build-arg KERNEL_SERIES=5.4.x --build-arg EXTRA= --build-arg DEBUG= --build-arg BUILD_IMAGE=linuxkit/alpine:2be490394653b7967c250e86fd42cef88de428ba --label org.opencontainers.image.source=https://github.com/linuxkit/linuxkit --label org.opencontainers.image.revision=9274df232e3c39b9dff32c06b6efc4c0047dc9e8 --label org.mobyproject.linuxkit.kernel.buildimage=linuxkit/alpine:2be490394653b7967c250e86fd42cef88de428ba --no-cache -t linuxkit/kernel:5.4.240-6e6863f25635960e76820a8ad9afe2152d20ad82-amd64 .
Error response from daemon: manifest for linuxkit/kernel:5.4.240-6e6863f25635960e76820a8ad9afe2152d20ad82-amd64 not found: manifest unknown: manifest unknown
[+] Building 34.0s (14/22)                                                                                                                                                                                                                                                                               
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                0.0s
 => => transferring dockerfile: 6.44kB                                                                                                                                                                                                                                                              0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/linuxkit/alpine:2be490394653b7967c250e86fd42cef88de428ba                                                                                                                                                                                                 0.0s
 => CACHED [kernel-build  1/17] FROM docker.io/linuxkit/alpine:2be490394653b7967c250e86fd42cef88de428ba                                                                                                                                                                                             0.0s
 => [internal] load build context                                                                                                                                                                                                                                                                   0.0s
 => => transferring context: 661.55kB                                                                                                                                                                                                                                                               0.0s
 => [kernel-build  2/17] RUN apk add     argp-standalone     automake     bash     bc     binutils-dev     bison     build-base     curl     diffutils     flex     git     gmp-dev     gnupg     installkernel     kmod     elfutils-dev     libunwind-dev     linux-headers     mpc1-dev     mpf  3.1s
 => [kernel-build  3/17] COPY / /                                                                                                                                                                                                                                                                   0.0s
 => [kernel-build  4/17] RUN mkdir -p /out/src                                                                                                                                                                                                                                                      0.3s 
 => [kernel-build  5/17] RUN KERNEL_MAJOR=$(echo 5.4.240 | cut -d . -f 1) &&     KERNEL_MAJOR=v${KERNEL_MAJOR}.x &&     KERNEL_SOURCE=https://www.kernel.org/pub/linux/kernel/${KERNEL_MAJOR}/linux-5.4.240.tar.xz &&     KERNEL_SHA256_SUMS=https://www.kernel.org/pub/linux/kernel/${KERNEL_MAJ  27.4s 
 => [kernel-build  6/17] WORKDIR /tmp                                                                                                                                                                                                                                                               0.0s 
 => [kernel-build  7/17] RUN set -e &&     if [ $(uname -m) == x86_64 ]; then         git clone https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files ucode &&         cd ucode &&         git checkout microcode-20210608 &&         iucode_tool --normal-earlyfw --write-earlyfw=/  2.4s 
 => [kernel-build  8/17] WORKDIR /linux                                                                                                                                                                                                                                                             0.0s 
 => [kernel-build  9/17] RUN set -e &&     if [ -n "" ] && [ -d /patches-5.4.x ]; then  echo "Patching  kernel";  for patch in /patches-5.4.x/*.patch; do             echo "Applying $patch";             patch -t -F0 -N -u -p1 < "$patch";  done;     fi                                          0.3s 
 => ERROR [kernel-build 10/17] RUN set -e &&     if [ -d /patches-5.4.x ]; then         for patch in /patches-5.4.x/*.patch; do             echo "Applying $patch";             patch -t -F0 -N -u -p1 < "$patch";         done;     fi                                                             0.3s 
------                                                                                                                                                                                                                                                                                                   
 > [kernel-build 10/17] RUN set -e &&     if [ -d /patches-5.4.x ]; then         for patch in /patches-5.4.x/*.patch; do             echo "Applying $patch";             patch -t -F0 -N -u -p1 < "$patch";         done;     fi:                                                                        
#14 0.266 Applying /patches-5.4.x/0001-include-uapi-linux-swab-Fix-potentially-missing-__al.patch                                                                                                                                                                                                        
#14 0.267 patching file include/uapi/linux/swab.h
#14 0.267 Reversed (or previously applied) patch detected!  Skipping patch.
#14 0.267 1 out of 1 hunk ignored -- saving rejects to file include/uapi/linux/swab.h.rej
------
executor failed running [/bin/sh -c set -e &&     if [ -d /patches-${KERNEL_SERIES} ]; then         for patch in /patches-${KERNEL_SERIES}/*.patch; do             echo "Applying $patch";             patch -t -F0 -N -u -p1 < "$patch";         done;     fi]: exit code: 1
make: *** [Makefile:262: build_5.4.x] Error 1
  • a similar problem with 5.10. On 5.15 I see
$ make push_5.15.x
docker pull linuxkit/kernel:5.15.106-6e6863f25635960e76820a8ad9afe2152d20ad82-amd64 || docker build --build-arg KERNEL_VERSION=5.15.106 --build-arg KERNEL_SERIES=5.15.x --build-arg EXTRA= --build-arg DEBUG= --build-arg BUILD_IMAGE=linuxkit/alpine:2be490394653b7967c250e86fd42cef88de428ba --label org.opencontainers.image.source=https://github.com/linuxkit/linuxkit --label org.opencontainers.image.revision=9274df232e3c39b9dff32c06b6efc4c0047dc9e8 --label org.mobyproject.linuxkit.kernel.buildimage=linuxkit/alpine:2be490394653b7967c250e86fd42cef88de428ba --no-cache -t linuxkit/kernel:5.15.106-6e6863f25635960e76820a8ad9afe2152d20ad82-amd64 .
Error response from daemon: manifest for linuxkit/kernel:5.15.106-6e6863f25635960e76820a8ad9afe2152d20ad82-amd64 not found: manifest unknown: manifest unknown
[+] Building 514.7s (14/22)                                                                                                                                                                                                                                                                              
[+] Building 521.1s (16/22)                                                                                                                                                                                                                                                                              
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                0.0s
 => => transferring dockerfile: 38B                                                                                                                                                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/linuxkit/alpine:2be490394653b7967c250e86fd42cef88de428ba                                                                                                                                                                                                 0.0s
 => CACHED [kernel-build  1/17] FROM docker.io/linuxkit/alpine:2be490394653b7967c250e86fd42cef88de428ba                                                                                                                                                                                             0.0s
 => [internal] load build context                                                                                                                                                                                                                                                                   0.0s
 => => transferring context: 785B                                                                                                                                                                                                                                                                   0.0s
 => [kernel-build  2/17] RUN apk add     argp-standalone     automake     bash     bc     binutils-dev     bison     build-base     curl     diffutils     flex     git     gmp-dev     gnupg     installkernel     kmod     elfutils-dev     libunwind-dev     linux-headers     mpc1-dev     mpf  2.9s
 => [kernel-build  3/17] COPY / /                                                                                                                                                                                                                                                                   0.0s
 => [kernel-build  4/17] RUN mkdir -p /out/src                                                                                                                                                                                                                                                      0.3s 
 => [kernel-build  5/17] RUN KERNEL_MAJOR=$(echo 5.15.106 | cut -d . -f 1) &&     KERNEL_MAJOR=v${KERNEL_MAJOR}.x &&     KERNEL_SOURCE=https://www.kernel.org/pub/linux/kernel/${KERNEL_MAJOR}/linux-5.15.106.tar.xz &&     KERNEL_SHA256_SUMS=https://www.kernel.org/pub/linux/kernel/${KERNEL_M  29.5s 
 => [kernel-build  6/17] WORKDIR /tmp                                                                                                                                                                                                                                                               0.0s 
 => [kernel-build  7/17] RUN set -e &&     if [ $(uname -m) == x86_64 ]; then         git clone https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files ucode &&         cd ucode &&         git checkout microcode-20210608 &&         iucode_tool --normal-earlyfw --write-earlyfw=/  2.6s 
 => [kernel-build  8/17] WORKDIR /linux                                                                                                                                                                                                                                                             0.0s 
 => [kernel-build  9/17] RUN set -e &&     if [ -n "" ] && [ -d /patches-5.15.x ]; then  echo "Patching  kernel";  for patch in /patches-5.15.x/*.patch; do             echo "Applying $patch";             patch -t -F0 -N -u -p1 < "$patch";  done;     fi                                        0.4s 
 => [kernel-build 10/17] RUN set -e &&     if [ -d /patches-5.15.x ]; then         for patch in /patches-5.15.x/*.patch; do             echo "Applying $patch";             patch -t -F0 -N -u -p1 < "$patch";         done;     fi                                                                 0.3s 
 => [kernel-build 11/17] RUN tar cJf /out/src/linux.tar.xz /linux                                                                                                                                                                                                                                 479.5s 
 => ERROR [kernel-build 12/17] RUN case $(uname -m) in     x86_64)         KERNEL_DEF_CONF=/linux/arch/x86/configs/x86_64_defconfig;         ;;     aarch64)         KERNEL_DEF_CONF=/linux/arch/arm64/configs/defconfig;         ;;     esac  &&     cp /config-5.15.x-$(uname -m) ${KERNEL_DEF_C  5.5s 
------                                                                                                                                                                                                                                                                                                   
 > [kernel-build 12/17] RUN case $(uname -m) in     x86_64)         KERNEL_DEF_CONF=/linux/arch/x86/configs/x86_64_defconfig;         ;;     aarch64)         KERNEL_DEF_CONF=/linux/arch/arm64/configs/defconfig;         ;;     esac  &&     cp /config-5.15.x-$(uname -m) ${KERNEL_DEF_CONF};     if [ -n "" ] && [ -f "/config-5.15.x-$(uname -m)" ]; then         cat /config-5.15.x-$(uname -m) >> ${KERNEL_DEF_CONF};     fi;     sed -i "s/CONFIG_LOCALVERSION="-linuxkit"/CONFIG_LOCALVERSION="-linuxkit"/" ${KERNEL_DEF_CONF};     if [ -n "" ]; then         sed -i 's/CONFIG_PANIC_ON_OOPS=y/# CONFIG_PANIC_ON_OOPS is not set/' ${KERNEL_DEF_CONF};         cat /config >> ${KERNEL_DEF_CONF};     fi &&     make defconfig &&     make oldconfig &&     if [ -z "" ] && [ -z "" ]; then diff -u .config ${KERNEL_DEF_CONF}; fi:                                                                              
#16 0.433   HOSTCC  scripts/basic/fixdep                                                                                                                                                                                                                                                                 
#16 0.547   HOSTCC  scripts/kconfig/conf.o                                                                                                                                                                                                                                                               
#16 0.808   HOSTCC  scripts/kconfig/confdata.o
#16 1.147   HOSTCC  scripts/kconfig/expr.o
#16 1.485   LEX     scripts/kconfig/lexer.lex.c
#16 1.499   YACC    scripts/kconfig/parser.tab.[ch]
#16 1.693   HOSTCC  scripts/kconfig/lexer.lex.o
#16 2.127   HOSTCC  scripts/kconfig/menu.o
#16 2.400   HOSTCC  scripts/kconfig/parser.tab.o
#16 2.751   HOSTCC  scripts/kconfig/preprocess.o
#16 2.912   HOSTCC  scripts/kconfig/symbol.o
#16 3.382   HOSTCC  scripts/kconfig/util.o
#16 3.448   HOSTLD  scripts/kconfig/conf
#16 3.459 *** Default configuration is based on 'x86_64_defconfig'
#16 4.421 #
#16 4.446 # configuration written to .config
#16 4.446 #
#16 5.504 #
#16 5.504 # No change to .config
#16 5.504 #
#16 5.508 --- .config	2023-04-17 14:04:52.772652938 +0000
#16 5.508 +++ /linux/arch/x86/configs/x86_64_defconfig	2023-04-17 14:04:48.684636436 +0000
#16 5.508 @@ -1,6 +1,6 @@
#16 5.508  #
#16 5.508  # Automatically generated file; DO NOT EDIT.
#16 5.508 -# Linux/x86 5.15.106 Kernel Configuration
#16 5.508 +# Linux/x86_64 5.15.106 Kernel Configuration
#16 5.508  #
#16 5.508  CONFIG_CC_VERSION_TEXT="gcc (Alpine 10.2.1_pre1) 10.2.1 20201203"
#16 5.508  CONFIG_CC_IS_GCC=y
#16 5.508 @@ -311,7 +311,6 @@
#16 5.508  CONFIG_ARCH_SUPPORTS_UPROBES=y
#16 5.508  CONFIG_FIX_EARLYCON_MEM=y
#16 5.508  CONFIG_PGTABLE_LEVELS=4
#16 5.508 -CONFIG_CC_HAS_SANE_STACKPROTECTOR=y
#16 5.508  
#16 5.508  #
#16 5.508  # Processor type and features
#16 5.508 @@ -467,14 +466,13 @@
#16 5.508  CONFIG_HAVE_LIVEPATCH=y
#16 5.508  # end of Processor type and features
#16 5.508  
#16 5.508 -CONFIG_CC_HAS_RETURN_THUNK=y
#16 5.508 +CONFIG_CC_HAS_SLS=y
#16 5.508  CONFIG_SPECULATION_MITIGATIONS=y
#16 5.508  CONFIG_PAGE_TABLE_ISOLATION=y
#16 5.508  CONFIG_RETPOLINE=y
#16 5.508 -CONFIG_RETHUNK=y
#16 5.508 -CONFIG_CPU_UNRET_ENTRY=y
#16 5.508  CONFIG_CPU_IBPB_ENTRY=y
#16 5.508  CONFIG_CPU_IBRS_ENTRY=y
#16 5.508 +# CONFIG_SLS is not set
#16 5.508  CONFIG_ARCH_HAS_ADD_PAGES=y
#16 5.508  CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
#16 5.508  
#16 5.508 @@ -641,10 +639,6 @@
#16 5.508  CONFIG_KVM_AMD=m
#16 5.508  # CONFIG_KVM_XEN is not set
#16 5.508  # CONFIG_KVM_MMU_AUDIT is not set
#16 5.508 -CONFIG_AS_AVX512=y
#16 5.508 -CONFIG_AS_SHA1_NI=y
#16 5.508 -CONFIG_AS_SHA256_NI=y
#16 5.508 -CONFIG_AS_TPAUSE=y
#16 5.508  
#16 5.508  #
#16 5.508  # General architecture-dependent options
#16 5.508 @@ -707,9 +701,6 @@
#16 5.508  CONFIG_SECCOMP_FILTER=y
#16 5.508  # CONFIG_SECCOMP_CACHE_DEBUG is not set
#16 5.508  CONFIG_HAVE_ARCH_STACKLEAK=y
#16 5.508 -CONFIG_HAVE_STACKPROTECTOR=y
#16 5.508 -CONFIG_STACKPROTECTOR=y
#16 5.508 -CONFIG_STACKPROTECTOR_STRONG=y
#16 5.508  CONFIG_ARCH_SUPPORTS_LTO_CLANG=y
#16 5.508  CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN=y
#16 5.508  CONFIG_LTO_NONE=y
#16 5.508 @@ -4825,7 +4816,7 @@
#16 5.508  CONFIG_PROBE_EVENTS=y
#16 5.508  # CONFIG_BPF_KPROBE_OVERRIDE is not set
#16 5.508  CONFIG_FTRACE_MCOUNT_RECORD=y
#16 5.508 -CONFIG_FTRACE_MCOUNT_USE_CC=y
#16 5.508 +CONFIG_FTRACE_MCOUNT_USE_OBJTOOL=y
#16 5.508  # CONFIG_SYNTH_EVENTS is not set
#16 5.508  # CONFIG_HIST_TRIGGERS is not set
#16 5.508  # CONFIG_TRACE_EVENT_INJECT is not set
------
executor failed running [/bin/sh -c case $(uname -m) in     x86_64)         KERNEL_DEF_CONF=/linux/arch/x86/configs/x86_64_defconfig;         ;;     aarch64)         KERNEL_DEF_CONF=/linux/arch/arm64/configs/defconfig;         ;;     esac  &&     cp /config-${KERNEL_SERIES}-$(uname -m) ${KERNEL_DEF_CONF};     if [ -n "${EXTRA}" ] && [ -f "/config-${KERNEL_SERIES}-$(uname -m)${EXTRA}" ]; then         cat /config-${KERNEL_SERIES}-$(uname -m)${EXTRA} >> ${KERNEL_DEF_CONF};     fi;     sed -i "s/CONFIG_LOCALVERSION=\"-linuxkit\"/CONFIG_LOCALVERSION=\"-linuxkit${EXTRA}${DEBUG}\"/" ${KERNEL_DEF_CONF};     if [ -n "${DEBUG}" ]; then         sed -i 's/CONFIG_PANIC_ON_OOPS=y/# CONFIG_PANIC_ON_OOPS is not set/' ${KERNEL_DEF_CONF};         cat /config${DEBUG} >> ${KERNEL_DEF_CONF};     fi &&     make defconfig &&     make oldconfig &&     if [ -z "${EXTRA}" ] && [ -z "${DEBUG}" ]; then diff -u .config ${KERNEL_DEF_CONF}; fi]: exit code: 1
make: *** [Makefile:259: build_5.15.x] Error 1

@errordeveloper
Copy link
Contributor Author

@djs55 yeah, I also got swab.h patching error in attempt to build 5.10.

However, running make build_5.15.x -C kernel/ with ARCH=arm64 and ARCH=x86_64 didn't produce any errors for me.

@errordeveloper
Copy link
Contributor Author

errordeveloper commented May 10, 2023

I manage to patch the configs for 5.15 to build, it looks like config generation logic is broken in the case of cross-compilation. Somehow not all target-specific config options get set correctly for some reason, maybe the toolchain is not configured properly. It gets some options right, but some others are somewhat wrong.

This might be a clue:

#16 5.508 -# Linux/x86 5.15.106 Kernel Configuration
#16 5.508 +# Linux/x86_64 5.15.106 Kernel Configuration

@errordeveloper errordeveloper force-pushed the kernel-updates branch 5 times, most recently from c80fec0 to 3c4da31 Compare May 11, 2023 12:34
@errordeveloper
Copy link
Contributor Author

errordeveloper commented May 11, 2023

All three kernels (5.4.x, 5.10.x & 5.15.x) are building now (tested with make buildx_<v>) for both architectures. Well, 5.4.x is Intel-only, of course. And we don't have patches anymore 🎉

kernel/Makefile Outdated Show resolved Hide resolved
Copy link
Collaborator

@deitch deitch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As before, looks fine to me, but only @rn really can sign off on these

@errordeveloper
Copy link
Contributor Author

I've rebased, I'd expect CI to pass now, as @djs55 helped with getting the images published.

@errordeveloper
Copy link
Contributor Author

I updated tests and examples just now also, as I missed that step last time.

@errordeveloper
Copy link
Contributor Author

@fredericdalleau looks like tests are failing due to -builder images missing. I don't seem to find a make target for pushing those images, do you know what's meant to happen?

@deitch
Copy link
Collaborator

deitch commented Jun 13, 2023

The builder tags are tagged via the make tagbuilder target here, which gets called by make push here. It tags the specific image that was used to build the kernel, so it is possible to build kernel modules later.

@errordeveloper
Copy link
Contributor Author

Thanks a lot, @deitch! I was looking for targets with push prefix. I wonder if the issue might be to do with buildx_* targets being somewhat separate from the rest, I think @djs55 used those to build & push.

@deitch
Copy link
Collaborator

deitch commented Jun 13, 2023

I don't often touch the kernel stuff. @rn is the real expert. When I added the -builder stuff (and its variants, such as image info loaded into the LABELs and on the filesystem), I simplified some of it, but I remember very little. I usually refer to the kernels.md

@errordeveloper
Copy link
Contributor Author

@djs55 just pushed -builder images, let's see if we get pass in CI at last!🤞

Drop 5.11 as it reached EOL

Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
@errordeveloper
Copy link
Contributor Author

@rn this finally looks all green, just needs your approval!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants