Skip to content

Commit

Permalink
Bump kernel to 6.1
Browse files Browse the repository at this point in the history
Change-type: patch
Signed-off-by: Kyle Harding <[email protected]>
  • Loading branch information
klutchell committed Mar 1, 2024
1 parent 5b9e209 commit 0f06546
Show file tree
Hide file tree
Showing 12 changed files with 6,629 additions and 29 deletions.
26 changes: 15 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,28 @@ RUN apt-get update \
vim-tiny \
&& rm -rf /var/lib/apt/lists/*

ARG KERNEL_BRANCH=5.10
ARG KERNEL_BRANCH=6.1

RUN git clone --depth 1 -c advice.detachedHead=false \
--branch "v${KERNEL_BRANCH}" https://github.com/torvalds/linux.git .

COPY vmlinux/*.patch ./
COPY vmlinux/${KERNEL_BRANCH}/*.patch ./

RUN git apply -v ./*.patch

###############################################

FROM linux.git AS vmlinux
FROM linux.git AS vmlinux-arm64
ARG KERNEL_BRANCH
COPY vmlinux/${KERNEL_BRANCH}/microvm-kernel-arm64-${KERNEL_BRANCH}.config ./.config
RUN make Image && lz4 -9 ./arch/arm64/boot/Image ./vmlinux.bin.lz4

COPY vmlinux/*.config ./
###############################################

RUN if [ "$(uname -m)" = "aarch64" ] ; \
then ln -sf "microvm-kernel-arm64-5.10.config" .config && make Image && \
lz4 -9 ./arch/arm64/boot/Image ./vmlinux.bin.lz4 ; \
else ln -sf "microvm-kernel-x86_64-5.10.config" .config && make vmlinux &&\
lz4 -9 ./vmlinux ./vmlinux.bin.lz4 ; \
fi
FROM linux.git AS vmlinux-amd64
ARG KERNEL_BRANCH
COPY vmlinux/${KERNEL_BRANCH}/microvm-kernel-x86_64-${KERNEL_BRANCH}.config ./.config
RUN make vmlinux && lz4 -9 ./vmlinux ./vmlinux.bin.lz4

###############################################

Expand Down Expand Up @@ -103,8 +104,11 @@ RUN apt-get update \
uuid-runtime \
&& rm -rf /var/lib/apt/lists/*

ARG TARGETARCH

COPY --from=firecracker /usr/local/bin/* /usr/local/bin/
COPY --from=vmlinux /src/vmlinux.bin.lz4 /jail/boot/vmlinux.bin.lz4
# hadolint ignore=DL3022
COPY --from=vmlinux-${TARGETARCH} /src/vmlinux.bin.lz4 /jail/boot/vmlinux.bin.lz4

RUN addgroup --system firecracker \
&& adduser --system firecracker --ingroup firecracker \
Expand Down
1 change: 1 addition & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ target "default" {
"linux/arm64"
]
target = "jailer"
dockerfile = "Dockerfile.template"
}
3 changes: 0 additions & 3 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ services:
file: docker-compose.yml
service: jailer
build:
context: .
args:
TEST_IMAGE: alpine:3.18
cache_from:
Expand All @@ -66,7 +65,6 @@ services:
file: docker-compose.yml
service: jailer
build:
context: .
args:
TEST_IMAGE: debian:bookworm-slim
cache_from:
Expand All @@ -78,7 +76,6 @@ services:
file: docker-compose.yml
service: jailer
build:
context: .
args:
TEST_IMAGE: ubuntu:jammy
cache_from:
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From: Andy Whitcroft <[email protected]>
Date: Fri, 27 Nov 2015 17:38:30 +0000
Subject: [PATCH] UBUNTU: SAUCE: (no-up) add compat_uts_machine= kernel command
line override

We wish to use the arm64 buildds to build armhf binaries in 32bit chroots.
To make this work we need uname to return armv7l machine type. To achieve
this add a kernel command line override for the 32bit machine type.
Add compat_uts_machine=<type> to allow the LINUX32 personality to return
that type for uname.

Signed-off-by: Andy Whitcroft <[email protected]>
---
kernel/sys.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/kernel/sys.c b/kernel/sys.c
index 83ffd7dccf23..5b030fbaf199 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1138,6 +1138,21 @@ SYSCALL_DEFINE0(setsid)

DECLARE_RWSEM(uts_sem);

+#ifdef COMPAT_UTS_MACHINE
+static char compat_uts_machine[__OLD_UTS_LEN+1] = COMPAT_UTS_MACHINE;
+
+static int __init parse_compat_uts_machine(char *arg)
+{
+ strncpy(compat_uts_machine, arg, __OLD_UTS_LEN);
+ compat_uts_machine[__OLD_UTS_LEN] = 0;
+ return 0;
+}
+early_param("compat_uts_machine", parse_compat_uts_machine);
+
+#undef COMPAT_UTS_MACHINE
+#define COMPAT_UTS_MACHINE compat_uts_machine
+#endif
+
#ifdef COMPAT_UTS_MACHINE
#define override_architecture(name) \
(personality(current->personality) == PER_LINUX32 && \
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
From: Zubair Lutfullah Kakakhel <[email protected]>
Date: Mon, 11 Feb 2019 15:52:06 +0000
Subject: [PATCH] HACK: Use the UNAME26 personality to return armv6l instead of
v2.6.32+

We'd like to make our arm builders return two different machine strings
at runtime for different processes. armv7l and armv6l. This is so that
a docker daemon for armv6l/armv8l device builds thinks the docker build
is unning under the correct machine arch. Various package managers such
as pip rely on the output of uname -m to be correct.

The UNAME26 personality is used by old userspace programs to make the
kernel version string appear as 2.6+.

Add a hack in the kernel to modify the machine string for the uname26
personality and make it show armv6l. And don't change the kernel
version string to 2.6.+

The benefit of this hack instead of adding a new personality is
- we won't have to carry a custom version of the setarch userspace utility
- simpler to implement and keep lying around

Trade-off. I'm hoping no customer is pushing applications that depend
on the kernel version string being 2.6+ and the actual uname26
personality usage.

With this patch and compat_uts_machine=armv7l in the kernel cmdline
on our arm builder

root@arm02:~# linux32 --uname-2.6 uname -m
armv6l
root@arm02:~# linux32 uname -m
armv7l
root@arm02:~# uname -m
aarch64
root@arm02:~#

Signed-off-by: Zubair Lutfullah Kakakhel <[email protected]>
---
kernel/sys.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index 4e0a24b0c14d..f8807b47740b 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1173,24 +1173,9 @@ static int override_release(char __user *release, size_t len)
{
int ret = 0;

+ strncpy(compat_uts_machine, "armv7l", __OLD_UTS_LEN);
if (current->personality & UNAME26) {
- const char *rest = UTS_RELEASE;
- char buf[65] = { 0 };
- int ndots = 0;
- unsigned v;
- size_t copy;
-
- while (*rest) {
- if (*rest == '.' && ++ndots >= 3)
- break;
- if (!isdigit(*rest) && *rest != '.')
- break;
- rest++;
- }
- v = LINUX_VERSION_PATCHLEVEL + 60;
- copy = clamp_t(size_t, len, 1, sizeof(buf));
- copy = scnprintf(buf, copy, "2.6.%u%s", v, rest);
- ret = copy_to_user(release, buf, copy + 1);
+ strncpy(compat_uts_machine, "armv6l", __OLD_UTS_LEN);
}
return ret;
}
Loading

0 comments on commit 0f06546

Please sign in to comment.