From 3c9c2747732277c49d8c8c4b8f6a80e8409a2a68 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 15 Sep 2023 11:47:30 -0500 Subject: [PATCH] Initial commit --- Containerfile | 35 +++++++++++++++++++++++++++++++++++ build.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 Containerfile create mode 100644 build.sh diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..aaf9d60 --- /dev/null +++ b/Containerfile @@ -0,0 +1,35 @@ +ARG FEDORA +FROM registry.fedoraproject.org/fedora:${FEDORA} AS build + +ARG KVER + +# Download a specific version of kernel-devel from Koji +RUN --mount=type=cache,destination=/var/cache/dnf \ + dnf install -y koji \ + && koji download-build --rpm --arch=$(uname -m) kernel-devel-${KVER} \ + && : + +# Install kernel-devel and git +RUN --mount=type=cache,destination=/var/cache/dnf \ + dnf install -y \ + --setopt install_weak_deps=0 \ + ./kernel-devel-*.rpm \ + git-core \ + && : + +RUN install -o 101 -g 101 -d /usr/src/gasket-driver + +USER 101:101 + +# Build the gasket kernel module +RUN git clone https://github.com/google/gasket-driver.git /usr/src/gasket-driver +RUN make \ + -C /usr/src/kernels/$(rpm -q --qf %{V}-%{R}.%{ARCH} kernel-devel) \ + M=/usr/src/gasket-driver/src \ + modules + +FROM busybox + +COPY --from=build /usr/src/gasket-driver/src/*.ko / + +CMD insmod gasket.ko && insmod apex.ko diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..9ec86f8 --- /dev/null +++ b/build.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +kver=$(uname -r) +do_push=false +while [ $# -gt 0 ]; do + case "$1" in + --push) + do_push=true + ;; + *) + kver="$1" + ;; + esac + shift +done + +fedora=$(echo "${kver}" | sed -rn 's/.*fc([0-9]+).*/\1/p') +name=git.pyrocufflink.net/containerimages/gasket-driver + +podman build \ + -t ${name}:${kver} \ + --build-arg FEDORA=${fedora} \ + --build-arg KVER=${kver} \ + . +if ${do_push}; then + podman push ${name}:${kver} +fi