From 47ed84ee68bd7c31fc87a1541f80ad79df438e6d Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sat, 29 Apr 2017 11:24:01 +0100 Subject: [PATCH 1/8] kernels: Don't pull to check if image exists on hub Doing a "docker pull" to check if an image exist on hub takes a long time for the number of images, in particular in the linuxkit/kernel-mainline repo. Instead, get a list of tags on Hub and check that way. This does not check if the image was signed, but should be good enough. Signed-off-by: Rolf Neugebauer --- scripts/kernels/debian.sh | 8 ++++++-- scripts/kernels/mainline.sh | 7 ++++++- scripts/kernels/ubuntu.sh | 9 ++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/kernels/debian.sh b/scripts/kernels/debian.sh index ca0a5adc5..c3dcde3bb 100755 --- a/scripts/kernels/debian.sh +++ b/scripts/kernels/debian.sh @@ -3,6 +3,8 @@ REPO="linuxkit/kernel-debian" BASE_URL=http://mirrors.kernel.org/debian/pool/main/l/linux/ +TAGS=$(curl --silent -f -lSL https://registry.hub.docker.com/v1/repositories/${REPO}/tags) + ARCH=amd64 LINKS=$(curl -s ${BASE_URL}/ | sed -n 's/.*href="\([^"]*\).*/\1/p') # Just get names for 4.x kernels @@ -13,8 +15,10 @@ for KERN_DEB in $KERNELS; do VERSION=$(echo $KERN_DEB | \ grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+" | head -1) - echo "$VERSION -> $KERN_DEB" - DOCKER_CONTENT_TRUST=1 docker pull ${REPO}:${VERSION} && continue + if echo $TAGS | grep -q "\"${VERSION}\""; then + echo "${REPO}:${VERSION} exists" + continue + fi URLS="${BASE_URL}/${KERN_DEB}" diff --git a/scripts/kernels/mainline.sh b/scripts/kernels/mainline.sh index d93d9d55a..a3a916fe6 100755 --- a/scripts/kernels/mainline.sh +++ b/scripts/kernels/mainline.sh @@ -3,6 +3,8 @@ REPO="linuxkit/kernel-mainline" BASE_URL=http://kernel.ubuntu.com/~kernel-ppa/mainline +TAGS=$(curl --silent -f -lSL https://registry.hub.docker.com/v1/repositories/${REPO}/tags) + build_image() { VERSION=$1 KDIR=$2 @@ -43,7 +45,10 @@ for KDIR in $KDIRS; do # Strip the Ubuntu release name for the tag and also the 'v' like with # the other kernel packages VERSION=$(echo $KDIR | grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+") - DOCKER_CONTENT_TRUST=1 docker pull ${REPO}:${VERSION} && continue + if echo $TAGS | grep -q "\"${VERSION}\""; then + echo "${REPO}:${VERSION} exists" + continue + fi build_image ${VERSION} ${KDIR} && \ DOCKER_CONTENT_TRUST=1 docker push ${REPO}:${VERSION} done diff --git a/scripts/kernels/ubuntu.sh b/scripts/kernels/ubuntu.sh index ea285cd47..47de1ae18 100755 --- a/scripts/kernels/ubuntu.sh +++ b/scripts/kernels/ubuntu.sh @@ -3,6 +3,8 @@ REPO="linuxkit/kernel-ubuntu" BASE_URL=http://mirrors.kernel.org/ubuntu/pool/main/l/linux/ +TAGS=$(curl --silent -f -lSL https://registry.hub.docker.com/v1/repositories/${REPO}/tags) + ARCH=amd64 LINKS=$(curl -s ${BASE_URL}/ | sed -n 's/.*href="\([^"]*\).*/\1/p') # Just get names for 4.x kernels @@ -13,8 +15,10 @@ for KERN_DEB in $KERNELS; do VERSION=$(echo $KERN_DEB | \ grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+" | head -1) - echo "$VERSION -> $KERN_DEB" - DOCKER_CONTENT_TRUST=1 docker pull ${REPO}:${VERSION} && continue + if echo $TAGS | grep -q "\"${VERSION}\""; then + echo "${REPO}:${VERSION} exists" + continue + fi EXTRA_DEB=$(echo $LINKS | \ grep -o "linux-image-extra-${VERSION}-generic_[^ ]\+${ARCH}\.deb") @@ -27,7 +31,6 @@ for KERN_DEB in $KERNELS; do URLS="${BASE_URL}/${KERN_DEB} ${BASE_URL}/${EXTRA_DEB}" - # Doesn't exist build and push docker build -t ${REPO}:${VERSION} -f Dockerfile.deb --no-cache \ --build-arg DEB_URLS="${URLS}" . && DOCKER_CONTENT_TRUST=1 docker push ${REPO}:${VERSION} From 31d84a6380ca2e6753e6d4e571537f4fee2946c9 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sat, 29 Apr 2017 11:35:48 +0100 Subject: [PATCH 2/8] kernels: Add System.map to kernel hub image Also, don't fail if the headers are not installed Signed-off-by: Rolf Neugebauer --- scripts/kernels/Dockerfile.deb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/kernels/Dockerfile.deb b/scripts/kernels/Dockerfile.deb index e5ba75a67..39e18d0a3 100644 --- a/scripts/kernels/Dockerfile.deb +++ b/scripts/kernels/Dockerfile.deb @@ -14,8 +14,9 @@ RUN for url in ${DEB_URLS}; do \ RUN mkdir /out RUN cp -a boot/vmlinuz-* /out/kernel RUN cp -a boot/config-* /out/kernel_config +RUN cp -a boot/System.map-* /out/System.map RUN tar cf /out/kernel.tar lib -RUN tar cf /out/kernel-dev.tar usr +RUN tar cf /out/kernel-dev.tar usr || true FROM linuxkit/toybox-media:d7e82a7d19ccc84c9071fa7a88ecaa58ae958f7c@sha256:4c7d25f2be2429cd08417c36e04161cb924e46f3e419ee33a0aa9ff3a0942e02 WORKDIR / From 4ff7be375eca63f8b546f047ceed872d129eefd2 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sat, 29 Apr 2017 11:43:44 +0100 Subject: [PATCH 3/8] kernels: Tweak the ubuntu script a little No actual source change, just make it easier to enable kernel headers should they be needed. Signed-off-by: Rolf Neugebauer --- scripts/kernels/ubuntu.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/kernels/ubuntu.sh b/scripts/kernels/ubuntu.sh index 47de1ae18..5a8102539 100755 --- a/scripts/kernels/ubuntu.sh +++ b/scripts/kernels/ubuntu.sh @@ -23,13 +23,14 @@ for KERN_DEB in $KERNELS; do EXTRA_DEB=$(echo $LINKS | \ grep -o "linux-image-extra-${VERSION}-generic_[^ ]\+${ARCH}\.deb") + URLS="${BASE_URL}/${KERN_DEB} ${BASE_URL}/${EXTRA_DEB}" + # Don't pull in the headers. This is mostly for testing # HDR_DEB=$(echo $LINKS | \ # grep -o "linux-headers-${VERSION}_[^ ]\+_all\.deb") # HDR_ARCH_DEB=$(echo $LINKS | \ # grep -o "linux-headers-${VERSION}-generic_[^ ]\+_${ARCH}\.deb") - - URLS="${BASE_URL}/${KERN_DEB} ${BASE_URL}/${EXTRA_DEB}" + # URLS="${URLS} ${BASE_URL}/${HDR_DEB} ${BASE_URL}/${HDR_ARCH_DEB}" docker build -t ${REPO}:${VERSION} -f Dockerfile.deb --no-cache \ --build-arg DEB_URLS="${URLS}" . && From eeb8ee058c5228eb80657d7cc606bb8832df01fa Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sat, 29 Apr 2017 13:36:22 +0100 Subject: [PATCH 4/8] kernels: Add script to convert CentOS kernels We only convert CentOS 7 kernels for now. CentOS 6 is too old for most of our purposes. Signed-off-by: Rolf Neugebauer --- scripts/kernels/Dockerfile.rpm | 25 +++++++++++++++++++ scripts/kernels/centos.sh | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 scripts/kernels/Dockerfile.rpm create mode 100755 scripts/kernels/centos.sh diff --git a/scripts/kernels/Dockerfile.rpm b/scripts/kernels/Dockerfile.rpm new file mode 100644 index 000000000..509ce017c --- /dev/null +++ b/scripts/kernels/Dockerfile.rpm @@ -0,0 +1,25 @@ +FROM alpine:3.5 AS extract + +ARG RPM_URLS + +RUN apk add --no-cache curl rpm tar && true +WORKDIR /rpm +RUN mkdir extract +RUN for url in ${RPM_URLS}; do \ + echo "Extracting: $url"; \ + curl -fsSL -o dl.rpm $url && \ + rpm2cpio dl.rpm | cpio -idm ;\ + done + +RUN mkdir /out +RUN cp -a boot/vmlinuz-* /out/kernel +RUN cp -a boot/config-* /out/kernel_config +RUN cp -a boot/System.map-* /out/System.map +RUN tar cf /out/kernel.tar lib +RUN tar cf /out/kernel-dev.tar usr || true + +FROM linuxkit/toybox-media:d7e82a7d19ccc84c9071fa7a88ecaa58ae958f7c@sha256:4c7d25f2be2429cd08417c36e04161cb924e46f3e419ee33a0aa9ff3a0942e02 +WORKDIR / +ENTRYPOINT [] +CMD [] +COPY --from=extract /out/* / diff --git a/scripts/kernels/centos.sh b/scripts/kernels/centos.sh new file mode 100755 index 000000000..d95dd92ee --- /dev/null +++ b/scripts/kernels/centos.sh @@ -0,0 +1,44 @@ +#! /bin/sh + +REPO="linuxkit/kernel-centos" +BASE_URL=http://mirror.centos.org/centos/ + +TAGS=$(curl --silent -f -lSL https://registry.hub.docker.com/v1/repositories/${REPO}/tags) + +LINKS=$(curl -s ${BASE_URL}/ | sed -n 's/.*href="\([^"]*\).*/\1/p') +# Just get names for Centos 7 +RELEASES=$(echo $LINKS | grep -o "7\.[^ ]*") +RELEASES="7/ $RELEASES" + +# Add updates +URLS="" +for RELEASE in $RELEASES; do + URLS="$URLS ${BASE_URL}/${RELEASE}/os/x86_64/Packages/" +done +URLS="$URLS ${BASE_URL}/7/updates/x86_64/Packages/" + +for URL in $URLS; do + PACKAGES=$(curl -s ${URL}/ | sed -n 's/.*href="\([^"]*\).*/\1/p') + + KERNEL_RPMS=$(echo $PACKAGES | \ + grep -o "kernel-[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+\.[^ ]\+\.rpm") + for KERNEL_RPM in $KERNEL_RPMS; do + RPM_URLS="${URL}/${KERNEL_RPM}" + + VERSION=$(echo $KERNEL_RPM | \ + grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9\.]\+\.el[0-9]\+") + + if echo $TAGS | grep -q "\"${VERSION}\""; then + echo "${REPO}:${VERSION} exists" + continue + fi + + # Don't pull in the headers. This is mostly for testing + # HEADERS_RPM="kernel-headers-${VERSION}.x86_64.rpm" + # RPM_URLS="${RPM_URLS} ${URL}/${HEADERS_RPM}" + + docker build -t ${REPO}:${VERSION} -f Dockerfile.rpm --no-cache \ + --build-arg RPM_URLS="${RPM_URLS}" . && + DOCKER_CONTENT_TRUST=1 docker push ${REPO}:${VERSION} + done +done From f145a3cee7f29b66f9508dc8f9e2a2d3f932e47c Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sat, 29 Apr 2017 16:47:07 +0100 Subject: [PATCH 5/8] kernels: Run depmod on modules before packaging Signed-off-by: Rolf Neugebauer --- scripts/kernels/Dockerfile.deb | 2 ++ scripts/kernels/Dockerfile.rpm | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scripts/kernels/Dockerfile.deb b/scripts/kernels/Dockerfile.deb index 39e18d0a3..ae03f8c44 100644 --- a/scripts/kernels/Dockerfile.deb +++ b/scripts/kernels/Dockerfile.deb @@ -11,6 +11,8 @@ RUN for url in ${DEB_URLS}; do \ dpkg-deb -x dl.deb . ;\ done +RUN for d in lib/modules/*; do depmod -b . $(basename $d); done + RUN mkdir /out RUN cp -a boot/vmlinuz-* /out/kernel RUN cp -a boot/config-* /out/kernel_config diff --git a/scripts/kernels/Dockerfile.rpm b/scripts/kernels/Dockerfile.rpm index 509ce017c..b2512e276 100644 --- a/scripts/kernels/Dockerfile.rpm +++ b/scripts/kernels/Dockerfile.rpm @@ -11,6 +11,8 @@ RUN for url in ${RPM_URLS}; do \ rpm2cpio dl.rpm | cpio -idm ;\ done +RUN for d in lib/modules/*; do depmod -b . $(basename $d); done + RUN mkdir /out RUN cp -a boot/vmlinuz-* /out/kernel RUN cp -a boot/config-* /out/kernel_config From 4defc9f13445e4d803681fa420ded2fe38e1590e Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sun, 30 Apr 2017 10:32:49 +0100 Subject: [PATCH 6/8] kernels: Clean after creating an image Remove the image and the intermediate images. Otherwise, especially for the initial runs, the disk fills up quickly. Signed-off-by: Rolf Neugebauer --- scripts/kernels/centos.sh | 3 +++ scripts/kernels/debian.sh | 3 +++ scripts/kernels/mainline.sh | 3 +++ scripts/kernels/ubuntu.sh | 3 +++ 4 files changed, 12 insertions(+) diff --git a/scripts/kernels/centos.sh b/scripts/kernels/centos.sh index d95dd92ee..8be7d63f2 100755 --- a/scripts/kernels/centos.sh +++ b/scripts/kernels/centos.sh @@ -40,5 +40,8 @@ for URL in $URLS; do docker build -t ${REPO}:${VERSION} -f Dockerfile.rpm --no-cache \ --build-arg RPM_URLS="${RPM_URLS}" . && DOCKER_CONTENT_TRUST=1 docker push ${REPO}:${VERSION} + + docker rmi ${REPO}:${VERSION} + docker system prune -f done done diff --git a/scripts/kernels/debian.sh b/scripts/kernels/debian.sh index c3dcde3bb..c5661750f 100755 --- a/scripts/kernels/debian.sh +++ b/scripts/kernels/debian.sh @@ -26,4 +26,7 @@ for KERN_DEB in $KERNELS; do docker build -t ${REPO}:${VERSION} -f Dockerfile.deb --no-cache \ --build-arg DEB_URLS="${URLS}" . && DOCKER_CONTENT_TRUST=1 docker push ${REPO}:${VERSION} + + docker rmi ${REPO}:${VERSION} + docker system prune -f done diff --git a/scripts/kernels/mainline.sh b/scripts/kernels/mainline.sh index a3a916fe6..5694eb6c7 100755 --- a/scripts/kernels/mainline.sh +++ b/scripts/kernels/mainline.sh @@ -51,4 +51,7 @@ for KDIR in $KDIRS; do fi build_image ${VERSION} ${KDIR} && \ DOCKER_CONTENT_TRUST=1 docker push ${REPO}:${VERSION} + + docker rmi ${REPO}:${VERSION} + docker system prune -f done diff --git a/scripts/kernels/ubuntu.sh b/scripts/kernels/ubuntu.sh index 5a8102539..b5aa11c7f 100755 --- a/scripts/kernels/ubuntu.sh +++ b/scripts/kernels/ubuntu.sh @@ -35,4 +35,7 @@ for KERN_DEB in $KERNELS; do docker build -t ${REPO}:${VERSION} -f Dockerfile.deb --no-cache \ --build-arg DEB_URLS="${URLS}" . && DOCKER_CONTENT_TRUST=1 docker push ${REPO}:${VERSION} + + docker rmi ${REPO}:${VERSION} + docker system prune -f done From 83201bacbed8df36324b56c7c859a00132704c3a Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sun, 30 Apr 2017 11:32:04 +0100 Subject: [PATCH 7/8] kernels: Add script to convert Fedora kernels We only convert kernels from Fedora 2* as they have 4.x kernels. Signed-off-by: Rolf Neugebauer --- scripts/kernels/Dockerfile.rpm | 7 +++-- scripts/kernels/fedora.sh | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100755 scripts/kernels/fedora.sh diff --git a/scripts/kernels/Dockerfile.rpm b/scripts/kernels/Dockerfile.rpm index b2512e276..343aad7f1 100644 --- a/scripts/kernels/Dockerfile.rpm +++ b/scripts/kernels/Dockerfile.rpm @@ -14,9 +14,10 @@ RUN for url in ${RPM_URLS}; do \ RUN for d in lib/modules/*; do depmod -b . $(basename $d); done RUN mkdir /out -RUN cp -a boot/vmlinuz-* /out/kernel -RUN cp -a boot/config-* /out/kernel_config -RUN cp -a boot/System.map-* /out/System.map +# With some fedora rpms, the kernel and system map are in modules directory +RUN cp -a boot/vmlinuz-* /out/kernel || mv lib/modules/*/vmlinuz /out/kernel +RUN cp -a boot/config-* /out/kernel_config || mv lib/modules/*/config /out/kernel_config +RUN cp -a boot/System.map-* /out/System.map || mv lib/modules/*/System.map /out/System.map RUN tar cf /out/kernel.tar lib RUN tar cf /out/kernel-dev.tar usr || true diff --git a/scripts/kernels/fedora.sh b/scripts/kernels/fedora.sh new file mode 100755 index 000000000..74fe3e5e9 --- /dev/null +++ b/scripts/kernels/fedora.sh @@ -0,0 +1,55 @@ +#! /bin/sh + +REPO="linuxkit/kernel-fedora" +BASE_URL=http://mirrors.kernel.org/fedora/ + +TAGS=$(curl --silent -f -lSL https://registry.hub.docker.com/v1/repositories/${REPO}/tags) + +LINKS=$(curl -s ${BASE_URL}/releases/ | sed -n 's/.*href="\([^"]*\).*/\1/p') +# Just get releases 20+ +RELEASES=$(echo $LINKS | grep -o "2[0-9]") + +ARCH=x86_64 +URLS="" +for RELEASE in $RELEASES; do + URLS="$URLS ${BASE_URL}/releases/${RELEASE}/Everything/${ARCH}/os/Packages/k/" + URLS="$URLS ${BASE_URL}/updates/${RELEASE}/${ARCH}/k/" +done + +for URL in $URLS; do + PACKAGES=$(curl -s ${URL}/ | sed -n 's/.*href="\([^"]*\).*/\1/p') + + KERNEL_RPMS=$(echo $PACKAGES | \ + grep -o "kernel-[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+\.[^ ]\+\.rpm") + for KERNEL_RPM in $KERNEL_RPMS; do + RPM_URLS="${URL}/${KERNEL_RPM}" + + VERSION=$(echo $KERNEL_RPM | \ + grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9\.]\+\.fc[0-9]\+") + + if echo $TAGS | grep -q "\"${VERSION}\""; then + echo "${REPO}:${VERSION} exists" + continue + fi + + CORE_RPM="kernel-core-${VERSION}.${ARCH}.rpm" + RPM_URLS="${RPM_URLS} ${URL}/${CORE_RPM}" + + MOD_RPM="kernel-modules-${VERSION}.${ARCH}.rpm" + RPM_URLS="${RPM_URLS} ${URL}/${MOD_RPM}" + + MOD_EXTRA_RPM="kernel-modules-extra-${VERSION}.${ARCH}.rpm" + RPM_URLS="${RPM_URLS} ${URL}/${MOD_EXTRA_RPM}" + + # Don't pull in the headers. This is mostly for testing + # HEADERS_RPM="kernel-headers-${VERSION}.x86_64.rpm" + # RPM_URLS="${RPM_URLS} ${URL}/${HEADERS_RPM}" + + docker build -t ${REPO}:${VERSION} -f Dockerfile.rpm --no-cache \ + --build-arg RPM_URLS="${RPM_URLS}" . && + DOCKER_CONTENT_TRUST=1 docker push ${REPO}:${VERSION} + + docker rmi ${REPO}:${VERSION} + docker system prune -f + done +done From 721ffeeccd816767ff802c485dd82ab330b9fb0d Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sun, 30 Apr 2017 12:51:32 +0100 Subject: [PATCH 8/8] docs: Update kernel doc with info about supported kernels Signed-off-by: Rolf Neugebauer --- docs/kernels.md | 69 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 19 deletions(-) diff --git a/docs/kernels.md b/docs/kernels.md index 09136e9ef..241ba5a07 100644 --- a/docs/kernels.md +++ b/docs/kernels.md @@ -1,19 +1,36 @@ -# LinuxKit kernels +# Linux kernels -Currently, LinuxKit supports a number of kernels. These kernels are -typically based on the latest stable releases and are updated -frequently to include bug and security fixes. For some kernels we do -carry some additional patches, which are mostly back-ported fixes from -newer kernels. The full kernel source with patches is on -[github](https://github.com/linuxkit/linux). +LinuxKit kernel images are distributed as hub images which contain the +kernel, kernel modules, kernel config file, and optionally, kernel +headers to compile kernel modules against. The repository containing +the official LinuxKit kernels is at +[linuxkit/kernels](https://hub.docker.com/r/linuxkit/kernel/). -The kernel images are stored on Hub under -[linuxkit/kernel](https://hub.docker.com/r/linuxkit/kernel/). Each -kernel image is tagged with the full kernel version plus the hash of -the files it was created from (git tree hash of the `./kernel` +The LinuxKit kernels are based on the latest stable releases and are +updated frequently to include bug and security fixes. For some +kernels we do carry additional patches, which are mostly back-ported +fixes from newer kernels. The full kernel source with patches can be +found on [github](https://github.com/linuxkit/linux). Each kernel +image is tagged with the full kernel version plus the hash of the +files it was created from (git tree hash of the `./kernel` directory). For convenience, the latest kernel of each stable series -is also available under the a shorthand tag, -e.g. `linuxkit/kernel:4.9.x` for the latest `4.9` kernel. +is also available under a shorthand tag, e.g. `linuxkit/kernel:4.9.x` +for the latest `4.9` kernel. + +In addition to the official kernel images, LinuxKit offers the ability +to build bootable Linux images with kernels from various +distributions. We mostly offer this mostly for testing +purposes. "Foreign" kernel images are created by re-packing the native +kernel packages into hub images. The hub images are typically tagged +with the kernel version. + +In summary, LinuxKit offers a choice of the following kernels: +- [linuxkit/kernel](https://hub.docker.com/r/linuxkit/kernel/): Official LinuxKit kernels. +- [linuxkit/kernel-mainline](https://hub.docker.com/r/linuxkit/kernel-mainline/): Mainline [kernel.org](http://kernel.org) kernels from the [Ubuntu Mainline PPA](http://kernel.ubuntu.com/~kernel-ppa/mainline/). +- [linuxkit/kernel-ubuntu](https://hub.docker.com/r/linuxkit/kernel-ubuntu/): Selected Ubuntu kernels. +- [linuxkit/kernel-debian](https://hub.docker.com/r/linuxkit/kernel-debian/): Selected Debian kernels. +- [linuxkit/kernel-centos](https://hub.docker.com/r/linuxkit/kernel-centos/): Selected CentOS kernels. +- [linuxkit/kernel-fedora](https://hub.docker.com/r/linuxkit/kernel-fedora/): Selected Fedora kernels. ## Working with Linux kernel patches for LinuxKit @@ -66,13 +83,17 @@ to refer to the location of the LinuxKit and Linux kernel trees. ### Updating the patches to a new kernel version -There are different ways to do this, but we recommend applying the patches to the current version and then rebase to the new version. We define the following variables to refer to the current base tag and the new tag you want to rebase the patches to: +There are different ways to do this, but we recommend applying the +patches to the current version and then rebase to the new version. We +define the following variables to refer to the current base tag and +the new tag you want to rebase the patches to: ```sh CURTAG=v4.9.14 NEWTAG=v4.9.15 ``` -If you don't already have a branch, it's best to import the current patch set and then rebase: +If you don't already have a branch, it's best to import the current +patch set and then rebase: ```sh cd $LINUXSRC git checkout -b ${NEWTAG}-linuxkit ${CURTAG} @@ -80,9 +101,13 @@ git am ${KITSRC}/kernel/patches/*.patch git rebase ${NEWTAG}-linuxkit ${NEWTAG} ``` -The `git am` should not have any conflicts and if the rebase has conflicts resolve them, then `git add ` and `git rebase --continue`. +The `git am` should not have any conflicts and if the rebase has +conflicts resolve them, then `git add ` and `git rebase +--continue`. -If you already have linux tree with a `${CURTAG}-linuxkit` branch, you can rebase by creating a new branch from the current branch and then rebase: +If you already have linux tree with a `${CURTAG}-linuxkit` branch, you +can rebase by creating a new branch from the current branch and then +rebase: ```sh cd $LINUXSRC git checkout ${CURTAG}-linuxkit @@ -94,7 +119,12 @@ Again, resolve any conflicts as described above. ### Adding/Removing patches -If you want to add or remove patches make sure you have an up-to-date branch with the currently applied patches (see above). Then either any normal means (`git cherry-pick -x`, `git am`, or `git commit`, etc) to add new patches. For cherry-picked patches also please add a `Origin:` line after the DCO lines with a reference the git tree the patch was cherry-picked from. +If you want to add or remove patches make sure you have an up-to-date +branch with the currently applied patches (see above). Then either any +normal means (`git cherry-pick -x`, `git am`, or `git commit`, etc) to +add new patches. For cherry-picked patches also please add a `Origin:` +line after the DCO lines with a reference the git tree the patch was +cherry-picked from. If the patch is not cherry-picked try to include as much information in the commit message as possible as to where the patch originated @@ -106,7 +136,8 @@ Origin: https://patchwork.ozlabs.org/patch/622404/ ### Export patches to LinuxKit -To export patches to LinuxKit, you should use `git format-patch` from the Linux tree, e.g., something along these lines: +To export patches to LinuxKit, you should use `git format-patch` from +the Linux tree, e.g., something along these lines: ```sh cd $LINUXSRC rm $KITSRC/kernel/patches-4.9.x/*