Compare commits
2 commits
910055176f
...
79154f71b1
Author | SHA1 | Date | |
---|---|---|---|
chayleaf | 79154f71b1 | ||
chayleaf | 7aacb1449a |
|
@ -189,10 +189,12 @@
|
|||
inherit (args) system;
|
||||
# allow modules to access nixpkgs directly, use customized lib,
|
||||
# and pass nixos-harware to let hardware modules import parts of nixos-hardware
|
||||
specialArgs = { inherit inputs lib; } // args.specialArgs or { };
|
||||
specialArgs = {
|
||||
inherit inputs lib;
|
||||
hardware = inputs.nixos-hardware.nixosModules;
|
||||
} // args.specialArgs or { };
|
||||
modules = [
|
||||
{ _module.args = {
|
||||
hardware = inputs.nixos-hardware.nixosModules;
|
||||
pkgs-kernel = import inputs.nixpkgs-kernel { inherit (args) system; overlays = all-overlays; };
|
||||
}; }
|
||||
(getPrivSys hostname)
|
||||
|
|
|
@ -93,7 +93,9 @@ in
|
|||
qemu = pkgs'.qemu_7_ccache;
|
||||
stdenv = pkgs'.ccacheStdenv;
|
||||
};
|
||||
ccachePkgs = import ./ccache.nix { inherit pkgs pkgs' lib sources; };
|
||||
|
||||
# hardware stuff
|
||||
hw.bpi-r3 = import ../system/hardware/bpi-r3/pkgs.nix { inherit pkgs pkgs' lib sources; };
|
||||
hw.oneplus-enchilada = import ../system/hardware/oneplus-enchilada/pkgs.nix { inherit inputs pkgs pkgs' lib sources; };
|
||||
}
|
||||
// import ./ccache.nix { inherit pkgs pkgs' lib sources; }
|
||||
// import ../system/hardware/bpi-r3/pkgs.nix { inherit pkgs pkgs' lib sources; }
|
||||
// import ../system/hardware/oneplus-enchilada/pkgs.nix { inherit inputs pkgs pkgs' lib sources; }
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
|
||||
boot.kernelPackages = pkgs-kernel.linuxPackagesFor (pkgs-kernel.buildLinuxWithCcache pkgs-kernel.linux_bpiR3);
|
||||
boot.kernelPackages = pkgs-kernel.linuxPackagesFor (pkgs-kernel.ccachePkgs.buildLinuxWithCcache pkgs-kernel.hw.bpi-r3.linux);
|
||||
|
||||
hardware.deviceTree.enable = true;
|
||||
hardware.deviceTree.filter = "mt7986a-bananapi-bpi-r3.dtb";
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
, ... }:
|
||||
|
||||
let
|
||||
armTrustedFirmwareBpiR3 = { bootDevice, uboot ? null }: pkgs.buildArmTrustedFirmware rec {
|
||||
mkArmTrustedFirmwareBpiR3 = { bootDevice, uboot ? null }: pkgs.buildArmTrustedFirmware rec {
|
||||
inherit (sources.atf-bpir3) src;
|
||||
patches = [ ./bpi-r3-atf-backport-mkimage-support.patch ];
|
||||
extraMakeFlags = assert builtins.elem bootDevice [
|
||||
|
@ -36,7 +36,7 @@ let
|
|||
# CONFIG_DISTRO_DEFAULTS - surely this won't hurt, it adds autocomplete and stuff and doesn't weight much in the large scale of things
|
||||
# CONFIG_SYS_BOOTM_LEN - increase max initrd? size
|
||||
# CONFIG_ZSTD - allow zstd initrd
|
||||
ubootConfig = storage: ''
|
||||
mkUbootConfig = storage: ''
|
||||
CONFIG_AUTOBOOT=y
|
||||
CONFIG_BOOTCOMMAND="${builtins.replaceStrings [ "\n" ] [ "; " ] ''
|
||||
setenv boot_prefixes /@boot/ /@/ /boot/ /
|
||||
|
@ -61,9 +61,9 @@ let
|
|||
};
|
||||
|
||||
in rec {
|
||||
ubootBpiR3Sd = pkgs.buildUBoot {
|
||||
sd.uboot = pkgs.buildUBoot {
|
||||
defconfig = "mt7986a_bpir3_sd_defconfig";
|
||||
extraConfig = ubootConfig "sd";
|
||||
extraConfig = mkUbootConfig "sd";
|
||||
src = ubootSrc;
|
||||
version = ubootVersion;
|
||||
extraMeta.platforms = [ "aarch64-linux" ];
|
||||
|
@ -71,52 +71,52 @@ in rec {
|
|||
patches = [ ./mt7986-default-bootcmd.patch ];
|
||||
filesToInstall = [ "u-boot.bin" ];
|
||||
};
|
||||
ubootBpiR3Emmc = pkgs.buildUBoot {
|
||||
emmc.uboot = pkgs.buildUBoot {
|
||||
defconfig = "mt7986a_bpir3_emmc_defconfig";
|
||||
extraConfig = ubootConfig "emmc";
|
||||
extraConfig = mkUbootConfig "emmc";
|
||||
src = ubootSrc;
|
||||
version = ubootVersion;
|
||||
extraMeta.platforms = [ "aarch64-linux" ];
|
||||
patches = [ ./mt7986-default-bootcmd.patch ];
|
||||
filesToInstall = [ "u-boot.bin" ];
|
||||
};
|
||||
armTrustedFirmwareBpiR3Sd = armTrustedFirmwareBpiR3 { uboot = ubootBpiR3Sd; bootDevice = "sdmmc"; };
|
||||
armTrustedFirmwareBpiR3Emmc = armTrustedFirmwareBpiR3 { uboot = ubootBpiR3Emmc; bootDevice = "emmc"; };
|
||||
bpiR3StuffCombined = pkgs.stdenvNoCC.mkDerivation {
|
||||
sd.armTrustedFirmware = mkArmTrustedFirmwareBpiR3 { inherit (sd) uboot; bootDevice = "sdmmc"; };
|
||||
emmc.armTrustedFirmware = mkArmTrustedFirmwareBpiR3 { inherit (emmc) uboot; bootDevice = "emmc"; };
|
||||
combinedStuff = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "bpi-r3-stuff";
|
||||
unpackPhase = "true";
|
||||
buildPhase = "true";
|
||||
installPhase = ''
|
||||
mkdir -p $out/sd
|
||||
mkdir -p $out/emmc
|
||||
cp ${bpiR3StuffEmmc}/* $out/emmc
|
||||
cp ${bpiR3StuffSd}/* $out/sd
|
||||
cp ${emmc.stuff}/* $out/emmc
|
||||
cp ${sd.stuff}/* $out/sd
|
||||
'';
|
||||
fixupPhase = "true";
|
||||
};
|
||||
bpiR3StuffEmmc = pkgs.stdenvNoCC.mkDerivation {
|
||||
emmc.stuff = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "bpi-r3-stuff-emmc";
|
||||
unpackPhase = "true";
|
||||
buildPhase = "true";
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp ${ubootBpiR3Emmc}/*.* $out
|
||||
cp ${armTrustedFirmwareBpiR3Emmc}/*.* $out
|
||||
cp ${emmc.uboot}/*.* $out
|
||||
cp ${emmc.armTrustedFirmware}/*.* $out
|
||||
'';
|
||||
fixupPhase = "true";
|
||||
};
|
||||
bpiR3StuffSd = pkgs.stdenvNoCC.mkDerivation {
|
||||
sd.stuff = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "bpi-r3-stuff-sd";
|
||||
unpackPhase = "true";
|
||||
buildPhase = "true";
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp ${ubootBpiR3Sd}/*.* $out
|
||||
cp ${armTrustedFirmwareBpiR3Sd}/*.* $out
|
||||
cp ${sd.uboot}/*.* $out
|
||||
cp ${sd.armTrustedFirmware}/*.* $out
|
||||
'';
|
||||
fixupPhase = "true";
|
||||
};
|
||||
linux_bpiR3 = pkgs.linux_latest.override {
|
||||
linux = pkgs.linux_latest.override {
|
||||
ignoreConfigErrors = false;
|
||||
# there's probably more enabled-by-default configs that are better left disabled, but whatever
|
||||
structuredExtraConfig = with lib.kernel; {
|
||||
|
@ -351,5 +351,5 @@ in rec {
|
|||
XEN_PVHVM.tristate = lib.mkForce null; XEN_SAVE_RESTORE.tristate = lib.mkForce null; XEN_SYS_HYPERVISOR.tristate = lib.mkForce null;
|
||||
};
|
||||
};
|
||||
linuxPackages_bpiR3 = pkgs.linuxPackagesFor linux_bpiR3;
|
||||
linuxPackages = pkgs.linuxPackagesFor linux;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
let
|
||||
cfg = config.phone;
|
||||
hw = pkgs.hw.oneplus-enchilada;
|
||||
hw-kernel = pkgs-kernel.hw.oneplus-enchilada;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
@ -28,16 +30,21 @@ in
|
|||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
inherit (self.hw.oneplus-enchilada) pd-mapper qrtr rmtfs tqftpserv;
|
||||
})
|
||||
];
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
mobile.quirks.qualcomm.sdm845-modem.enable = true;
|
||||
mobile.quirks.audio.alsa-ucm-meld = true;
|
||||
environment.systemPackages = [ pkgs.alsa-ucm-conf-enchilada ];
|
||||
environment.systemPackages = [ hw.alsa-ucm-conf ];
|
||||
systemd.services.q6voiced = {
|
||||
description = "QDSP6 driver daemon";
|
||||
after = [ "ModemManager.service" "dbus.socket" ];
|
||||
wantedBy = [ "ModemManager.service" ];
|
||||
requires = [ "dbus.socket" ];
|
||||
serviceConfig.ExecStart = "${pkgs.q6voiced}/bin/q6voiced hw:0,6";
|
||||
serviceConfig.ExecStart = "${hw.q6voiced}/bin/q6voiced hw:0,6";
|
||||
};
|
||||
# TODO when testing PipeWire instead of PulseAudio, the following is needed:
|
||||
# https://gitlab.freedesktop.org/pipewire/wireplumber/-/blob/master/docs/rst/daemon/configuration/migration.rst
|
||||
|
@ -63,8 +70,8 @@ in
|
|||
percentageAction = 3;
|
||||
criticalPowerAction = "PowerOff";
|
||||
};
|
||||
hardware.firmware = lib.mkAfter [ pkgs.firmware-oneplus-sdm845 ];
|
||||
boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor pkgs-kernel.linux_enchilada_ccache);
|
||||
hardware.firmware = lib.mkAfter [ hw.firmware ];
|
||||
boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor hw-kernel.linux_ccache);
|
||||
hardware.deviceTree.enable = true;
|
||||
hardware.deviceTree.name = "qcom/sdm845-oneplus-enchilada.dtb";
|
||||
# loglevel=7 console=ttyMSM0,115200 is a way to delay boot
|
||||
|
@ -80,7 +87,7 @@ in
|
|||
"firmware-oneplus-sdm845"
|
||||
"firmware-oneplus-sdm845-xz"
|
||||
];
|
||||
system.build.uboot = pkgs.ubootImageEnchilada;
|
||||
system.build.uboot = pkgs.ubootImage;
|
||||
boot.initrd.includeDefaultModules = false;
|
||||
boot.initrd.availableKernelModules = [
|
||||
"sd_mod"
|
||||
|
@ -188,7 +195,7 @@ in
|
|||
};
|
||||
|
||||
boot.initrd.extraUtilsCommands = ''
|
||||
copy_bin_and_libs ${pkgs.adbd}/bin/adbd
|
||||
copy_bin_and_libs ${hw.adbd}/bin/adbd
|
||||
cp -pv ${pkgs.glibc.out}/lib/libnss_files.so.* $out/lib
|
||||
'';
|
||||
|
||||
|
@ -223,7 +230,7 @@ in
|
|||
description = "adb daemon";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.adbd}/bin/adbd";
|
||||
ExecStart = "${hw.adbd}/bin/adbd";
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -35,7 +35,7 @@ in {
|
|||
meta.license = lib.licenses.mit;
|
||||
};
|
||||
|
||||
alsa-ucm-conf-enchilada = pkgs.stdenvNoCC.mkDerivation {
|
||||
alsa-ucm-conf = pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "alsa-ucm-conf-enchilada";
|
||||
version = "unstable-2022-12-08";
|
||||
src = pkgs.fetchFromGitLab {
|
||||
|
@ -55,7 +55,7 @@ in {
|
|||
meta.priority = -10;
|
||||
};
|
||||
|
||||
ubootEnchilada = pkgs.buildUBoot {
|
||||
uboot = pkgs.buildUBoot {
|
||||
defconfig = "qcom_defconfig";
|
||||
version = "unstable-2023-12-11";
|
||||
src = pkgs.fetchFromGitLab {
|
||||
|
@ -73,7 +73,7 @@ in {
|
|||
filesToInstall = [ "u-boot-nodtb.bin" "u-boot-dtb.bin" "u-boot.dtb" ];
|
||||
};
|
||||
|
||||
ubootImageEnchilada = pkgs.stdenvNoCC.mkDerivation {
|
||||
ubootImage = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "u-boot-enchilada.img";
|
||||
nativeBuildInputs = [
|
||||
# available from mobile-nixos's overlay
|
||||
|
@ -97,13 +97,13 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
firmware-oneplus-sdm845 = pkgs.stdenvNoCC.mkDerivation {
|
||||
firmware = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "firmware-oneplus-sdm845";
|
||||
src = pkgs.fetchFromGitLab {
|
||||
owner = "sdm845-mainline";
|
||||
repo = "firmware-oneplus-sdm845";
|
||||
rev = "dc9c77f220d104d7224c03fcbfc419a03a58765e";
|
||||
hash = "sha256-jrbWIS4T9HgBPYOV2MqPiRQCxGMDEfQidKw9Jn5pgBI=";
|
||||
rev = "176ca713448c5237a983fb1f158cf3a5c251d775";
|
||||
hash = "sha256-ZrBvYO+MY0tlamJngdwhCsI1qpA/2FXoyEys5FAYLj4=";
|
||||
};
|
||||
installPhase = ''
|
||||
cp -a . "$out"
|
||||
|
@ -119,7 +119,7 @@ in {
|
|||
meta.license = lib.licenses.unfreeRedistributableFirmware;
|
||||
};
|
||||
|
||||
linux_enchilada = pkgs.linux_latest.override {
|
||||
linux = pkgs.linux_latest.override {
|
||||
# TODO: uncomment
|
||||
# ignoreConfigErrors = false;
|
||||
kernelPatches = [
|
||||
|
@ -627,5 +627,5 @@ in {
|
|||
XEN_PVHVM.tristate = lib.mkForce null; XEN_SAVE_RESTORE.tristate = lib.mkForce null; XEN_SYS_HYPERVISOR.tristate = lib.mkForce null;
|
||||
};
|
||||
};
|
||||
linux_enchilada_ccache = pkgs'.buildLinuxWithCcache pkgs'.linux_enchilada;
|
||||
linux_ccache = pkgs'.ccachePkgs.buildLinuxWithCcache pkgs'.hw.oneplus-enchilada.linux;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue