Skip to content

Commit

Permalink
feat: ZFS for coreos, GTS version coreos (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2Giles authored Jun 28, 2024
1 parent 4c124d8 commit cbf9ff7
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 5 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:
jobs:
build_ublue:
name: akmods
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04 # Work Around Tar Bug
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -165,7 +165,14 @@ jobs:
linux=$($dnf repoquery --repoid linux-surface --whatprovides kernel-surface | tail -n1 | sed 's/.*://')
;;
"coreos")
linux=$(skopeo inspect docker://quay.io/fedora/fedora-coreos:stable | jq -r '.Labels["ostree.linux"] | split(".x86_64")[0]')
coreos_kernel_release=$(skopeo inspect docker://quay.io/fedora/fedora-coreos:stable | jq -r '.Labels["ostree.linux"] | split(".x86_64")[0]')
coreos_fedora_version=$(echo $coreos_kernel_release | grep -oP 'fc\K[0-9]+')
if [[ "${{ matrix.fedora_version }}" == "$coreos_fedora_version" ]]; then
linux="${coreos_kernel_release}"
elif [[ "$(( "${coreos_fedora_version}" - 1 ))" == ${{ matrix.fedora_version }} ]]; then
major_minor_patch=$(echo "$coreos_kernel_release" | cut -d '-' -f 1)
linux="${major_minor_patch}-200.fc$(($coreos_fedora_version - 1))"
fi
;;
*)
echo "unexpected kernel_flavor '${{ matrix.kernel_flavor }}' for dnf repoquery"
Expand Down
7 changes: 6 additions & 1 deletion Containerfile.common
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ RUN if grep -qv "surface" <<< "${KERNEL_FLAVOR}"; then \
/tmp/build-kmod-v4l2loopback.sh && \
/tmp/build-kmod-wl.sh && \
/tmp/build-kmod-xpadneo.sh && \
/tmp/build-kmod-xone.sh
/tmp/build-kmod-xone.sh && \
if grep -q "coreos" <<< "${KERNEL_FLAVOR}"; then \
curl -Lo /tmp/zfs-minor-version "https://raw.githubusercontent.com/ublue-os/ucore-kmods/main/Containerfile" && \
zfs_minor_version=$(grep "ZFS_MINOR_VERSION" /tmp/zfs-minor-version | cut -d "-" -f 2 | cut -d \} -f 1) && \
ZFS_MINOR_VERSION="$zfs_minor_version" /tmp/build-kmod-zfs.sh \
; fi

