this reapplies the following commits from before `autoModules=true`, but commented out: - fa0508521995f4510ee4e08f9d1eb086eb64f707 - 513c4b1aa0e2800ea1d867ec158510bb56fac794
252 lines
9.2 KiB
Nix
252 lines
9.2 KiB
Nix
{
|
|
lib,
|
|
linux_latest,
|
|
# linux-postmarketos-pinephonepro,
|
|
#VVV nixpkgs calls `.override` on the kernel to configure additional things, but we don't care about those things
|
|
...
|
|
}:
|
|
|
|
linux_latest.override {
|
|
DTB = true; #< XXX: not sure if actually needed
|
|
autoModules = true;
|
|
preferBuiltin = true;
|
|
enableCommonConfig = true; #< enable nixpkgs config options
|
|
|
|
kernelPatches = [
|
|
# {
|
|
# name = "pmos-config";
|
|
# patch = null;
|
|
# extraStructuredConfig = builtins.removeAttrs
|
|
# linux-postmarketos-pinephonepro.structuredConfig
|
|
# [
|
|
# "BASE_SMALL" # pmos: =0 ???
|
|
# "BRIDGE_NETFILTER" # pmos: =y, but option only supports m
|
|
# "NFT_COMPAT" # pmos: =y, but option only supports m
|
|
# "NETFILTER_XT_TARGET_CHECKSUM" # pmos: =y, but option only supports m
|
|
# "NETFILTER_XT_MATCH_IPVS" # pmos: =y, but option only supports m
|
|
# "IP_NF_MATCH_RPFILTER" # pmos: =y, but option only supports m
|
|
# "DRM_PANEL_HIMAX_HX8394" # pmos: =y, but option only supports m
|
|
# "DRM_PANEL_SIMPLE" # pmos: =y, but option only supports m
|
|
# "FSCACHE" # pmos: =y, but option only supports m
|
|
|
|
# # these options conflict with nixos defaults
|
|
# "BINFMT_MISC" # pmos:m, nixpkgs:y
|
|
# "BPF_JIT_ALWAYS_ON" # pmos:y, nixpkgs:n
|
|
# "CMA_SIZE_MBYTES" # pmos:256, nixpkgs:32
|
|
# "CRYPTO_TEST" # pmos:m, nixpkgs:n
|
|
# "DEFAULT_MMAP_MIN_ADDR" # pmos:4096, nixpkgs:32768
|
|
# "IP_DCCP_CCID3" # pmos:y, nixpkgs:n
|
|
# "IP_NF_TARGET_REDIRECT" # pmos:y, nixpkgs:m
|
|
# "IP_PNP" # pmos:y, nixpkgs:n
|
|
# "MMC_BLOCK_MINORS" # pmos:256, nixpkgs:32
|
|
# "NET_DROP_MONITOR" # pmos:m, nixpkgs:y
|
|
# "NLS_UTF8" # pmos:y, nixpkgs:m
|
|
# "NOTIFIER_ERROR_INJECTION" # pmos:m, nixpkgs:n
|
|
# "NR_CPUS" # pmos:64, nixpkgs:384
|
|
# "PREEMPT" # pmos:y, nixpkgs:n
|
|
# "STANDALONE" # pmos:y, nixpkgs:n
|
|
# "TRANSPARENT_HUGEPAGE_ALWAYS" # pmos:y, nixpkgs:n
|
|
# "UEVENT_HELPER" # pmos:y, nixpkgs:n
|
|
# "USB_SERIAL" # pmos:m, nixpkgs:y
|
|
# "ZSMALLOC" # pmos:m, nixpkgs:y
|
|
|
|
# # these options don't break build, but are nonsensical
|
|
# "BASE_FULL"
|
|
# "CC_VERSION_TEXT"
|
|
# "GCC_VERSION"
|
|
# ]
|
|
# ;
|
|
# }
|
|
# {
|
|
# name = "add-removed";
|
|
# patch = null;
|
|
# extraStructuredConfig = with lib.kernel; {
|
|
# DRM_PANEL_HIMAX_HX8394 = module;
|
|
# DRM_PANEL_SIMPLE = module;
|
|
# };
|
|
# }
|
|
{
|
|
name = "fix-no-display";
|
|
patch = null;
|
|
extraStructuredConfig = with lib.kernel; {
|
|
### RUNTIME FIXES AFTER <https://github.com/NixOS/nixpkgs/pull/298332>
|
|
# pmOS kernel config is in pmaports repo:
|
|
# - CONFIG_FB_SIMPLE=y
|
|
# - CONFIG_DRM_SIMPLEDRM is unset
|
|
# - CONFIG_SYSFB_SIMPLEFB is not referenced
|
|
# these config values are speculative: could probably be made smaller
|
|
FB_SIMPLE = lib.mkForce yes;
|
|
DRM_SIMPLEDRM = lib.mkForce no; #< conflicts with FB_SIMPLE
|
|
# SYSFB_SIMPLEFB = lib.mkForce no;
|
|
|
|
DRM = yes;
|
|
|
|
ARM64_VA_BITS_48 = yes; #< 48 (not 52) bits for virtual addresses. the other bit widths (ARM64_VA*, ARM64_PA_*, PGTABLE_LEVELS) are then derived/implied same as pmos config
|
|
BACKLIGHT_CLASS_DEVICE = yes;
|
|
VIDEO_SUNXI = yes;
|
|
};
|
|
}
|
|
{
|
|
name = "reset-nixpkgs-overrides";
|
|
patch = null;
|
|
extraStructuredConfig = with lib.kernel; {
|
|
# this is required for boot (but why??)
|
|
ACPI_FPDT = lib.mkForce no;
|
|
|
|
# this is required for boot (but why??)
|
|
SHUFFLE_PAGE_ALLOCATOR = lib.mkForce no;
|
|
|
|
# this is required for boot (but why??)
|
|
TRANSPARENT_HUGEPAGE_ALWAYS = lib.mkForce yes;
|
|
|
|
# this is required for boot
|
|
SYSFB_SIMPLEFB = lib.mkForce no;
|
|
|
|
# this is required for boot (but why??)
|
|
IO_STRICT_DEVMEM = no;
|
|
|
|
# this is required for boot (but why??)
|
|
PRINTK_INDEX = lib.mkForce no;
|
|
|
|
# this is required for boot (but why??)
|
|
CRASH_RESERVE = yes;
|
|
|
|
# this is required for boot (but why??)
|
|
PREEMPT = lib.mkForce yes;
|
|
# this is required for boot (but why??)
|
|
PREEMPT_VOLUNTARY_BUILD = no;
|
|
|
|
# this is required for boot (but why??)
|
|
MMC_BLOCK_MINORS = lib.mkForce (freeform "256");
|
|
|
|
# this is required for boot (but why??)
|
|
MEDIA_PCI_SUPPORT = lib.mkForce no;
|
|
};
|
|
}
|
|
{
|
|
name = "reset-automodules-overrides";
|
|
patch = null;
|
|
extraStructuredConfig = with lib.kernel; {
|
|
NR_CPUS = lib.mkForce (freeform "64");
|
|
RANDOM_KMALLOC_CACHES = lib.mkForce no;
|
|
BT_HCIUART_BCSP = lib.mkForce no;
|
|
HOTPLUG_PCI_PCIE = lib.mkForce no;
|
|
DRM_ACCEL = lib.mkForce no;
|
|
KFENCE = lib.mkForce no;
|
|
|
|
BLK_INLINE_ENCRYPTION = lib.mkForce no;
|
|
ATH10K_DFS_CERTIFIED = lib.mkForce no;
|
|
MOUSE_ELAN_I2C_SMBUS = lib.mkForce no;
|
|
PINCTRL_AMD = lib.mkForce no;
|
|
AUXDISPLAY = lib.mkForce no;
|
|
DRM_DISPLAY_DP_AUX_CEC = lib.mkForce no;
|
|
DRM_DISPLAY_DP_AUX_CHARDEV = lib.mkForce no;
|
|
DRM_NOUVEAU_GSP_DEFAULT = lib.mkForce no;
|
|
DRM_VC4_HDMI_CEC = lib.mkForce no;
|
|
|
|
NO_HZ_IDLE = yes;
|
|
NO_HZ_FULL = lib.mkForce no;
|
|
CONTEXT_TRACKING_USER = no;
|
|
PREEMPTION = yes;
|
|
PREEMPT_BUILD = yes;
|
|
PREEMPT_COUNT = yes;
|
|
PREEMPT_RCU = yes;
|
|
TICK_CPU_ACCOUNTING = yes;
|
|
VIRT_CPU_ACCOUNTING = no;
|
|
TASKS_RCU = yes;
|
|
CRASH_DUMP = lib.mkForce yes;
|
|
|
|
XFRM_ESPINTCP = no;
|
|
|
|
|
|
STANDALONE = lib.mkForce yes;
|
|
CHROMEOS_TBMC = lib.mkForce no;
|
|
|
|
RUNTIME_TESTING_MENU = lib.mkForce yes;
|
|
|
|
# TODO: one of these is required for boot?
|
|
SLAB_BUCKETS = lib.mkForce no;
|
|
DEFAULT_MMAP_MIN_ADDR = lib.mkForce (freeform "4096");
|
|
TRANSPARENT_HUGEPAGE_MADVISE = lib.mkForce no;
|
|
ZONE_DEVICE = lib.mkForce no;
|
|
UEVENT_HELPER = lib.mkForce yes;
|
|
LOGO = lib.mkForce yes;
|
|
LOGO_LINUX_CLUT224 = yes;
|
|
POWERCAP = lib.mkForce no;
|
|
CPUMASK_OFFSTACK = no;
|
|
# or maybe this?
|
|
HID_BPF = lib.mkForce no;
|
|
|
|
# TODO: one of these is required for boot?
|
|
USB_SERIAL = lib.mkForce module;
|
|
FSL_MC_UAPI_SUPPORT = lib.mkForce no;
|
|
NET_FC = lib.mkForce no;
|
|
NET_VENDOR_MEDIATEK = lib.mkForce no;
|
|
WAN = lib.mkForce no;
|
|
# or maybe one of these?
|
|
HARDLOCKUP_DETECTOR = lib.mkForce no;
|
|
U_SERIAL_CONSOLE = lib.mkForce no;
|
|
WATCH_QUEUE = lib.mkForce no;
|
|
SCHED_CORE = lib.mkForce no;
|
|
BPF_JIT_ALWAYS_ON = lib.mkForce yes;
|
|
PARAVIRT_TIME_ACCOUNTING = lib.mkForce no;
|
|
ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION = yes; #< does not take effect
|
|
COMPAT_ALIGNMENT_FIXUPS = lib.mkForce no;
|
|
IDLE_PAGE_TRACKING = lib.mkForce no;
|
|
PAGE_IDLE_FLAG = no;
|
|
EFI_ZBOOT = lib.mkForce no;
|
|
ZRAM_MULTI_COMP = lib.mkForce no;
|
|
|
|
# upgrade `m` -> `y`
|
|
# INPUT_MATRIXKMAP = lib.mkForce yes;
|
|
# I2C_CROS_EC_TUNNEL = yes;
|
|
# CHARGER_CROS_PCHG = yes;
|
|
# CHARGER_CROS_CONTROL = yes;
|
|
# SENSORS_CROS_EC = yes;
|
|
# MFD_CROS_EC_DEV = yes;
|
|
# REGULATOR_CROS_EC = yes;
|
|
# RTC_DRV_CROS_EC = yes;
|
|
# CROS_EC = lib.mkForce yes;
|
|
# CROS_EC_I2C = lib.mkForce yes;
|
|
# CROS_EC_SPI = lib.mkForce yes;
|
|
# EXTCON_USBC_CROS_EC = yes;
|
|
|
|
# TODO: at least one of these is required for boot
|
|
UNINLINE_SPIN_UNLOCK = yes; #< DOESN'T TAKE EFFECT
|
|
CMA_SIZE_MBYTES = lib.mkForce (freeform "256");
|
|
SOFTLOCKUP_DETECTOR_INTR_STORM = no;
|
|
LDM_PARTITION = lib.mkForce no;
|
|
DAMON = lib.mkForce no;
|
|
SKB_DECRYPTED = no; #< does not take effect
|
|
CFG80211_CERTIFICATION_ONUS = lib.mkForce no;
|
|
MAC80211_DEBUGFS = lib.mkForce no;
|
|
SOCK_VALIDATE_XMIT = no; #< does not take effect
|
|
ACCESSIBILITY = lib.mkForce no;
|
|
VIRTIO_MMIO_CMDLINE_DEVICES = lib.mkForce no;
|
|
DEBUG_INFO = no;
|
|
SCHED_DEBUG = lib.mkForce no;
|
|
FUNCTION_PROFILER = lib.mkForce no;
|
|
SCHED_TRACER = lib.mkForce no;
|
|
DEBUG_INFO_NONE = yes;
|
|
TLS = lib.mkForce no;
|
|
XDP_SOCKETS_DIAG = lib.mkForce no;
|
|
IP_PNP = lib.mkForce yes;
|
|
IP_PNP_DHCP = yes;
|
|
IP_PNP_BOOTP = yes;
|
|
IP_DCCP_CCID3 = lib.mkForce yes;
|
|
IP_DCCP_TFRC_LIB = yes;
|
|
RTW88 = lib.mkForce no;
|
|
MEDIA_CEC_RC = lib.mkForce no;
|
|
CRYPTO_TEST = lib.mkForce module;
|
|
PROC_VMCORE = yes; #< does not take effect ??
|
|
# or maybe it's one of these?
|
|
FUSION = lib.mkForce no;
|
|
HIPPI = lib.mkForce no;
|
|
BRCMFMAC_PCIE = lib.mkForce no;
|
|
MOUSE_PS2_ELANTECH = lib.mkForce no;
|
|
INFINIBAND = lib.mkForce no;
|
|
};
|
|
}
|
|
];
|
|
}
|