From 0a1b1ae52f82ee52e8d5c63ee2d0236798e6da69 Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 22 May 2024 20:25:17 +0000 Subject: [PATCH] linux-megous: remove some unneeded options (i.e. PCI) --- pkgs/additional/linux-megous/default.nix | 163 +++++++++-------------- 1 file changed, 62 insertions(+), 101 deletions(-) diff --git a/pkgs/additional/linux-megous/default.nix b/pkgs/additional/linux-megous/default.nix index 33e477be..2145ba40 100644 --- a/pkgs/additional/linux-megous/default.nix +++ b/pkgs/additional/linux-megous/default.nix @@ -19,9 +19,9 @@ , withModemPower ? true # WARNING: NOT ALL COMBINATIONS OF THESE FLAGS YIELDS A BOOTABLE SYSTEM. # even the combinations you'd expect to work, often don't. -, withMegiPinephoneConfig ? false #< start with megi's pinephone_defconfig ? -, withNixpkgsConfig ? true #< apply default config options from ? -, withFullConfig ? true #< try to build every unspecified option, as a module? +, withMegiPinephoneConfig ? false #< if true, then start with megi's pinephone_defconfig +, withNixpkgsConfig ? true #< if true, then apply default config options from +, withFullConfig ? true #< if true, then try to build every unspecified option # something inside nixpkgs calls `override` on the kernel and passes in extra arguments , ... }@args: @@ -165,7 +165,7 @@ let RAID6_PQ_BENCHMARK = no; }; - ### OPTIONS ONLY NEEDED IF `withFullConfig`/`autoModules` IS TRUE: + ### OPTIONS ONLY NEEDED IF `withFullConfig` (i.e. `autoModules`) IS TRUE: fullConfigFixes = with lib.kernel; { ### BUILD FIXES, NOT SPECIFIC TO MY PREFERENCES # @@ -185,7 +185,7 @@ let # options needed if `withNixpkgsConfig` is enabled... even if `withFullConfig` is as well nixpkgsFixes = with lib.kernel; { - SUN8I_DE2_CCU = lib.mkForce yes; #< nixos' default `Y` confuses its own config parser + SUN8I_DE2_CCU = lib.mkForce yes; #< nixpkgs' option parser gets confused on this one, somehow #v XXX: required for e.g. SECURITY_LANDLOCK (specified by upstream nixpkgs) to take effect if `autoModules = false` #v seems that upstream linux (the defconfigs?), it defaults to Yes for: # - arch/x86/configs/x86_64_defconfig @@ -196,102 +196,61 @@ let # SECURITY_SELINUX_BOOTPARAM = yes; # PCI needed because of the dependency on module `ahci` # like SECURITY, it's present for the default x86, arm64 defconfigs, but not the flavored ones. - PCI = yes; + # PCI = yes; }; - ### OPTIONS ONLY NEEDED IF `withFullConfig`/`autoModules` IS FALSE: - nixpkgsRequirements = with lib.kernel; { - # necessary for nixpkgs' initrd to build. - # see for a list of the default modules it includes in the initrd - ATA = module; - PCI = yes; - SATA_AHCI = module; - SATA_NV = module; - SATA_VIA = module; - SATA_SIS = module; - SATA_ULI = module; - ATA_PIIX = module; - PATA_MARVELL = module; - BLK_DEV_NVME = module; - BLK_DEV_SD = module; - BLK_DEV_SR = module; - MMC_BLOCK = module; - USB_UHCI_HCD = module; - USB_EHCI_HCD = module; - USB_EHCI_PCI = module; - USB_OHCI_HCD = module; - USB_OHCI_HCD_PCI = module; #< yep, HCD_PCI -- not just PCI - USB_XHCI_HCD = module; - USB_XHCI_PCI = module; - HID_APPLE = module; - HID_CHERRY = module; - HID_CORSAIR = module; - HID_LENOVO = module; - HID_LOGITECH = module; - HID_LOGITECH_DJ = module; - HID_LOGITECH_HIDPP = module; - HID_MICROSOFT = module; - HID_ROCCAT = module; - # for iio, see: - HID_SENSOR_HUB = module; - # see: - EROFS_FS = module; - # for unl0kr, see: - DRM_BOCHS = module; - - ### RELEVANT CONFIGS INHERITED FROM NIXOS DEFAULTS (OR ABOVE ADDITIONS): - # - # CONFIG_BT=m - # CONFIG_BT_BREDR=y - # CONFIG_BT_RFCOMM=m - # CONFIG_BT_RFCOMM_TTY=y - # CONFIG_BT_BNEP=m - # CONFIG_BT_HIDP=m - # CONFIG_BT_RTL=m - # CONFIG_BT_HCIBTUSB=m - # CONFIG_BT_HCIBTUSB_BCM=y - # CONFIG_BT_HCIBTUSB_RTL=y - # CONFIG_BT_HCIUART=m - # CONFIG_BT_HCIUART_SERDEV=y - # CONFIG_BT_HCIUART_H4=y - # CONFIG_BT_HCIUART_LL=y - # CONFIG_DRM_LIMA=m - # CONFIG_DRM_BRIDGE=y - # CONFIG_DRM_PANEL_BRIDGE=y - # CONFIG_DRM_PANFROST=m - # CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y - # CONFIG_DRM_PANEL_SIMPLE=m - # CONFIG_DRM_PANEL_SITRONIX_ST7703=m - # CONFIG_DRM_SUN4I=m - # CONFIG_DRM_SUN6I_DSI=m - # CONFIG_DRM_SUN8I_DW_HDMI=m - # CONFIG_DRM_SUN8I_MIXER=m - # CONFIG_DRM_SUN8I_TCON_TOP=m - # CONFIG_FB_CORE=y - # CONFIG_FB_DEVICE=y - # CONFIG_FB_NOTIFY=y - # CONFIG_FB_MODE_HELPERS=y - # CONFIG_RTL_CARDS=m - # CONFIG_RTLWIFI=m - # CONFIG_RTLWIFI_PCI=m - # CONFIG_RTLWIFI_USB=m - # CONFIG_RTLWIFI_DEBUG=y - # CONFIG_RTL8723_COMMON=m - # CONFIG_RTLBTCOEXIST=m - # CONFIG_RTL8XXXU=m - # CONFIG_RTLLIB=m - # consider adding (from mobile-nixos): - # maybe: CONFIG_BT_HCIUART_3WIRE=y - # maybe: CONFIG_BT_HCIUART_RTL=y - # maybe: CONFIG_RTL8XXXU_UNTESTED=y - # consider adding (from manjaro): - # CONFIG_BT_6LOWPAN=m (not listed as option in nixos kernel) - # these are referenced in the rtl8723 source, but not known to config (and not in mobile-nixos config - # maybe: CONFIG_RTL_ODM_WLAN_DRIVER - # maybe: CONFIG_RTL_TRIBAND_SUPPORT - # maybe: CONFIG_SDIO_HCI - # maybe: CONFIG_USB_HCI - }; + ### RELEVANT CONFIGS INHERITED FROM NIXOS DEFAULTS (OR ABOVE ADDITIONS): + # + # CONFIG_BT=m + # CONFIG_BT_BREDR=y + # CONFIG_BT_RFCOMM=m + # CONFIG_BT_RFCOMM_TTY=y + # CONFIG_BT_BNEP=m + # CONFIG_BT_HIDP=m + # CONFIG_BT_RTL=m + # CONFIG_BT_HCIBTUSB=m + # CONFIG_BT_HCIBTUSB_BCM=y + # CONFIG_BT_HCIBTUSB_RTL=y + # CONFIG_BT_HCIUART=m + # CONFIG_BT_HCIUART_SERDEV=y + # CONFIG_BT_HCIUART_H4=y + # CONFIG_BT_HCIUART_LL=y + # CONFIG_DRM_LIMA=m + # CONFIG_DRM_BRIDGE=y + # CONFIG_DRM_PANEL_BRIDGE=y + # CONFIG_DRM_PANFROST=m + # CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y + # CONFIG_DRM_PANEL_SIMPLE=m + # CONFIG_DRM_PANEL_SITRONIX_ST7703=m + # CONFIG_DRM_SUN4I=m + # CONFIG_DRM_SUN6I_DSI=m + # CONFIG_DRM_SUN8I_DW_HDMI=m + # CONFIG_DRM_SUN8I_MIXER=m + # CONFIG_DRM_SUN8I_TCON_TOP=m + # CONFIG_FB_CORE=y + # CONFIG_FB_DEVICE=y + # CONFIG_FB_NOTIFY=y + # CONFIG_FB_MODE_HELPERS=y + # CONFIG_RTL_CARDS=m + # CONFIG_RTLWIFI=m + # CONFIG_RTLWIFI_PCI=m + # CONFIG_RTLWIFI_USB=m + # CONFIG_RTLWIFI_DEBUG=y + # CONFIG_RTL8723_COMMON=m + # CONFIG_RTLBTCOEXIST=m + # CONFIG_RTL8XXXU=m + # CONFIG_RTLLIB=m + # consider adding (from mobile-nixos): + # maybe: CONFIG_BT_HCIUART_3WIRE=y + # maybe: CONFIG_BT_HCIUART_RTL=y + # maybe: CONFIG_RTL8XXXU_UNTESTED=y + # consider adding (from manjaro): + # CONFIG_BT_6LOWPAN=m (not listed as option in nixos kernel) + # these are referenced in the rtl8723 source, but not known to config (and not in mobile-nixos config + # maybe: CONFIG_RTL_ODM_WLAN_DRIVER + # maybe: CONFIG_RTL_TRIBAND_SUPPORT + # maybe: CONFIG_SDIO_HCI + # maybe: CONFIG_USB_HCI # `pkgs.kernelPatches` is a set of common patches # while `kernelPatches` callarg is a list. @@ -417,7 +376,6 @@ in (buildLinux { structuredExtraConfig = lib.optionalAttrs withMegiPinephoneConfig megiFixes - // lib.optionalAttrs (!withFullConfig) nixpkgsRequirements // lib.optionalAttrs withNixpkgsConfig nixpkgsFixes // lib.optionalAttrs withFullConfig fullConfigFixes // qualityOfLife @@ -428,5 +386,8 @@ in (buildLinux { enableCommonConfig = withNixpkgsConfig; autoModules = withFullConfig; - preferBuiltin = withFullConfig; #< TODO: set this to false! it's the more extreme version of autoModules, which answers `Y` to everything which would default to `Y` (wait, that sounds ok, actually?) + # for every module which was autoselected, if it supports being compiled into the kernel (i.e. has a `y` option), then do that instead of building it as a module. + # so, this option has no effect when `autoModules` is false. + # the benefit i think is mostly that such modules get automatically included in the initrd? + preferBuiltin = withFullConfig; })