moby: ship a mainline kernel for the pinephone pro

not perfect, but it does boot
This commit is contained in:
2024-09-23 04:29:04 +00:00
parent 258fd5b4aa
commit 17d96a8ca1
4 changed files with 68 additions and 10 deletions

View File

@@ -8,7 +8,15 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux-postmarketos-pinephonepro; # kernel compat (2024/09/22):
# - linux-postmarketos-pinephonepro (6.6.0): boots to graphics; WiFi; Ethernet
# - linux-sane-pinephonepro (6.11.0; pmos config ONLY): boots to graphics; Wifi; no ethernet
# - firewall.service fails b/c extensions "LOG" and "tcp" are missing
# - battery status is unknown
# - cameras, sound, etc untested
# boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux-postmarketos-pinephonepro;
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux-sane-pinephonepro;
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [
# see <repo:postmarketOS/pmaports:device/community/device-pine64-pinephonepro/modules-initfs> # see <repo:postmarketOS/pmaports:device/community/device-pine64-pinephonepro/modules-initfs>
# - pmos includes: gpu_sched dw_wdt fusb302 panel_himax_hx8394 goodix_ts # - pmos includes: gpu_sched dw_wdt fusb302 panel_himax_hx8394 goodix_ts

View File

@@ -30,7 +30,14 @@ let
modDirVersion = "6.6.0"; # or X.Y.Z-rcN modDirVersion = "6.6.0"; # or X.Y.Z-rcN
# ^^^ sources # ^^^ sources
defconfigStr = (builtins.readFile "${pmaports}/device/community/linux-pine64-pinephonepro/config-pine64-pinephonepro.aarch64") + '' defconfigRaw = builtins.readFile "${pmaports}/device/community/linux-pine64-pinephonepro/config-pine64-pinephonepro.aarch64";
defconfigStr =
# fix build:
# make[3]: *** [../scripts/Makefile.build:243: crypto/aegis128-neon-inner.o] Error 1
# /build/ccUPpJiV.s:596: Error: selected processor does not support aese v2.16b,v11.16b
(lib.replaceStrings [ "CONFIG_CRYPTO_AEGIS128_SIMD=y" ] [ "CONFIG_CRYPTO_AEGIS128_SIMD=n" ] defconfigRaw)
# add options i used in linux-postmarketos-allwinner to get nixos-flavored linux working as expected:
+ ''
# #
# Extra nixpkgs-specific options # Extra nixpkgs-specific options
# nixos/modules/system/boot/systemd.nix wants CONFIG_DMIID # nixos/modules/system/boot/systemd.nix wants CONFIG_DMIID
@@ -46,13 +53,6 @@ let
CONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,selinux,smack,tomoyo,apparmor,bpf"; CONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,selinux,smack,tomoyo,apparmor,bpf";
''; '';
#
# Fix build issues
#
# make[3]: *** [../scripts/Makefile.build:243: crypto/aegis128-neon-inner.o] Error 1
# /build/ccUPpJiV.s:596: Error: selected processor does not support aese v2.16b,v11.16b
defconfigStr' = lib.replaceStrings [ "CONFIG_CRYPTO_AEGIS128_SIMD=y" ] [ "CONFIG_CRYPTO_AEGIS128_SIMD=n" ] defconfigStr;
in (linuxManualConfig { in (linuxManualConfig {
inherit src version modDirVersion randstructSeed; inherit src version modDirVersion randstructSeed;
# inherit (linux-megous) extraMakeFlags modDirVersion src version; # inherit (linux-megous) extraMakeFlags modDirVersion src version;
@@ -60,7 +60,7 @@ in (linuxManualConfig {
configfile = writeTextFile { configfile = writeTextFile {
name = "config-pine64-pinephonepro.aarch64"; name = "config-pine64-pinephonepro.aarch64";
text = defconfigStr'; text = defconfigStr;
}; };
# nixpkgs requires to know the config as an attrset, to do various eval-time assertions. # nixpkgs requires to know the config as an attrset, to do various eval-time assertions.
# that config is sourced from the pmaports repo, hence this is import-from-derivation. # that config is sourced from the pmaports repo, hence this is import-from-derivation.
@@ -69,6 +69,7 @@ in (linuxManualConfig {
}).overrideAttrs (base: { }).overrideAttrs (base: {
passthru = (base.passthru or {}) // { passthru = (base.passthru or {}) // {
inherit defconfigStr; inherit defconfigStr;
structuredConfig = sane-kernel-tools.parseDefconfigStructuredNonempty defconfigStr;
}; };
}) })

View File

@@ -0,0 +1,48 @@
{
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 = false;
enableCommonConfig = false;
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 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;
};
}
];
}

View File

@@ -68,6 +68,7 @@ let
linux-postmarketos-allwinner = callPackage ./additional/linux-postmarketos-allwinner { }; linux-postmarketos-allwinner = callPackage ./additional/linux-postmarketos-allwinner { };
linux-postmarketos-exynos5 = callPackage ./additional/linux-postmarketos-exynos5 { }; linux-postmarketos-exynos5 = callPackage ./additional/linux-postmarketos-exynos5 { };
linux-postmarketos-pinephonepro = callPackage ./additional/linux-postmarketos-pinephonepro { }; linux-postmarketos-pinephonepro = callPackage ./additional/linux-postmarketos-pinephonepro { };
linux-sane-pinephonepro = callPackage ./additional/linux-sane-pinephonepro { };
listparser = callPackage ./additional/listparser { }; listparser = callPackage ./additional/listparser { };
mcg = callPackage ./additional/mcg { }; mcg = callPackage ./additional/mcg { };
megapixels-next = callPackage ./additional/megapixels-next { }; megapixels-next = callPackage ./additional/megapixels-next { };