From 5605958b98831369e4c0b950e5c44f70c4191628 Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Mon, 27 Nov 2023 23:31:26 +1100 Subject: Fixes #2262 and GFX rewrite (#2266) * Rework GFX installation * Update * Update --------- Co-authored-by: Daniel Girtler --- archinstall/lib/profile/profiles_handler.py | 52 +++++++++++------------------ 1 file changed, 19 insertions(+), 33 deletions(-) (limited to 'archinstall/lib/profile') diff --git a/archinstall/lib/profile/profiles_handler.py b/archinstall/lib/profile/profiles_handler.py index 66d4b8cb..12dcee3f 100644 --- a/archinstall/lib/profile/profiles_handler.py +++ b/archinstall/lib/profile/profiles_handler.py @@ -12,10 +12,10 @@ from typing import List, TYPE_CHECKING, Any, Optional, Dict, Union from archinstall.default_profiles.profile import Profile, TProfile, GreeterType from .profile_model import ProfileConfiguration -from ..hardware import GfxDriver, GfxPackage +from ..hardware import GfxDriver from ..menu import MenuSelectionType, Menu, MenuSelection from ..networking import list_interfaces, fetch_data_from_url -from ..output import error, debug, info, warn +from ..output import error, debug, info from ..storage import storage if TYPE_CHECKING: @@ -206,38 +206,24 @@ class ProfileHandler: with open(path, 'w') as file: file.write(filedata) - def install_gfx_driver(self, install_session: 'Installer', driver: Optional[GfxDriver]): - try: + def install_gfx_driver(self, install_session: 'Installer', driver: GfxDriver): + debug(f'Installing GFX driver: {driver.value}') + + if driver in [GfxDriver.NvidiaOpenKernel, GfxDriver.NvidiaProprietary]: + headers = [f'{kernel}-headers' for kernel in install_session.kernels] + # Fixes https://github.com/archlinux/archinstall/issues/585 + install_session.add_additional_packages(headers) + elif driver in [GfxDriver.AllOpenSource, GfxDriver.AmdOpenSource]: + # The order of these two are important if amdgpu is installed #808 + install_session.remove_mod('amdgpu') + install_session.remove_mod('radeon') + + install_session.append_mod('amdgpu') + install_session.append_mod('radeon') - if driver is not None: - driver_pkgs = driver.packages() - pkg_names = [p.value for p in driver_pkgs] - - for driver_pkg in {GfxPackage.Nvidia, GfxPackage.NvidiaOpen} & set(driver_pkgs): - for kernel in {"linux-lts", "linux-zen"} & set(install_session.kernels): - # Fixes https://github.com/archlinux/archinstall/issues/585 - install_session.add_additional_packages(f"{kernel}-headers") - - # I've had kernel regen fail if it wasn't installed before nvidia-dkms - install_session.add_additional_packages(['dkms', 'xorg-server', 'xorg-xinit', f'{driver_pkg.value}-dkms']) - # Return after first driver match, since it is impossible to use both simultaneously. - return - - if 'amdgpu' in driver_pkgs: - # The order of these two are important if amdgpu is installed #808 - if 'amdgpu' in install_session.modules: - install_session.modules.remove('amdgpu') - install_session.modules.append('amdgpu') - - if 'radeon' in install_session.modules: - install_session.modules.remove('radeon') - install_session.modules.append('radeon') - - install_session.add_additional_packages(pkg_names) - except Exception as err: - warn(f"Could not handle nvidia and linuz-zen specific situations during xorg installation: {err}") - # Prep didn't run, so there's no driver to install - install_session.add_additional_packages(['xorg-server', 'xorg-xinit']) + driver_pkgs = driver.gfx_packages() + pkg_names = [p.value for p in driver_pkgs] + install_session.add_additional_packages(pkg_names) def install_profile_config(self, install_session: 'Installer', profile_config: ProfileConfiguration): profile = profile_config.profile -- cgit v1.2.3-70-g09d2