diff --git a/Containerfile b/Containerfile index 340bad80072..2d1edcf6b50 100644 --- a/Containerfile +++ b/Containerfile @@ -31,7 +31,8 @@ COPY --from=ghcr.io/ublue-os/bluefin-cli /usr/share/bash-prexec /usr/share/bash- COPY --from=ghcr.io/ublue-os/akmods:${AKMODS_FLAVOR}-${FEDORA_MAJOR_VERSION} /rpms /tmp/akmods-rpms # Build, cleanup, commit. -RUN bash -c ". /tmp/build/build-base.sh" && \ +RUN rpm-ostree cliwrap install-to-root / && \ + bash -c ". /tmp/build/build-base.sh" && \ rm -rf /tmp/* /var/* && \ mkdir -p /var/tmp && \ chmod -R 1777 /var/tmp && \ diff --git a/build_files/base/branding.sh b/build_files/base/branding.sh index 2c2d2a00b0d..4d464a4712d 100644 --- a/build_files/base/branding.sh +++ b/build_files/base/branding.sh @@ -2,6 +2,8 @@ set -oue pipefail + +# Branding for Bluefin/Aurora if test "$BASE_IMAGE_NAME" = "silverblue"; then sed -i '/^PRETTY_NAME/s/Silverblue/Bluefin/' /usr/lib/os-release elif test "$BASE_IMAGE_NAME" = "kinoite"; then @@ -9,4 +11,7 @@ elif test "$BASE_IMAGE_NAME" = "kinoite"; then sed -i 's/Bluefin/Aurora/g' /usr/etc/yafti.yml sed -i 's/Aurora (Beta)/Aurora \- Bluefin\-KDE (Alpha)/' /usr/etc/yafti.yml sed -i 's/Bluefin/Aurora/' /usr/libexec/ublue-flatpak-manager -fi \ No newline at end of file +fi + +# Watermark for Plymouth +cp /usr/share/plymouth/themes/spinner/{"$BASE_IMAGE_NAME"-,}watermark.png \ No newline at end of file diff --git a/build_files/base/build-base.sh b/build_files/base/build-base.sh index 68fb9e7d0e0..556e7adff98 100644 --- a/build_files/base/build-base.sh +++ b/build_files/base/build-base.sh @@ -1,4 +1,5 @@ #!/usr/bin/bash +# shellcheck disable=SC1091 set -oue pipefail @@ -7,7 +8,6 @@ set -oue pipefail . /tmp/build/install-akmods.sh . /tmp/build/packages.sh . /tmp/build/fetch-install.sh -rpm-ostree install ublue-update . /tmp/build/image-info.sh . /tmp/build/fetch-quadlets.sh . /tmp/build/font-install.sh @@ -15,4 +15,5 @@ rpm-ostree install ublue-update . /tmp/build/systemd.sh . /tmp/build/aurora-changes.sh . /tmp/build/branding.sh +. /tmp/build/initramfs.sh . /tmp/build/cleanup.sh \ No newline at end of file diff --git a/build_files/base/cleanup.sh b/build_files/base/cleanup.sh index cc806ece6d7..e96cd33e780 100644 --- a/build_files/base/cleanup.sh +++ b/build_files/base/cleanup.sh @@ -2,10 +2,6 @@ set -ouex pipefail -if [[ "${IMAGE_FLAVOR}" =~ "nvidia" ]]; then - rm /usr/lib/modprobe.d/nvidia.conf -fi - rm -f /etc/yum.repos.d/tailscale.repo rm -f /etc/yum.repos.d/charm.repo rm -f /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo diff --git a/build_files/base/fetch-install.sh b/build_files/base/fetch-install.sh index 3a34f55550c..6d10d0acbf0 100644 --- a/build_files/base/fetch-install.sh +++ b/build_files/base/fetch-install.sh @@ -6,6 +6,7 @@ set -oue pipefail curl -Lo /tmp/starship.tar.gz "https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz" tar -xzf /tmp/starship.tar.gz -C /tmp install -c -m 0755 /tmp/starship /usr/bin +# shellcheck disable=SC2016 echo 'eval "$(starship init bash)"' >> /etc/bashrc # Brew Install Script @@ -17,4 +18,7 @@ mkdir -p /usr/etc/flatpak/remotes.d wget -q https://dl.flathub.org/repo/flathub.flatpakrepo -P /usr/etc/flatpak/remotes.d # Topgrade Install -pip install --prefix=/usr topgrade \ No newline at end of file +pip install --prefix=/usr topgrade + +# Install ublue-update -- breaks with packages.json +rpm-ostree install ublue-update \ No newline at end of file diff --git a/build_files/dx/build-dx.sh b/build_files/dx/build-dx.sh index 92950c85484..70354f6583b 100644 --- a/build_files/dx/build-dx.sh +++ b/build_files/dx/build-dx.sh @@ -1,4 +1,5 @@ #!/usr/bin/bash +# shellcheck disable=SC1091 set -oue pipefail diff --git a/build_files/shared/initramfs.sh b/build_files/shared/initramfs.sh new file mode 100755 index 00000000000..f0412ad23af --- /dev/null +++ b/build_files/shared/initramfs.sh @@ -0,0 +1,21 @@ +#!/usr/bin/bash + +set -oue pipefail + +# Remove nvidia specific files +if [[ "${IMAGE_FLAVOR}" =~ "nvidia" ]]; then + rm /usr/lib/modprobe.d/nvk.conf + rm /usr/lib/modprobe.d/amd-legacy.conf +else + rm /usr/lib/dracut/dracut.conf.d/95-nvidia.conf + rm /usr/lib/modprobe.d/nvidia.conf +fi + +if [[ "${AKMODS_FLAVOR}" == "surface" ]]; then + KERNEL_SUFFIX="surface" +else + KERNEL_SUFFIX="" +fi + +QUALIFIED_KERNEL="$(rpm -qa | grep -P 'kernel-(|'"$KERNEL_SUFFIX"'-)(\d+\.\d+\.\d+)' | sed -E 's/kernel-(|'"$KERNEL_SUFFIX"'-)//')" +/usr/libexec/rpm-ostree/wrapped/dracut --no-hostonly --kver "$QUALIFIED_KERNEL" --reproducible -v --add ostree -f "/lib/modules/$QUALIFIED_KERNEL/initramfs.img" \ No newline at end of file diff --git a/system_files/shared/usr/lib/dracut/dracut.conf.d/10-compression.conf b/system_files/shared/usr/lib/dracut/dracut.conf.d/10-compression.conf new file mode 100644 index 00000000000..bb323f7f6dc --- /dev/null +++ b/system_files/shared/usr/lib/dracut/dracut.conf.d/10-compression.conf @@ -0,0 +1 @@ +compress="zstd" \ No newline at end of file diff --git a/system_files/shared/usr/lib/dracut/dracut.conf.d/90-ublue.conf b/system_files/shared/usr/lib/dracut/dracut.conf.d/90-ublue.conf new file mode 100644 index 00000000000..c1666eab541 --- /dev/null +++ b/system_files/shared/usr/lib/dracut/dracut.conf.d/90-ublue.conf @@ -0,0 +1 @@ +add_dracutmodules+=" fido2 tpm2-tss pkcs11 pcsc " diff --git a/system_files/shared/usr/lib/dracut/dracut.conf.d/95-nvidia.conf b/system_files/shared/usr/lib/dracut/dracut.conf.d/95-nvidia.conf new file mode 100644 index 00000000000..62880a58da8 --- /dev/null +++ b/system_files/shared/usr/lib/dracut/dracut.conf.d/95-nvidia.conf @@ -0,0 +1 @@ +force_drivers+=" nvidia nvidia_modeset nvidia_uvm nvidia_drm " \ No newline at end of file diff --git a/system_files/shared/usr/lib/modprobe.d/amd-legacy.conf b/system_files/shared/usr/lib/modprobe.d/amd-legacy.conf new file mode 100644 index 00000000000..8ede3a09d8d --- /dev/null +++ b/system_files/shared/usr/lib/modprobe.d/amd-legacy.conf @@ -0,0 +1,6 @@ +# Enable Legacy AMD hardware support +options amdgpu si_support=1 +options amdgpu cik_support=1 + +options radeon si_support=0 +options radeon cik_support=0 \ No newline at end of file diff --git a/system_files/shared/usr/lib/modprobe.d/nvidia.conf b/system_files/shared/usr/lib/modprobe.d/nvidia.conf index eea3f81798b..2335d81a370 100644 --- a/system_files/shared/usr/lib/modprobe.d/nvidia.conf +++ b/system_files/shared/usr/lib/modprobe.d/nvidia.conf @@ -1,2 +1,6 @@ -# Enable GSP firmware -options nouveau config=NvGspRm=1 +# Blacklist Nouveau +blacklist nouveau +options nouveau modeset=0 + +# Enable Nvidia Modeset +options nvidia-drm modeset=1 diff --git a/system_files/shared/usr/lib/modprobe.d/nvk.conf b/system_files/shared/usr/lib/modprobe.d/nvk.conf new file mode 100644 index 00000000000..957b329a2ac --- /dev/null +++ b/system_files/shared/usr/lib/modprobe.d/nvk.conf @@ -0,0 +1,2 @@ +# Enable GSP firmware +options nouveau config=NvGspRm=1 \ No newline at end of file diff --git a/system_files/shared/usr/libexec/ublue-system-setup b/system_files/shared/usr/libexec/ublue-system-setup index 4e97b7ba18f..5a470cb1101 100755 --- a/system_files/shared/usr/libexec/ublue-system-setup +++ b/system_files/shared/usr/libexec/ublue-system-setup @@ -16,60 +16,13 @@ KNOWN_IMAGE_FLAVOR_FILE="/etc/ublue/image_flavor" KNOWN_IMAGE_FLAVOR=$(cat $KNOWN_IMAGE_FLAVOR_FILE) # GLOBAL -SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)" -GPU_ID=$(lspci -k | grep -A 3 -E "(VGA|3D)") KARGS=$(rpm-ostree kargs) NEEDED_KARGS="" echo "Current kargs: $KARGS" mkdir -p /etc/ublue -if grep -qz "Kernel driver in use: radeon" <<< $GPU_ID; then - echo "Legacy AMD hardware detected, enabling CIK and SI support in AMDGPU" - if [[ ! $KARGS =~ "radeon.si_support" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --append=radeon.si_support=0" - fi - - if [[ ! $KARGS =~ "radeon.cik_support" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --append=radeon.cik_support=0" - fi - - if [[ ! $KARGS =~ "amdgpu.si_support" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --append=amdgpu.si_support=1" - fi - - if [[ ! $KARGS =~ "amdgpu.cik_support" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --append=amdgpu.cik_support=1" - fi -fi - -if [[ $IMAGE_FLAVOR = "nvidia" ]]; then - echo "Checking for needed karg changes (Nvidia)" - - if [[ ! $KARGS =~ "rd.driver.blacklist" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --append=rd.driver.blacklist=nouveau" - fi - - if [[ ! $KARGS =~ "modprobe.blacklist" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --append=modprobe.blacklist=nouveau" - fi - - if [[ ! $KARGS =~ "nvidia-drm.modeset" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --append=nvidia-drm.modeset=1" - fi -else - echo "Checking for needed karg changes" - - if [[ $KARGS =~ "rd.driver.blacklist=nouveau" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --delete-if-present=rd.driver.blacklist=nouveau" - fi - - if [[ $KARGS =~ "modprobe.blacklist=nouveau" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --delete-if-present=modprobe.blacklist=nouveau" - fi - - if [[ $KARGS =~ "nvidia-drm.modeset" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --delete-if-present=nvidia-drm.modeset=1" - fi +if [[ "$IMAGE_FLAVOR" =~ "nvidia" && ! "$KARGS" =~ "initcall_blacklist=simpledrm_platform_driver_init" ]]; then + NEEDED_KARGS="$NEEDED_KARGS --append=initcall_blacklist=simpledrm_platform_driver_init" fi if [[ $KARGS =~ "nomodeset" ]]; then @@ -84,22 +37,22 @@ fi if [[ -n "$NEEDED_KARGS" ]]; then echo "Found needed karg changes, applying the following: $NEEDED_KARGS" plymouth display-message --text="Updating kargs - Please wait, this may take a while" || true - rpm-ostree kargs ${NEEDED_KARGS} --reboot || exit 1 + rpm-ostree kargs "${NEEDED_KARGS}" --reboot || exit 1 else echo "No karg changes needed" fi # Run script if updated -if [[ -f $HWS_VER_FILE && $HWS_VER = $HWS_VER_RAN ]]; then - if [[ -f $KNOWN_IMAGE_NAME_FILE && -f $KNOWN_IMAGE_FLAVOR_FILE ]]; then +if [[ -f "$HWS_VER_FILE" && "$HWS_VER" = "$HWS_VER_RAN" ]]; then + if [[ -f "$KNOWN_IMAGE_NAME_FILE" && -f "$KNOWN_IMAGE_FLAVOR_FILE" ]]; then # Run script if image has been rebased - if [[ $IMAGE_NAME = $KNOWN_IMAGE_NAME && $IMAGE_FLAVOR = $KNOWN_IMAGE_FLAVOR ]]; then + if [[ "$IMAGE_NAME" = "$KNOWN_IMAGE_NAME" && "$IMAGE_FLAVOR" = "$KNOWN_IMAGE_FLAVOR" ]]; then echo "Hardware setup has already run. Exiting..." exit 0 fi fi fi -echo $HWS_VER > $HWS_VER_FILE -echo $IMAGE_NAME > $KNOWN_IMAGE_NAME_FILE -echo $IMAGE_FLAVOR > $KNOWN_IMAGE_FLAVOR_FILE +echo "$HWS_VER" > $HWS_VER_FILE +echo "$IMAGE_NAME" > $KNOWN_IMAGE_NAME_FILE +echo "$IMAGE_FLAVOR" > $KNOWN_IMAGE_FLAVOR_FILE diff --git a/system_files/shared/usr/share/plymouth/themes/spinner/kinoite-watermark.png b/system_files/shared/usr/share/plymouth/themes/spinner/kinoite-watermark.png new file mode 100644 index 00000000000..b825f01f74a Binary files /dev/null and b/system_files/shared/usr/share/plymouth/themes/spinner/kinoite-watermark.png differ diff --git a/system_files/shared/usr/share/plymouth/themes/spinner/silverblue-watermark.png b/system_files/shared/usr/share/plymouth/themes/spinner/silverblue-watermark.png new file mode 100644 index 00000000000..621971309ee Binary files /dev/null and b/system_files/shared/usr/share/plymouth/themes/spinner/silverblue-watermark.png differ