Compare commits
2 commits
79154f71b1
...
910055176f
Author | SHA1 | Date | |
---|---|---|---|
chayleaf | 910055176f | ||
chayleaf | 04ffe78439 |
|
@ -189,12 +189,10 @@
|
|||
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;
|
||||
hardware = inputs.nixos-hardware.nixosModules;
|
||||
} // args.specialArgs or { };
|
||||
specialArgs = { inherit inputs lib; } // 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,9 +93,7 @@ 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.ccachePkgs.buildLinuxWithCcache pkgs-kernel.hw.bpi-r3.linux);
|
||||
boot.kernelPackages = pkgs-kernel.linuxPackagesFor (pkgs-kernel.buildLinuxWithCcache pkgs-kernel.linux_bpiR3);
|
||||
|
||||
hardware.deviceTree.enable = true;
|
||||
hardware.deviceTree.filter = "mt7986a-bananapi-bpi-r3.dtb";
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
, ... }:
|
||||
|
||||
let
|
||||
mkArmTrustedFirmwareBpiR3 = { bootDevice, uboot ? null }: pkgs.buildArmTrustedFirmware rec {
|
||||
armTrustedFirmwareBpiR3 = { 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
|
||||
mkUbootConfig = storage: ''
|
||||
ubootConfig = storage: ''
|
||||
CONFIG_AUTOBOOT=y
|
||||
CONFIG_BOOTCOMMAND="${builtins.replaceStrings [ "\n" ] [ "; " ] ''
|
||||
setenv boot_prefixes /@boot/ /@/ /boot/ /
|
||||
|
@ -61,9 +61,9 @@ let
|
|||
};
|
||||
|
||||
in rec {
|
||||
sd.uboot = pkgs.buildUBoot {
|
||||
ubootBpiR3Sd = pkgs.buildUBoot {
|
||||
defconfig = "mt7986a_bpir3_sd_defconfig";
|
||||
extraConfig = mkUbootConfig "sd";
|
||||
extraConfig = ubootConfig "sd";
|
||||
src = ubootSrc;
|
||||
version = ubootVersion;
|
||||
extraMeta.platforms = [ "aarch64-linux" ];
|
||||
|
@ -71,52 +71,52 @@ in rec {
|
|||
patches = [ ./mt7986-default-bootcmd.patch ];
|
||||
filesToInstall = [ "u-boot.bin" ];
|
||||
};
|
||||
emmc.uboot = pkgs.buildUBoot {
|
||||
ubootBpiR3Emmc = pkgs.buildUBoot {
|
||||
defconfig = "mt7986a_bpir3_emmc_defconfig";
|
||||
extraConfig = mkUbootConfig "emmc";
|
||||
extraConfig = ubootConfig "emmc";
|
||||
src = ubootSrc;
|
||||
version = ubootVersion;
|
||||
extraMeta.platforms = [ "aarch64-linux" ];
|
||||
patches = [ ./mt7986-default-bootcmd.patch ];
|
||||
filesToInstall = [ "u-boot.bin" ];
|
||||
};
|
||||
sd.armTrustedFirmware = mkArmTrustedFirmwareBpiR3 { inherit (sd) uboot; bootDevice = "sdmmc"; };
|
||||
emmc.armTrustedFirmware = mkArmTrustedFirmwareBpiR3 { inherit (emmc) uboot; bootDevice = "emmc"; };
|
||||
combinedStuff = pkgs.stdenvNoCC.mkDerivation {
|
||||
armTrustedFirmwareBpiR3Sd = armTrustedFirmwareBpiR3 { uboot = ubootBpiR3Sd; bootDevice = "sdmmc"; };
|
||||
armTrustedFirmwareBpiR3Emmc = armTrustedFirmwareBpiR3 { uboot = ubootBpiR3Emmc; bootDevice = "emmc"; };
|
||||
bpiR3StuffCombined = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "bpi-r3-stuff";
|
||||
unpackPhase = "true";
|
||||
buildPhase = "true";
|
||||
installPhase = ''
|
||||
mkdir -p $out/sd
|
||||
mkdir -p $out/emmc
|
||||
cp ${emmc.stuff}/* $out/emmc
|
||||
cp ${sd.stuff}/* $out/sd
|
||||
cp ${bpiR3StuffEmmc}/* $out/emmc
|
||||
cp ${bpiR3StuffSd}/* $out/sd
|
||||
'';
|
||||
fixupPhase = "true";
|
||||
};
|
||||
emmc.stuff = pkgs.stdenvNoCC.mkDerivation {
|
||||
bpiR3StuffEmmc = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "bpi-r3-stuff-emmc";
|
||||
unpackPhase = "true";
|
||||
buildPhase = "true";
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp ${emmc.uboot}/*.* $out
|
||||
cp ${emmc.armTrustedFirmware}/*.* $out
|
||||
cp ${ubootBpiR3Emmc}/*.* $out
|
||||
cp ${armTrustedFirmwareBpiR3Emmc}/*.* $out
|
||||
'';
|
||||
fixupPhase = "true";
|
||||
};
|
||||
sd.stuff = pkgs.stdenvNoCC.mkDerivation {
|
||||
bpiR3StuffSd = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "bpi-r3-stuff-sd";
|
||||
unpackPhase = "true";
|
||||
buildPhase = "true";
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp ${sd.uboot}/*.* $out
|
||||
cp ${sd.armTrustedFirmware}/*.* $out
|
||||
cp ${ubootBpiR3Sd}/*.* $out
|
||||
cp ${armTrustedFirmwareBpiR3Sd}/*.* $out
|
||||
'';
|
||||
fixupPhase = "true";
|
||||
};
|
||||
linux = pkgs.linux_latest.override {
|
||||
linux_bpiR3 = 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 = pkgs.linuxPackagesFor linux;
|
||||
linuxPackages_bpiR3 = pkgs.linuxPackagesFor linux_bpiR3;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
let
|
||||
cfg = config.phone;
|
||||
hw = pkgs.hw.oneplus-enchilada;
|
||||
hw-kernel = pkgs-kernel.hw.oneplus-enchilada;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
@ -30,21 +28,16 @@ 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 = [ hw.alsa-ucm-conf ];
|
||||
environment.systemPackages = [ pkgs.alsa-ucm-conf-enchilada ];
|
||||
systemd.services.q6voiced = {
|
||||
description = "QDSP6 driver daemon";
|
||||
after = [ "ModemManager.service" "dbus.socket" ];
|
||||
wantedBy = [ "ModemManager.service" ];
|
||||
requires = [ "dbus.socket" ];
|
||||
serviceConfig.ExecStart = "${hw.q6voiced}/bin/q6voiced hw:0,6";
|
||||
serviceConfig.ExecStart = "${pkgs.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
|
||||
|
@ -70,8 +63,8 @@ in
|
|||
percentageAction = 3;
|
||||
criticalPowerAction = "PowerOff";
|
||||
};
|
||||
hardware.firmware = lib.mkAfter [ hw.firmware ];
|
||||
boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor hw-kernel.linux_ccache);
|
||||
hardware.firmware = lib.mkAfter [ pkgs.firmware-oneplus-sdm845 ];
|
||||
boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor pkgs-kernel.linux_enchilada_ccache);
|
||||
hardware.deviceTree.enable = true;
|
||||
hardware.deviceTree.name = "qcom/sdm845-oneplus-enchilada.dtb";
|
||||
# loglevel=7 console=ttyMSM0,115200 is a way to delay boot
|
||||
|
@ -87,7 +80,7 @@ in
|
|||
"firmware-oneplus-sdm845"
|
||||
"firmware-oneplus-sdm845-xz"
|
||||
];
|
||||
system.build.uboot = pkgs.ubootImage;
|
||||
system.build.uboot = pkgs.ubootImageEnchilada;
|
||||
boot.initrd.includeDefaultModules = false;
|
||||
boot.initrd.availableKernelModules = [
|
||||
"sd_mod"
|
||||
|
@ -195,7 +188,7 @@ in
|
|||
};
|
||||
|
||||
boot.initrd.extraUtilsCommands = ''
|
||||
copy_bin_and_libs ${hw.adbd}/bin/adbd
|
||||
copy_bin_and_libs ${pkgs.adbd}/bin/adbd
|
||||
cp -pv ${pkgs.glibc.out}/lib/libnss_files.so.* $out/lib
|
||||
'';
|
||||
|
||||
|
@ -230,7 +223,7 @@ in
|
|||
description = "adb daemon";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${hw.adbd}/bin/adbd";
|
||||
ExecStart = "${pkgs.adbd}/bin/adbd";
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -35,7 +35,7 @@ in {
|
|||
meta.license = lib.licenses.mit;
|
||||
};
|
||||
|
||||
alsa-ucm-conf = pkgs.stdenvNoCC.mkDerivation {
|
||||
alsa-ucm-conf-enchilada = pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "alsa-ucm-conf-enchilada";
|
||||
version = "unstable-2022-12-08";
|
||||
src = pkgs.fetchFromGitLab {
|
||||
|
@ -55,7 +55,7 @@ in {
|
|||
meta.priority = -10;
|
||||
};
|
||||
|
||||
uboot = pkgs.buildUBoot {
|
||||
ubootEnchilada = 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" ];
|
||||
};
|
||||
|
||||
ubootImage = pkgs.stdenvNoCC.mkDerivation {
|
||||
ubootImageEnchilada = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "u-boot-enchilada.img";
|
||||
nativeBuildInputs = [
|
||||
# available from mobile-nixos's overlay
|
||||
|
@ -97,13 +97,13 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
firmware = pkgs.stdenvNoCC.mkDerivation {
|
||||
firmware-oneplus-sdm845 = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "firmware-oneplus-sdm845";
|
||||
src = pkgs.fetchFromGitLab {
|
||||
owner = "sdm845-mainline";
|
||||
repo = "firmware-oneplus-sdm845";
|
||||
rev = "176ca713448c5237a983fb1f158cf3a5c251d775";
|
||||
hash = "sha256-ZrBvYO+MY0tlamJngdwhCsI1qpA/2FXoyEys5FAYLj4=";
|
||||
rev = "dc9c77f220d104d7224c03fcbfc419a03a58765e";
|
||||
hash = "sha256-jrbWIS4T9HgBPYOV2MqPiRQCxGMDEfQidKw9Jn5pgBI=";
|
||||
};
|
||||
installPhase = ''
|
||||
cp -a . "$out"
|
||||
|
@ -119,7 +119,7 @@ in {
|
|||
meta.license = lib.licenses.unfreeRedistributableFirmware;
|
||||
};
|
||||
|
||||
linux = pkgs.linux_latest.override {
|
||||
linux_enchilada = 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_ccache = pkgs'.ccachePkgs.buildLinuxWithCcache pkgs'.hw.oneplus-enchilada.linux;
|
||||
linux_enchilada_ccache = pkgs'.buildLinuxWithCcache pkgs'.linux_enchilada;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue