Skip to content

Commit

Permalink
fix: everything asus and surface (ublue-os#73)
Browse files Browse the repository at this point in the history
Co-authored-by: RJ Trujillo <eyecantcu@pm.me>
  • Loading branch information
bsherman and EyeCantCU authored Sep 26, 2023
1 parent 96f54e5 commit 70af399
Show file tree
Hide file tree
Showing 18 changed files with 65 additions and 36 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ jobs:
nvidia_version: 535
- cfile_suffix: nvidia
nvidia_version: 0
- kernel_flavor: asus
major_version: 37
- kernel_flavor: surface
major_version: 37
- kernel_flavor: surface
major_version: 39
- kernel_flavor: surface
nvidia_version: 470
steps:
# Checkout push-to-registry action GitHub repository
- name: Checkout Push to Registry action
Expand Down
27 changes: 16 additions & 11 deletions Containerfile.common
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,23 @@ RUN /tmp/build-prep.sh

RUN /tmp/build-ublue-os-akmods-addons.sh

RUN /tmp/build-kmod-gasket.sh
RUN /tmp/build-kmod-gcadapter_oc.sh
RUN /tmp/build-kmod-nct6687d.sh
RUN /tmp/build-kmod-openrazer.sh
RUN /tmp/build-kmod-openrgb.sh
RUN /tmp/build-kmod-ryzen-smu.sh
RUN /tmp/build-kmod-steamdeck.sh
RUN /tmp/build-kmod-v4l2loopback.sh
RUN /tmp/build-kmod-wl.sh

# Set kernel name
# Exclude negativo17 kmods from Fedora 39
RUN if grep -qv "39" <<< ${FEDORA_MAJOR_VERSION}; then \
RUN if grep -qv "surface" <<< "${KERNEL_FLAVOR}"; then \
export KERNEL_NAME="kernel" \
; else \
export KERNEL_NAME="kernel-surface" \
; fi && \
/tmp/build-kmod-gasket.sh && \
/tmp/build-kmod-gcadapter_oc.sh && \
/tmp/build-kmod-nct6687d.sh && \
/tmp/build-kmod-openrazer.sh && \
/tmp/build-kmod-openrgb.sh && \
/tmp/build-kmod-ryzen-smu.sh && \
/tmp/build-kmod-steamdeck.sh && \
/tmp/build-kmod-v4l2loopback.sh && \
/tmp/build-kmod-wl.sh && \
if grep -qv "39" <<< ${FEDORA_MAJOR_VERSION}; then \
/tmp/build-kmod-evdi.sh && \
/tmp/build-kmod-xpadneo.sh && \
/tmp/build-kmod-xpad-noone.sh && \
Expand Down
7 changes: 6 additions & 1 deletion Containerfile.nvidia
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ RUN /tmp/build-prep.sh

RUN /tmp/build-ublue-os-nvidia-addons.sh

RUN /tmp/build-kmod-nvidia.sh ${NVIDIA_MAJOR_VERSION}
RUN if grep -qv "surface" <<< "${KERNEL_FLAVOR}"; then \
export KERNEL_NAME="kernel" \
; else \
export KERNEL_NAME="kernel-surface" \
; fi && \
/tmp/build-kmod-nvidia.sh ${NVIDIA_MAJOR_VERSION}

RUN cp /tmp/ublue-os-nvidia-addons/rpmbuild/RPMS/noarch/ublue-os-nvidia-addons*.rpm \
/var/cache/rpms/ublue-os/
Expand Down
2 changes: 1 addition & 1 deletion build-kmod-evdi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -oeux pipefail
cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/negativo17-fedora-multimedia.repo /etc/yum.repos.d/

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


Expand Down
2 changes: 1 addition & 1 deletion build-kmod-gasket.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -oeux pipefail
cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/

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

rpm-ostree install \
Expand Down
2 changes: 1 addition & 1 deletion build-kmod-gcadapter_oc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -oeux pipefail
cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/

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

rpm-ostree install \
Expand Down
2 changes: 1 addition & 1 deletion build-kmod-nct6687d.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -oeux pipefail
cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/

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


Expand Down
2 changes: 1 addition & 1 deletion build-kmod-nvidia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ rpm-ostree install \
xorg-x11-drv-${NVIDIA_PACKAGE_NAME}-{,cuda,devel,kmodsrc,power}*:${NVIDIA_MAJOR_VERSION}.*.fc${RELEASE}

# Either successfully build and install the kernel modules, or fail early with debug output
KERNEL_VERSION="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')"
KERNEL_VERSION="$(rpm -q "${KERNEL_NAME}" --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')"
NVIDIA_AKMOD_VERSION="$(basename "$(rpm -q "akmod-${NVIDIA_PACKAGE_NAME}" --queryformat '%{VERSION}-%{RELEASE}')" ".fc${RELEASE%%.*}")"
NVIDIA_LIB_VERSION="$(basename "$(rpm -q "xorg-x11-drv-${NVIDIA_PACKAGE_NAME}" --queryformat '%{VERSION}-%{RELEASE}')" ".fc${RELEASE%%.*}")"
NVIDIA_FULL_VERSION="$(rpm -q "xorg-x11-drv-${NVIDIA_PACKAGE_NAME}" --queryformat '%{EPOCH}:%{VERSION}-%{RELEASE}.%{ARCH}')"
Expand Down
2 changes: 1 addition & 1 deletion build-kmod-openrazer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -oeux pipefail
cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/

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


Expand Down
2 changes: 1 addition & 1 deletion build-kmod-openrgb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -oeux pipefail
cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/

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

rpm-ostree install \
Expand Down
2 changes: 1 addition & 1 deletion build-kmod-ryzen-smu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -oeux pipefail
cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/

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


Expand Down
2 changes: 1 addition & 1 deletion build-kmod-steamdeck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -oeux pipefail
cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/

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

rpm-ostree install \
Expand Down
2 changes: 1 addition & 1 deletion build-kmod-v4l2loopback.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -oeux pipefail


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


Expand Down
2 changes: 1 addition & 1 deletion build-kmod-wl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -oeux pipefail


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


Expand Down
2 changes: 1 addition & 1 deletion build-kmod-xone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -oeux pipefail
cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/negativo17-fedora-steam.repo /etc/yum.repos.d/

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


Expand Down
2 changes: 1 addition & 1 deletion build-kmod-xpad-noone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -oeux pipefail
cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/_copr_ublue-os-akmods.repo /etc/yum.repos.d/

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


Expand Down
2 changes: 1 addition & 1 deletion build-kmod-xpadneo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -oeux pipefail
cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/negativo17-fedora-steam.repo /etc/yum.repos.d/

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


Expand Down
31 changes: 21 additions & 10 deletions build-prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ fi
mkdir -p /var/lib/alternatives

# allow simple `dnf install` style commands to work (in some spec scripts)
ln -s /usr/bin/rpm-ostree /usr/bin/dnf
if [[ "${RELEASE}" -eq "37" ]]; then
ln -s /usr/bin/rpm-ostree /usr/bin/dnf
fi

# enable more repos
rpm-ostree install \
Expand All @@ -37,28 +39,37 @@ fi

### PREPARE CUSTOM KERNEL SUPPORT
if [[ "asus" == "${KERNEL_FLAVOR}" ]]; then
echo "Installing ASUS Kernel:" && \
rpm-ostree cliwrap install-to-root / && \
echo "Installing ASUS Kernel:"
wget https://copr.fedorainfracloud.org/coprs/lukenukem/asus-kernel/repo/fedora-$(rpm -E %fedora)/lukenukem-asus-kernel-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_lukenukem-asus-kernel.repo
rpm-ostree cliwrap install-to-root /
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:lukenukem:asus-kernel \
kernel \
kernel-core \
kernel-devel \
kernel-devel-matched \
kernel-modules \
kernel-modules-core \
kernel-modules-extra \
kernel-uki-virt
kernel-modules-extra
elif [[ "surface" == "${KERNEL_FLAVOR}" ]]; then
echo "Installing Surface Kernel:" && \
echo "Installing Surface Kernel:"
# Add Linux Surface repo
wget https://pkg.surfacelinux.com/fedora/linux-surface.repo -P /etc/yum.repos.d
wget https://github.com/linux-surface/linux-surface/releases/download/silverblue-20201215-1/kernel-20201215-1.x86_64.rpm -O \
/tmp/surface-kernel.rpm && \
rpm-ostree cliwrap install-to-root / && \
/tmp/surface-kernel.rpm
rpm-ostree cliwrap install-to-root /
rpm-ostree override replace /tmp/surface-kernel.rpm \
--remove kernel-core \
--remove kernel-devel-matched \
--remove kernel-modules \
--remove kernel-modules-extra \
--install kernel-surface
--install kernel-surface \
--install kernel-surface-core \
--install kernel-surface-devel \
--install kernel-surface-devel-matched \
--install kernel-surface-modules \
--install kernel-surface-modules-core \
--install kernel-surface-modules-extra
else
echo "Default main kernel needs no customization."
fi
Expand Down

0 comments on commit 70af399

Please sign in to comment.