linux-postmarketos-exynos5: init
i'll need this for a default chromebook install
This commit is contained in:
File diff suppressed because it is too large
Load Diff
77
pkgs/additional/linux-postmarketos-exynos5/default.nix
Normal file
77
pkgs/additional/linux-postmarketos-exynos5/default.nix
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
{ lib
|
||||||
|
, linux_6_1
|
||||||
|
, linuxManualConfig
|
||||||
|
, writeTextFile
|
||||||
|
#v nixpkgs calls `.override` on the kernel to configure additional things
|
||||||
|
, features ? []
|
||||||
|
, randstructSeed ? ""
|
||||||
|
, ...
|
||||||
|
}@args:
|
||||||
|
|
||||||
|
let
|
||||||
|
# TODO: lift to shared module
|
||||||
|
parseKconfigLine = line: let
|
||||||
|
pieces = lib.splitString "=" line;
|
||||||
|
in
|
||||||
|
if lib.hasPrefix "#" (lib.head pieces) then [
|
||||||
|
# this line is a comment.
|
||||||
|
# N.B.: this could be like `# CONFIG_FOO is not set`, which i might want to report as `n`
|
||||||
|
] else if lib.length pieces == 1 then [
|
||||||
|
# no equals sign: this is probably a blank line
|
||||||
|
] else [{
|
||||||
|
name = lib.head pieces;
|
||||||
|
# value = parseKconfigValue (lib.concatStringsSep "=" (lib.tail pieces));
|
||||||
|
# nixpkgs kernel config is some real fucking bullshit: it wants a plain string here instead of the structured config it demands eeeeeeverywhere else.
|
||||||
|
value = lib.concatStringsSep "=" (lib.tail pieces);
|
||||||
|
}]
|
||||||
|
;
|
||||||
|
parseKconfig = wholeStr: let
|
||||||
|
lines = lib.splitString "\n" wholeStr;
|
||||||
|
parsedItems = lib.concatMap parseKconfigLine lines;
|
||||||
|
in
|
||||||
|
lib.listToAttrs parsedItems;
|
||||||
|
|
||||||
|
# remove CONFIG_LOCALVERSION else nixpkgs complains about mismatched modDirVersion
|
||||||
|
KconfigStr = lib.replaceStrings
|
||||||
|
[
|
||||||
|
''CONFIG_LOCALVERSION="-postmarketos-exynos5"''
|
||||||
|
''CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y''
|
||||||
|
''CONFIG_BATTERY_SBS=y''
|
||||||
|
]
|
||||||
|
[
|
||||||
|
''CONFIG_LOCALVERSION=''
|
||||||
|
# XXX(2024/06/06): if the bzImage is too large, it fails to boot.
|
||||||
|
# probably an issue with the uboot relocations; not sure exactly what the size limit is.
|
||||||
|
''CONFIG_CC_OPTIMIZE_FOR_SIZE=y''
|
||||||
|
# XXX(2024/06/06): if this module is loaded before udev, then kernel panic.
|
||||||
|
# see: <repo:NixOS/mobile-nixos:devices/families/mainline-chromeos/default.nix>
|
||||||
|
''CONFIG_BATTERY_SBS=m''
|
||||||
|
]
|
||||||
|
(builtins.readFile ./config-postmarketos-exynos5.arm7)
|
||||||
|
+ ''
|
||||||
|
#
|
||||||
|
# Extra nixpkgs-specific options
|
||||||
|
# nixos/modules/system/boot/systemd.nix wants CONFIG_DMIID
|
||||||
|
#
|
||||||
|
CONFIG_DMIID=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Extra sane-specific options
|
||||||
|
#
|
||||||
|
CONFIG_SECURITY_LANDLOCK=y
|
||||||
|
CONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,selinux,smack,tomoyo,apparmor,bpf";
|
||||||
|
|
||||||
|
'';
|
||||||
|
in linuxManualConfig {
|
||||||
|
inherit (linux_6_1) extraMakeFlags modDirVersion src version;
|
||||||
|
inherit features randstructSeed;
|
||||||
|
kernelPatches = args.kernelPatches or [];
|
||||||
|
|
||||||
|
configfile = writeTextFile {
|
||||||
|
name = "config-postmarketos-exynos5.arm7";
|
||||||
|
text = KconfigStr;
|
||||||
|
};
|
||||||
|
# nixpkgs requires to know the config as an attrset, to do various eval-time assertions.
|
||||||
|
# this forces me to include the Kconfig inline, instead of fetching it the way i do all the other pmOS kernel stuff.
|
||||||
|
config = parseKconfig KconfigStr;
|
||||||
|
}
|
@@ -56,7 +56,8 @@ let
|
|||||||
# XXX: eval error: need to port past linux_6_4
|
# XXX: eval error: need to port past linux_6_4
|
||||||
# linux-manjaro = callPackage ./additional/linux-manjaro { };
|
# linux-manjaro = callPackage ./additional/linux-manjaro { };
|
||||||
linux-megous = callPackage ./additional/linux-megous { };
|
linux-megous = callPackage ./additional/linux-megous { };
|
||||||
linux-postmarketos = callPackage ./additional/linux-postmarketos { };
|
linux-postmarketos = callPackage ./additional/linux-postmarketos { }; #< TODO: rename -> linux-postmarketos-allwinner
|
||||||
|
linux-postmarketos-exynos5 = callPackage ./additional/linux-postmarketos-exynos5 { };
|
||||||
mcg = callPackage ./additional/mcg { };
|
mcg = callPackage ./additional/mcg { };
|
||||||
megapixels-next = callPackage ./additional/megapixels-next { };
|
megapixels-next = callPackage ./additional/megapixels-next { };
|
||||||
modemmanager-split = callPackage ./additional/modemmanager-split { };
|
modemmanager-split = callPackage ./additional/modemmanager-split { };
|
||||||
|
Reference in New Issue
Block a user