moby: kernel: enable full config

camera works so long as i blacklist some new modules
This commit is contained in:
2024-09-14 05:32:31 +00:00
parent a773513189
commit 54dfb04b81
3 changed files with 126 additions and 105 deletions

View File

@@ -17,6 +17,15 @@ in
# the filtering/calibration is bad that it causes the screen to go fully dark at times.
# boot.blacklistedKernelModules = [ "stk3310" ];
boot.blacklistedKernelModules = [
# XXX: un-blacklisting these modules MAY break the camera (i didn't narrow down the exact set)
"gc2145_mipi"
"leds_group_multicolor"
"pinctrl_axp209"
# "led_class_multicolor"
# "v4l2_cci"
];
boot.extraModprobeConfig = ''
# 2024-09-01: disable power-saving if using the rtw88 rtl8723cs WiFi driver
# power saving was observed to cause frequent disconnections and reconnections

View File

@@ -41,7 +41,7 @@ in
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux-armbian.override {
usePmosConfig = true;
withNixpkgsConfig = true;
withFullConfig = false;
withFullConfig = true;
withModemPower = true;
});

View File

@@ -9,7 +9,7 @@
sane-kernel-tools,
usePmosConfig ? true,
withNixpkgsConfig ? true,
withFullConfig ? false,
withFullConfig ? true,
withModemPower ? true,
#VVV nixpkgs calls `.override` on the kernel to configure additional things, but we don't care about those things
...
@@ -26,7 +26,7 @@ linux_latest.override {
DTB = true; #< XXX: not sure if actually needed
autoModules = withFullConfig;
preferBuiltin = withFullConfig;
preferBuiltin = true;
enableCommonConfig = withNixpkgsConfig;
@@ -271,7 +271,7 @@ linux_latest.override {
# # byName."Defconfigs-for-all-my-devices"
# # byName."Update-defconfigs"
# ] ++
lib.optionals withNixpkgsConfig [
lib.optionals withFullConfig [
{
name = "fix-compilation-specific-to-megi";
patch = null;
@@ -285,6 +285,8 @@ linux_latest.override {
# make[3]: *** [../scripts/Makefile.build:289: drivers/video/fbdev/sun5i-eink-neon.o] Error 1
FB_SUN5I_EINK = no;
BES2600 = no; # fails to compile (implicit declaration of function 'ieee80211_tx_status'; did you mean 'ieee80211_tx_status_ni')
# SUN8I_DE2_CCU = lib.mkForce module; #< want:y, got:M
};
}
# {
@@ -304,88 +306,88 @@ linux_latest.override {
# DRM = lib.mkForce module;
# };
# }
{
name = "enable-rtw88-wifi-drivers";
patch = null;
extraStructuredConfig = with lib.kernel; {
# default nixpkgs/pmos config enables RTW88, but not RTW88_8723CS.
# but the pinephone uses a 8723BS/8723CS chipset, so enable these
# and anything else that could possibly be needed, since these things are tangled.
# TODO: reduce this, this is surely more than i actually need
# RTL8187_LEDS=y
# RTLWIFI_DEBUG=y
RTL8180 = module;
RTL8187 = module;
RTL8188EE = module;
RTL8192CE = module;
RTL8192CU = module;
RTL8192C_COMMON = module;
RTL8192DE = module;
RTL8192D_COMMON = module;
RTL8192EE = module;
RTL8192SE = module;
RTL8723AE = module;
RTL8723BE = module;
RTL8723_COMMON = module;
RTL8821AE = module;
RTL8XXXU = module;
RTLBTCOEXIST = module;
RTLWIFI = module;
RTLWIFI_PCI = module;
RTLWIFI_USB = module;
RTW88_8703B = module;
RTW88_8723CS = module;
RTW88_8723D = module;
RTW88_8723DE = module;
RTW88_8723DS = module;
RTW88_8723DU = module;
RTW88_8723X = module;
RTW88_8821C = module;
RTW88_8821CE = module;
RTW88_8821CS = module;
RTW88_8821CU = module;
RTW88_8822BS = module;
RTW88_8822BU = module;
RTW88_8822CS = module;
RTW88_8822CU = module;
RTW88_SDIO = module;
RTW88_USB = module;
};
}
{
# this could be enabled for *all* systems, but i'm not sure i really want that.
name = "quality-of-life";
patch = null;
extraStructuredConfig = with lib.kernel; {
# optimize for faster builds.
# see <repo:kernel.org/linux:Documentation/admin-guide/quickly-build-trimmed-linux.rst>
# note that several options can re-enable DEBUG_KERNEL (such as DEBUG_LIST)
# DEBUG_KERNEL = lib.mkForce no; # option group which seems to just gate the other DEBUG_ opts?
DEBUG_INFO = lib.mkForce no; # for gdb debugging (does it impact kernel stacktraces, too?)
# DEBUG_INFO_NONE = lib.mkForce no;
DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT = lib.mkForce no;
# DEBUG_LIST = lib.mkForce no;
# DEBUG_MISC = lib.mkForce no;
# DEBUG_FS = no;
# {
# name = "enable-rtw88-wifi-drivers";
# patch = null;
# extraStructuredConfig = with lib.kernel; {
# # default nixpkgs/pmos config enables RTW88, but not RTW88_8723CS.
# # but the pinephone uses a 8723BS/8723CS chipset, so enable these
# # and anything else that could possibly be needed, since these things are tangled.
# # TODO: reduce this, this is surely more than i actually need
# # RTL8187_LEDS=y
# # RTLWIFI_DEBUG=y
# # RTL8180 = module;
# # RTL8187 = module;
# # RTL8188EE = module;
# # RTL8192CE = module;
# # RTL8192CU = module;
# # RTL8192C_COMMON = module;
# # RTL8192DE = module;
# # RTL8192D_COMMON = module;
# # RTL8192EE = module;
# # RTL8192SE = module;
# # RTL8723AE = module;
# # RTL8723BE = module;
# # RTL8723_COMMON = module;
# # RTL8821AE = module;
# # RTL8XXXU = module;
# # RTLBTCOEXIST = module;
# # RTLWIFI = module;
# # RTLWIFI_PCI = module;
# # RTLWIFI_USB = module;
# RTW88_8703B = module;
# RTW88_8723CS = module;
# RTW88_8723D = module;
# RTW88_8723DE = module;
# RTW88_8723DS = module;
# RTW88_8723DU = module;
# RTW88_8723X = module;
# RTW88_8821C = module;
# RTW88_8821CE = module;
# RTW88_8821CS = module;
# RTW88_8821CU = module;
# RTW88_8822BS = module;
# RTW88_8822BU = module;
# RTW88_8822CS = module;
# RTW88_8822CU = module;
# RTW88_SDIO = module;
# RTW88_USB = module;
# };
# }
# {
# # this could be enabled for *all* systems, but i'm not sure i really want that.
# name = "quality-of-life";
# patch = null;
# extraStructuredConfig = with lib.kernel; {
# # optimize for faster builds.
# # see <repo:kernel.org/linux:Documentation/admin-guide/quickly-build-trimmed-linux.rst>
# # note that several options can re-enable DEBUG_KERNEL (such as DEBUG_LIST)
# # DEBUG_KERNEL = lib.mkForce no; # option group which seems to just gate the other DEBUG_ opts?
# DEBUG_INFO = lib.mkForce no; # for gdb debugging (does it impact kernel stacktraces, too?)
# # DEBUG_INFO_NONE = lib.mkForce no;
# DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT = lib.mkForce no;
# # DEBUG_LIST = lib.mkForce no;
# # DEBUG_MISC = lib.mkForce no;
# # DEBUG_FS = no;
DEBUG_INFO_BTF = lib.mkForce no; # BPF debug symbols. rec by <https://nixos.wiki/wiki/Linux_kernel#Too_high_ram_usage>
# SCHED_DEBUG = lib.mkForce no; # determines /sys/kernel/debug/sched
SUNRPC_DEBUG = lib.mkForce no;
# shave 500ms off Pinephone boot time (dmesg | grep raid6)
# - by default raid6 (on behalf of btrfs) will compute the fastest algorithms at boot.
# - AFAICT, this only comes into effect if using raid (i don't).
# - in any case, on moby, the fastest benchmark happens to be the default anyway.
# - on lappy/servo/desko, the default is about 3% slower than the fastest. but they compute this in < 100ms.
RAID6_PQ_BENCHMARK = no;
};
}
# DEBUG_INFO_BTF = lib.mkForce no; # BPF debug symbols. rec by <https://nixos.wiki/wiki/Linux_kernel#Too_high_ram_usage>
# # SCHED_DEBUG = lib.mkForce no; # determines /sys/kernel/debug/sched
# SUNRPC_DEBUG = lib.mkForce no;
# # shave 500ms off Pinephone boot time (dmesg | grep raid6)
# # - by default raid6 (on behalf of btrfs) will compute the fastest algorithms at boot.
# # - AFAICT, this only comes into effect if using raid (i don't).
# # - in any case, on moby, the fastest benchmark happens to be the default anyway.
# # - on lappy/servo/desko, the default is about 3% slower than the fastest. but they compute this in < 100ms.
# RAID6_PQ_BENCHMARK = lib.mkForce no;
# };
# }
] ++ lib.optionals withModemPower [
{
name = "enable-megi-modem-power";
patch = null;
extraStructuredConfig = with lib.kernel; {
# enable /sys/class/modem-power, a thing specific to Megi's kernel/patches
MODEM_POWER = yes;
MODEM_POWER = module;
};
}
# ] ++ lib.optionals withNixpkgsConfig [
@@ -402,7 +404,7 @@ linux_latest.override {
(sane-kernel-tools.parseDefconfigStructuredNonempty linux-postmarketos-allwinner.defconfigStr)
([
# remove attrs which nixpkgs wants to set for itself, only because the kernel config options are so fucked that i can't figure out how to override things without breaking eval
"RAID6_PQ_BENCHMARK"
# "RAID6_PQ_BENCHMARK"
# these options have changed since the version which pmos ships? or pmos just ships invalid values
# "repeated questions"
@@ -432,12 +434,14 @@ linux_latest.override {
"NLS_ISO8859_1" #< nixpkgs:m, pmos:y
"NR_CPUS"
# "PREEMPT" #< nixpkgs:(n), pmos:y
# "STANDALONE"
# "TRANSPARENT_HUGEPAGE_ALWAYS"
# "UEVENT_HELPER"
# "USB_SERIAL"
# "ZSMALLOC"
"CMA_SIZE_MBYTES"
"DEFAULT_MMAP_MIN_ADDR"
"PREEMPT"
"STANDALONE"
"TRANSPARENT_HUGEPAGE_ALWAYS"
"UEVENT_HELPER"
"USB_SERIAL"
"ZSMALLOC"
# "DRM_LIMA"
# "DRM_PANFROST"
@@ -448,14 +452,19 @@ linux_latest.override {
"CC_VERSION_TEXT"
"GCC_VERSION"
] ++ lib.optionals (withNixpkgsConfig && withFullConfig) [
"BLK_DEV_DM" #< want:y, actual:m
"VFIO" #< want:y, actual:m
# "STMMAC_ETH" #< autoModules:m, pmos:y
# "STMMAC_PLATFORM" #< autoModules:m, pmos:y
# "DWMAC_GENERIC" #< autoModules:m, pmos:y
# "DWMAC_SUNXI" #< autoModules:m, pmos:y
# "DWMAC_SUN8I" #< autoModules:m, pmos:y
"BLK_DEV_DM" #< autoModules:m, pmos:y
"VFIO" #< autoModules:m, pmos:y
]
);
}
] ++ lib.optionals (withNixpkgsConfig || !usePmosConfig) [
] ++ lib.optionals (!usePmosConfig) [
{
name = "enable options for libcamera";
name = "enable options for Pinephone";
patch = null;
extraStructuredConfig = with lib.kernel; {
# borrowed from postmarketOS, "to enable libcamera development"
@@ -468,32 +477,35 @@ linux_latest.override {
# - pinephone in mainline linux, postmarketOS, defaults to 7
# - nixos defaults to ... 19?
CMA_AREAS = freeform "7";
DRM_ACCEL = lib.mkForce no;
# DRM_ACCEL = lib.mkForce no;
CMA_SIZE_MBYTES = lib.mkForce (freeform "256"); #< also available at boot time via `cma=256M` CLI
# CMA_SIZE_MBYTES = lib.mkForce (freeform "256"); #< also available at boot time via `cma=256M` CLI
# #vvv aside from SUN50I_IOMMU, this is just upgrading modules to `y`
# DMA_SUN6I = yes;
# SUN50I_IOMMU = yes;
SUN50I_IOMMU = yes;
# VIDEOBUF2_CORE = yes;
# VIDEOBUF2_V4L2 = yes;
# VIDEOBUF2_MEMOPS = yes;
# VIDEOBUF2_DMA_CONTIG = yes;
# VIDEO_SUNXI = yes;
# # VIDEO_SUNXI_CEDRUS = yes; #< implied (i think)
VIDEO_SUNXI = yes;
VIDEO_SUNXI_CEDRUS = yes;
# # VIDEO_SUNXI_CEDRUS = module; #< implied by VIDEO_SUNXI
# #^^^ this isn't enough to get camera working
# DRM = lib.mkForce yes; #< upgrade from module to builtin
DEFAULT_MMAP_MIN_ADDR = lib.mkForce (freeform "4096");
STANDALONE = lib.mkForce no;
PREEMPT = lib.mkForce yes;
TRANSPARENT_HUGEPAGE_ALWAYS = lib.mkForce yes;
ZSMALLOC = lib.mkForce no;
UEVENT_HELPER = lib.mkForce yes;
USB_SERIAL = lib.mkForce module;
ZSWAP = lib.mkForce no;
# ZPOOL = lib.mkForce no;
MFD_SUN6I_PRCM = yes;
# # DRM = lib.mkForce yes; #< upgrade from module to builtin
# DEFAULT_MMAP_MIN_ADDR = lib.mkForce (freeform "4096");
# STANDALONE = lib.mkForce no;
# PREEMPT = lib.mkForce yes;
# TRANSPARENT_HUGEPAGE_ALWAYS = lib.mkForce yes;
# ZSMALLOC = lib.mkForce no;
# UEVENT_HELPER = lib.mkForce yes;
# USB_SERIAL = lib.mkForce module;
# ZSWAP = lib.mkForce no;
# # ZPOOL = lib.mkForce no;
# see: <https://gitlab.com/postmarketOS/pmaports/-/merge_requests/5541/>
# UDMABUF = yes; #< not needed (nixos default)