moby: try shipping the armbian kernel with (close to) the pmOS defconfig
it builds, but the camera is just as broken as w/o pmOS config
This commit is contained in:
@@ -32,7 +32,10 @@ in
|
||||
# boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux-manjaro;
|
||||
# boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
|
||||
# boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_testing;
|
||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux-armbian;
|
||||
# boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux-armbian;
|
||||
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux-armbian.override {
|
||||
usePmosConfig = true;
|
||||
});
|
||||
|
||||
# nixpkgs.hostPlatform.linux-kernel becomes stdenv.hostPlatform.linux-kernel
|
||||
# ^ but only if using flakes (or rather, if *not* using `nixpkgs.nixos` to construct the host config)
|
||||
|
@@ -4,20 +4,21 @@
|
||||
lib,
|
||||
buildLinux,
|
||||
linux_latest,
|
||||
linux-postmarketos-allwinner,
|
||||
newScope,
|
||||
sane-kernel-tools,
|
||||
usePmosConfig ? false,
|
||||
#VVV nixpkgs calls `.override` on the kernel to configure additional things, but we don't care about those things
|
||||
features ? {},
|
||||
kernelPatches ? null,
|
||||
randstructSeed ? "",
|
||||
structuredExtraConfig ? {},
|
||||
}:
|
||||
...
|
||||
}@args:
|
||||
let
|
||||
linux = linux_latest;
|
||||
patches = import ./patches.nix { inherit fetchFromGitHub lib newScope; };
|
||||
in
|
||||
buildLinux {
|
||||
inherit (linux_latest) src version modDirVersion;
|
||||
inherit features randstructSeed structuredExtraConfig;
|
||||
# buildLinux {
|
||||
linux_latest.override {
|
||||
# inherit (linux_latest) src version modDirVersion;
|
||||
# inherit features randstructSeed structuredExtraConfig;
|
||||
|
||||
DTB = true; #< XXX: not sure if actually needed
|
||||
autoModules = true;
|
||||
@@ -358,6 +359,56 @@ buildLinux {
|
||||
RAID6_PQ_BENCHMARK = no;
|
||||
};
|
||||
}
|
||||
] ++ lib.optionals usePmosConfig [
|
||||
{
|
||||
name = "postmarketos-config";
|
||||
patch = null;
|
||||
extraStructuredConfig = builtins.removeAttrs
|
||||
(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
|
||||
"BINFMT_MISC"
|
||||
"DEFAULT_MMAP_MIN_ADDR"
|
||||
"IP_NF_TARGET_REDIRECT"
|
||||
"IP_PNP"
|
||||
"LOGO"
|
||||
"NLS_CODEPAGE_437"
|
||||
"NLS_DEFAULT"
|
||||
"NLS_ISO8859_1"
|
||||
"NR_CPUS"
|
||||
"PREEMPT"
|
||||
"RAID6_PQ_BENCHMARK"
|
||||
"STANDALONE"
|
||||
"TRANSPARENT_HUGEPAGE_ALWAYS"
|
||||
"UEVENT_HELPER"
|
||||
"USB_SERIAL"
|
||||
"ZSMALLOC"
|
||||
|
||||
# these options have changed since the version which pmos ships? or pmos just ships invalid values
|
||||
"BASE_SMALL"
|
||||
# "repeated questions"
|
||||
"NETFILTER_XT_TARGET_TPROXY"
|
||||
"NETFILTER_XT_MATCH_HASHLIMIT"
|
||||
"NETFILTER_XT_MATCH_SOCKET"
|
||||
"IP_NF_MATCH_RPFILTER"
|
||||
"CFG80211"
|
||||
"MAC80211"
|
||||
"DRM_SUN4I"
|
||||
"DRM_SUN6I_DSI"
|
||||
"DRM_SUN8I_DW_HDMI"
|
||||
"DRM_SUN8I_MIXER"
|
||||
"DRM_PANEL_FEIXIN_K101_IM2BA02"
|
||||
"DRM_PANEL_FEIYANG_FY07024DI26A30D"
|
||||
"DRM_PANEL_ILITEK_ILI9881C"
|
||||
"DRM_PANEL_SITRONIX_ST7703"
|
||||
"DRM_PANEL_SIMPLE"
|
||||
"DRM_LIMA"
|
||||
"DRM_PANFROST"
|
||||
"BLK_DEV_DM"
|
||||
"VFIO"
|
||||
]
|
||||
;
|
||||
}
|
||||
];
|
||||
|
||||
passthru = {
|
||||
|
@@ -64,7 +64,7 @@ let
|
||||
CONFIG_MODEM_POWER=y
|
||||
'';
|
||||
|
||||
in linuxManualConfig {
|
||||
in (linuxManualConfig {
|
||||
inherit src version modDirVersion randstructSeed;
|
||||
# inherit (linux-megous) extraMakeFlags modDirVersion src version;
|
||||
# inherit (linux-megous) kernelPatches;
|
||||
@@ -99,4 +99,8 @@ in linuxManualConfig {
|
||||
patch = linux-megous.passthruPatches.af8133j;
|
||||
}
|
||||
];
|
||||
}
|
||||
}).overrideAttrs (base: {
|
||||
passthru = (base.passthru or {}) // {
|
||||
inherit defconfigStr;
|
||||
};
|
||||
})
|
||||
|
@@ -1,7 +1,10 @@
|
||||
{ lib
|
||||
, newScope
|
||||
{
|
||||
lib,
|
||||
newScope,
|
||||
}:
|
||||
lib.makeScope newScope (self: with self; {
|
||||
# maps `CONFIG_FOO=y` to `[ { CONFIG_FOO = "y"; }]`
|
||||
# maps `# CONFIG_FOO is not set` to `[]`
|
||||
parseDefconfigLine = line: let
|
||||
pieces = lib.splitString "=" line;
|
||||
in
|
||||
@@ -16,11 +19,33 @@ lib.makeScope newScope (self: with self; {
|
||||
value = lib.concatStringsSep "=" (lib.tail pieces);
|
||||
}]
|
||||
;
|
||||
|
||||
# parseDefconfig: given the entire text of a defconfig file
|
||||
# parse it into an attrset usable by the nixpkgs kernel config tools.
|
||||
# this is not meant for `extraStructuredConfig`, but stuff further downstream.
|
||||
# results are like ` { CONFIG_FOO = "y"; CONFIG_FOO_BAR = "128"; }`
|
||||
parseDefconfig = wholeStr: let
|
||||
lines = lib.splitString "\n" wholeStr;
|
||||
parsedItems = lib.concatMap parseDefconfigLine lines;
|
||||
in
|
||||
lib.listToAttrs parsedItems;
|
||||
|
||||
parseDefconfigStructured = wholeStr: let
|
||||
asKV = parseDefconfig wholeStr;
|
||||
in lib.mapAttrs' (k: v: {
|
||||
name = lib.removePrefix "CONFIG_" k;
|
||||
value = with lib.kernel;
|
||||
if v == "y" then yes
|
||||
else if v == "n" then no
|
||||
else if v == "m" then module
|
||||
else if lib.hasPrefix ''"'' v && lib.hasSuffix ''"'' v then freeform (builtins.fromJSON v)
|
||||
else freeform v
|
||||
;
|
||||
}) asKV;
|
||||
|
||||
# configs like `CONFIG_LOCALVERSION=""`, transformed into `LOCALVERSION = freeform ""`,
|
||||
# can confuse the kernel build process. remove those empty strings.
|
||||
parseDefconfigStructuredNonempty = wholeStr: let
|
||||
asAttrs = parseDefconfigStructured wholeStr;
|
||||
in lib.filterAttrs (k: v: v != lib.kernel.freeform "") asAttrs;
|
||||
})
|
||||
|
Reference in New Issue
Block a user