Skip to content

Commit

Permalink
support to build an rhel8 kernel
Browse files Browse the repository at this point in the history
Use:
docker build -f dockerfiles/kernel-images-rhel8 .

Requres: cilium/little-vm-helper#144

Signed-off-by: Lorenz Bauer <[email protected]>
Signed-off-by: Kornilios Kourtis <[email protected]>
  • Loading branch information
kkourt committed Jan 24, 2024
1 parent b3f11a5 commit be81422
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
10 changes: 10 additions & 0 deletions _data/kernels.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@
{
"name": "4.19",
"url": "git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git?depth=1#linux-4.19.y"
},
{
"name": "rhel8",
"opts": [
[ "--enable", "CONFIG_EXT4_FS"],
[ "--disable", "CONFIG_SECURITY_APPARMOR"],
[ "--disable", "CONFIG_NF_CONNTRACK"],
[ "--disable", "CONFIG_MODULE_SIG"],
[ "--disable", "CONFIG_MODULE_SIG_ALL"]
]
}
],
"common_opts": [
Expand Down
49 changes: 49 additions & 0 deletions dockerfiles/kernel-images-rhel8
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# syntax=docker/dockerfile:1.3-labs
# vim: set ft=dockerfile:

FROM quay.io/lvh-images/lvh:latest AS lvh

FROM rockylinux:8 AS builder

COPY --from=lvh /usr/bin/lvh /usr/bin/lvh

RUN dnf install -y 'dnf-command(builddep)' 'dnf-command(config-manager)'
RUN dnf config-manager --set-enabled powertools
RUN dnf builddep -y kernel

FROM builder AS prepare

WORKDIR /tmp
RUN dnf download --source kernel && rpm -ivh kernel*.src.rpm

WORKDIR /root/rpmbuild/SPECS
RUN rpmbuild -bp kernel.spec --with baseonly

RUN ln -s /root/rpmbuild/BUILD/kernel-*/linux-* /tmp/build
WORKDIR /tmp/build

RUN mkdir patches
COPY patches/rhel8/*.patch patches/
RUN for p in patches/*.patch; do echo "Applying $p"; patch -p1 < "$p" || exit 1; done

# Emulate InitBuildVars() from kernel.spec
RUN make -s mrproper
RUN cp configs/kernel-*-$(uname -m)-debug.config .config

# Remove all RHEL modules
RUN sed --in-place -E -e 's/^(CONFIG_[^=]+)=m/# \1 is not set/' .config

COPY _data /data

RUN lvh kernels --dir /data raw_configure . rhel8 2>&1

FROM prepare AS build

RUN make -j $(nproc)
RUN make tar-pkg

COPY scripts/generate-btf.sh /tmp/
RUN /tmp/generate-btf.sh /tmp/build/tar-install

FROM busybox as kernel
COPY --from=build /tmp/build/tar-install /data/kernels/rhel8
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From fe6340e2d1f5ef9ebb9a82665b053c362837cbd6 Mon Sep 17 00:00:00 2001
From: Souptick Joarder <[email protected]>
Date: Tue, 17 Jul 2018 19:14:35 -0700
Subject: [PATCH] fs/9p/vfs_file.c: use new return type vm_fault_t

Use new return type vm_fault_t for page_mkwrite handler.

See 1c8f422059ae ("mm: change return type to vm_fault_t") for reference.

Link: http://lkml.kernel.org/r/20180702154928.GA3964@jordon-HP-15-Notebook-PC
Signed-off-by: Souptick Joarder <[email protected]>
Reviewed-by: Matthew Wilcox <[email protected]>
Acked-by: Jun Piao <[email protected]>
Cc: Eric Van Hensbergen <[email protected]>
Cc: Ron Minnich <[email protected]>
Cc: Latchesar Ionkov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Dominique Martinet <[email protected]>
---
fs/9p/vfs_file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 03c9e325bfbc..5f2e48d41d72 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -533,7 +533,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma)
return retval;
}

-static int
+static vm_fault_t
v9fs_vm_page_mkwrite(struct vm_fault *vmf)
{
struct v9fs_inode *v9inode;
--
2.43.0

0 comments on commit be81422

Please sign in to comment.