RUN cp /tmp/ublue-os-akmods-addons/rpmbuild/RPMS/noarch/ublue-os-akmods-addons*.rpm \
/var/cache/rpms/ublue-os/
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Feel free to PR more kmod build scripts into this repo!
| [xpadneo](https://github.com/atar-axis/xpadneo) | common | xbox one controller bluetooth driver | [negativo17 - fedora-multimedia](https://negativo17.org/) |
| [xone](https://github.com/BoukeHaarsma23/xonedo/) | common | xbox one controller USB wired/RF driver modified to work along-side xpad | [![badge](https://copr.fedorainfracloud.org/coprs/ublue-os/akmods/package/xone-kmod/status_image/last_build.png)](https://copr.fedorainfracloud.org/coprs/ublue-os/akmods/package/xone-kmod) |
| [zenergy](https://github.com/BoukeHaarsma23/zenergy) | extra | Based on AMD_ENERGY driver, but with some jiffies added so non-root users can read it safely | [![badge](https://copr.fedorainfracloud.org/coprs/ublue-os/akmods/package/zenergy-kmod/status_image/last_build.png)](https://copr.fedorainfracloud.org/coprs/ublue-os/akmods/package/zenergy-kmod) |
| [zfs](https://github.com/openzfs/zfs) | common | OpenZFS advanced file system and volume manager (From Ucore, CoreOS Only) |

## Notes

Expand Down
51 changes: 51 additions & 0 deletions build-kmod-zfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/bash

set -oeux pipefail


ARCH="$(rpm -E '%_arch')"
KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')"
RELEASE="$(rpm -E '%fedora')"

# allow pinning to a specific release series (eg, 2.0.x or 2.1.x)
ZFS_MINOR_VERSION="${ZFS_MINOR_VERSION:-}"

cd /tmp

# Use cURL to fetch the given URL, saving the response to `data.json`
curl "https://api.github.com/repos/openzfs/zfs/releases" -o data.json
ZFS_VERSION=$(jq -r --arg ZMV "zfs-${ZFS_MINOR_VERSION}" '[ .[] | select(.prerelease==false and .draft==false) | select(.tag_name | startswith($ZMV))][0].tag_name' data.json|cut -f2- -d-)
echo "ZFS_VERSION==$ZFS_VERSION"


### zfs specific build deps
rpm-ostree install libtirpc-devel libblkid-devel libuuid-devel libudev-devel openssl-devel libaio-devel libattr-devel elfutils-libelf-devel python3-devel libffi-devel libcurl-devel ncompress


### BUILD zfs
echo "getting zfs-${ZFS_VERSION}.tar.gz"
curl -L -O https://github.com/openzfs/zfs/releases/download/zfs-${ZFS_VERSION}/zfs-${ZFS_VERSION}.tar.gz
# no-same-owner/no-same-permissions required for F40 based images building on podman 3.4.4 (ubuntu 22.04)
tar -z -x --no-same-owner --no-same-permissions -f zfs-${ZFS_VERSION}.tar.gz

# patch the zfs-kmod.spec.in file for older zfs versions
ZFS_MAJ=$(echo $ZFS_VERSION | cut -f1 -d.)
ZFS_MIN=$(echo $ZFS_VERSION | cut -f2 -d.)
ZFS_PATCH=$(echo $ZFS_VERSION | cut -f3 -d.)

cd /tmp/zfs-${ZFS_VERSION}
./configure \
-with-linux=/usr/src/kernels/${KERNEL}/ \
-with-linux-obj=/usr/src/kernels/${KERNEL}/ \
&& make -j $(nproc) rpm-utils rpm-kmod \
|| (cat config.log && exit 1)


# create a directory for later copying of resulting zfs specific artifacts
mkdir -p /var/cache/rpms/kmods/zfs/{debug,devel,other,src} \
&& mv *src.rpm /var/cache/rpms/kmods/zfs/src/ \
&& mv *devel*.rpm /var/cache/rpms/kmods/zfs/devel/ \
&& mv *debug*.rpm /var/cache/rpms/kmods/zfs/debug/ \
&& mv zfs-dracut*.rpm /var/cache/rpms/kmods/zfs/other/ \
&& mv zfs-test*.rpm /var/cache/rpms/kmods/zfs/other/ \
&& mv *.rpm /var/cache/rpms/kmods/zfs/
13 changes: 11 additions & 2 deletions build-prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,17 @@ elif [[ "coreos" == "${KERNEL_FLAVOR}" ]] && \
https://kojipkgs.fedoraproject.org//packages/kernel/$KERNEL_MAJOR_MINOR_PATCH/$KERNEL_RELEASE/x86_64/kernel-core-$KERNEL_MAJOR_MINOR_PATCH-$KERNEL_RELEASE.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/kernel/$KERNEL_MAJOR_MINOR_PATCH/$KERNEL_RELEASE/x86_64/kernel-modules-$KERNEL_MAJOR_MINOR_PATCH-$KERNEL_RELEASE.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/kernel/$KERNEL_MAJOR_MINOR_PATCH/$KERNEL_RELEASE/x86_64/kernel-modules-core-$KERNEL_MAJOR_MINOR_PATCH-$KERNEL_RELEASE.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/kernel/$KERNEL_MAJOR_MINOR_PATCH/$KERNEL_RELEASE/x86_64/kernel-modules-extra-$KERNEL_MAJOR_MINOR_PATCH-$KERNEL_RELEASE.x86_64.rpm
https://kojipkgs.fedoraproject.org//packages/kernel/$KERNEL_MAJOR_MINOR_PATCH/$KERNEL_RELEASE/x86_64/kernel-modules-extra-$KERNEL_MAJOR_MINOR_PATCH-$KERNEL_RELEASE.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/kernel/$KERNEL_MAJOR_MINOR_PATCH/$KERNEL_RELEASE/x86_64/kernel-devel-$KERNEL_MAJOR_MINOR_PATCH-$KERNEL_RELEASE.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/kernel/$KERNEL_MAJOR_MINOR_PATCH/$KERNEL_RELEASE/x86_64/kernel-devel-matched-$KERNEL_MAJOR_MINOR_PATCH-$KERNEL_RELEASE.x86_64.rpm && \
rpm-ostree install \
autoconf \
automake \
dkms \
git \
libtool \
ncompress \
dnf
elif [[ "main" == "${KERNEL_FLAVOR}" ]] && \
[[ "" != "${KERNEL_VERSION}" ]]; then
echo "main kernel version ${KERNEL_VERSION} to avoid upgrading kernel beyond what is in the image."
Expand All @@ -132,7 +142,6 @@ else
kernel-devel-matched
fi


### PREPARE BUILD ENV
rpm-ostree install \
akmods \
Expand Down

0 comments on commit cbf9ff7

Please sign in to comment.