Build ZFS module for current kernel instead of using ucore-kmods
This commit is contained in:
parent
236da2aec6
commit
017c85da75
|
@ -15,12 +15,12 @@ on:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
MY_IMAGE_NAME: "${{ github.event.repository.name }}" # the name of the image produced by this build, matches repo names
|
MY_IMAGE_NAME: "${{ github.event.repository.name }}" # the name of the image produced by this build, matches repo names
|
||||||
MY_IMAGE_DESC: "My Customized Universal Blue Image"
|
MY_IMAGE_DESC: "Universal Blue main image with ZFS"
|
||||||
IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}" # do not edit
|
IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}" # do not edit
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_push_aurora:
|
build_push_aurora:
|
||||||
name: Build and push Aurora image
|
name: Build and publish SB image with ZFS
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# - "base"
|
# - "base"
|
||||||
#
|
#
|
||||||
# "aurora", "bazzite", "bluefin" or "ucore" may also be used but have different suffixes.
|
# "aurora", "bazzite", "bluefin" or "ucore" may also be used but have different suffixes.
|
||||||
ARG SOURCE_IMAGE="silverlue"
|
ARG SOURCE_IMAGE="silverblue"
|
||||||
|
|
||||||
## SOURCE_SUFFIX arg should include a hyphen and the appropriate suffix name
|
## SOURCE_SUFFIX arg should include a hyphen and the appropriate suffix name
|
||||||
# These examples all work for silverblue/kinoite/sericea/onyx/lazurite/vauxite/base
|
# These examples all work for silverblue/kinoite/sericea/onyx/lazurite/vauxite/base
|
||||||
|
@ -38,17 +38,42 @@ ARG SOURCE_SUFFIX="-main"
|
||||||
## SOURCE_TAG arg must be a version built for the specific image: eg, 39, 40, gts, latest
|
## SOURCE_TAG arg must be a version built for the specific image: eg, 39, 40, gts, latest
|
||||||
ARG SOURCE_TAG="40"
|
ARG SOURCE_TAG="40"
|
||||||
|
|
||||||
|
ARG FEDORA_VERSION=40
|
||||||
|
|
||||||
### 2. SOURCE IMAGE
|
### 2. Build ZFS module
|
||||||
|
## Adated from https://github.com/coreos/layering-examples/blob/main/build-zfs-module/Containerfile
|
||||||
|
FROM ghcr.io/ublue-os/${SOURCE_IMAGE}${SOURCE_SUFFIX}:${SOURCE_TAG} as kernel-query
|
||||||
|
RUN rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}' > /kernel-version.txt
|
||||||
|
|
||||||
|
# Using https://openzfs.github.io/openzfs-docs/Developer%20Resources/Custom%20Packages.html
|
||||||
|
FROM registry.fedoraproject.org/fedora:${FEDORA_VERSION} as builder
|
||||||
|
COPY --from=kernel-query /kernel-version.txt /kernel-version.txt
|
||||||
|
WORKDIR /etc/yum.repos.d
|
||||||
|
RUN curl -L -O https://src.fedoraproject.org/rpms/fedora-repos/raw/f${FEDORA_VERSION}/f/fedora-updates-archive.repo && \
|
||||||
|
sed -i 's/enabled=AUTO_VALUE/enabled=true/' fedora-updates-archive.repo
|
||||||
|
RUN dnf install -y jq dkms gcc make autoconf automake libtool rpm-build libtirpc-devel libblkid-devel \
|
||||||
|
libuuid-devel libudev-devel openssl-devel zlib-devel libaio-devel libattr-devel elfutils-libelf-devel \
|
||||||
|
kernel-$(cat /kernel-version.txt) kernel-modules-$(cat /kernel-version.txt) kernel-devel-$(cat /kernel-version.txt) \
|
||||||
|
python3 python3-devel python3-setuptools python3-cffi libffi-devel git ncompress libcurl-devel
|
||||||
|
WORKDIR /
|
||||||
|
# Uses project_id from: https://release-monitoring.org/project/11706/
|
||||||
|
RUN curl "https://release-monitoring.org/api/v2/versions/?project_id=11706" | jq --raw-output '.stable_versions[0]' >> /zfs_version.txt
|
||||||
|
RUN curl -L -O https://github.com/openzfs/zfs/releases/download/zfs-$(cat /zfs_version.txt)/zfs-$(cat /zfs_version.txt).tar.gz && \
|
||||||
|
tar xzf zfs-$(cat /zfs_version.txt).tar.gz && mv zfs-$(cat /zfs_version.txt) zfs
|
||||||
|
WORKDIR /zfs
|
||||||
|
RUN ./configure -with-linux=/usr/src/kernels/$(cat /kernel-version.txt)/ -with-linux-obj=/usr/src/kernels/$(cat /kernel-version.txt)/ \
|
||||||
|
&& make -j1 rpm-utils rpm-kmod
|
||||||
|
|
||||||
|
|
||||||
|
### 3. SOURCE IMAGE
|
||||||
## this is a standard Containerfile FROM using the build ARGs above to select the right upstream image
|
## this is a standard Containerfile FROM using the build ARGs above to select the right upstream image
|
||||||
FROM ghcr.io/ublue-os/${SOURCE_IMAGE}${SOURCE_SUFFIX}:${SOURCE_TAG}
|
FROM ghcr.io/ublue-os/${SOURCE_IMAGE}${SOURCE_SUFFIX}:${SOURCE_TAG}
|
||||||
|
|
||||||
### 2.1 Add ZFS RPMS and matching kernel RPMs
|
### 4 Add ZFS RPMS and matching kernel RPMs
|
||||||
COPY --from=ghcr.io/0ranki/sb-zfs-kernel /rpms/ /tmp/rpms
|
#COPY --from=ghcr.io/0ranki/sb-zfs-kernel /rpms/ /tmp/rpms
|
||||||
COPY --from=ghcr.io/0ranki/sb-zfs-kernel /kernel/ /tmp/rpms
|
COPY --from=builder /zfs/*.rpm /zfs/
|
||||||
|
|
||||||
|
### 5. MODIFICATIONS
|
||||||
### 3. MODIFICATIONS
|
|
||||||
## make modifications desired in your image and install packages by modifying the build.sh script
|
## make modifications desired in your image and install packages by modifying the build.sh script
|
||||||
## the following RUN directive does all the things required to run "build.sh" as recommended.
|
## the following RUN directive does all the things required to run "build.sh" as recommended.
|
||||||
|
|
||||||
|
|
35
build.sh
35
build.sh
|
@ -4,19 +4,6 @@ set -ouex pipefail
|
||||||
|
|
||||||
RELEASE="$(rpm -E %fedora)"
|
RELEASE="$(rpm -E %fedora)"
|
||||||
|
|
||||||
ZFS_KERNEL_VERSION="$(find /tmp/rpms/kmods/zfs/ -name "kmod-zfs*.rpm" ! -name "*devel*" | sed 's/.*\/kmod-zfs-//; s/\.fc.*$//g' | head -1)"
|
|
||||||
|
|
||||||
cat < EOF >> /etc/yum.repos.d/local.repo
|
|
||||||
name=Local override packages
|
|
||||||
baseurl=file:///tmp/rpms
|
|
||||||
enabled=1
|
|
||||||
gpgcheck=0
|
|
||||||
protect=1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
rpm-ostree install createrepo
|
|
||||||
createrepo /tmp/rpms
|
|
||||||
|
|
||||||
### Install packages
|
### Install packages
|
||||||
|
|
||||||
# Packages can be installed from any enabled yum repo on the image.
|
# Packages can be installed from any enabled yum repo on the image.
|
||||||
|
@ -24,19 +11,15 @@ createrepo /tmp/rpms
|
||||||
# List of rpmfusion packages can be found here:
|
# List of rpmfusion packages can be found here:
|
||||||
# https://mirrors.rpmfusion.org/mirrorlist?path=free/fedora/updates/39/x86_64/repoview/index.html&protocol=https&redirect=1
|
# https://mirrors.rpmfusion.org/mirrorlist?path=free/fedora/updates/39/x86_64/repoview/index.html&protocol=https&redirect=1
|
||||||
|
|
||||||
# this installs a package from fedora repos
|
rpm-ostree install \
|
||||||
#rpm-ostree override remove kernel kernel-core kernel-modules kernel-modules-extra --replace /tmp/kernel/kernel*.rpm
|
/zfs/*.$(rpm -qa kernel --queryformat '%{ARCH}').rpm && \
|
||||||
#rpm-ostree override install /tmp/ker/kernel*.rpm --uninstall kernel kernel-core kernel-modules kernel-modules-extra
|
# Auto-load ZFS module
|
||||||
|
depmod -a "$(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" && \
|
||||||
rpm-ostree override remove kernel kernel-core kernel-modules kernel-modules-core kernel-modules-extra zfs-fuse --install kernel-${ZFS_KERNEL_VERSION} zfs
|
echo "zfs" > /etc/modules-load.d/zfs.conf && \
|
||||||
|
# we don't want any files on /var
|
||||||
|
rm -rf /var/lib/pcp
|
||||||
|
|
||||||
#rpm-ostree override remove zfs-fuse --install /tmp/rpms/kmods/zfs/*.rpm
|
|
||||||
|
|
||||||
# this would install a package from rpmfusion
|
|
||||||
# rpm-ostree install vlc
|
|
||||||
|
|
||||||
#### Example for enabling a System Unit File
|
#### Example for enabling a System Unit File
|
||||||
|
|
||||||
#systemctl enable podman.socket
|
## Just in case, according to https://openzfs.github.io/openzfs-docs/Getting%20Started/Fedora/index.html#installation
|
||||||
|
echo 'zfs' > /etc/dnf/protected.d/zfs.conf
|
||||||
|
|
Loading…
Reference in New Issue