Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ See code for all available configurations.
| [Panasonic Let's Note CF-LX4](panasonic/letsnote/cf-lx4) | `<nixos-hardware/panasonic/letsnote/cf-lx4>` |
| [PC Engines APU](pcengines/apu) | `<nixos-hardware/pcengines/apu>` |
| [PINE64 Pinebook Pro](pine64/pinebook-pro/) | `<nixos-hardware/pine64/pinebook-pro>` |
| [PINE64 Pinephone Pro](pine64/pinephone-pro/) | `<nixos-hardware/pine64/pinephone-pro>` |
| [PINE64 RockPro64](pine64/rockpro64/) | `<nixos-hardware/pine64/rockpro64>` |
| [PINE64 STAR64](pine64/star64/) | `<nixos-hardware/pine64/star64>` |
| [Protectli VP4670](protectli/vp4670/) | `<nixos-hardware/protectli/vp4670>` |
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
olimex-teres_i = import ./olimex/teres_i;
pcengines-apu = import ./pcengines/apu;
pine64-pinebook-pro = import ./pine64/pinebook-pro;
pine64-pinephone-pro = import ./pine64/pinephone-pro;
pine64-rockpro64 = import ./pine64/rockpro64;
pine64-star64 = import ./pine64/star64;
protectli-vp4670 = import ./protectli/vp4670;
Expand Down
13 changes: 13 additions & 0 deletions pine64/pinephone-pro/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Pine64 PinePhone Pro
## Bootloader
Either [Tow-Boot](https://github.com/Tow-Boot/Tow-Boot) or Megi's [rk2aw](https://xnux.eu/rk2aw/) are recommended to
allow boot via `boot.loader.generic-extlinux-compatible`. rk2aw features a touch-based boot selection which should
provide the ability to choose the NixOS generation.

## Known Issues
- Audio is currently broken
- The `brcmfmac` driver regularly spews the following error `brcmf_set_channel: set chanspec 0x???? fail, reason -52`
this has been somewhat alleviated by [disabling SAE](./wifi.nix#L7) to the point of allowing WiFi to function
but the issue still remains.
- The cameras are curretly broken, patches exist but need to be rebased to be applicable
- panfrost crashes sometimes
41 changes: 41 additions & 0 deletions pine64/pinephone-pro/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.hardware.pinephone-pro;
in
{
imports = [ ./wifi.nix ];
options.hardware.pinephone-pro = {
install-ucm2-rules = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to install PinePhone Pro specific UCM2 rules.
These provide audio usecaseses for HiFi audio and Voice calls.
'';
};
};
config = {
nixpkgs.overlays = [
(final: _prev: {
pine64-alsa-ucm = final.callPackage ./pine64-alsa-ucm { };
firmware_pinephone-pro = pkgs.callPackage ./firmware.nix { };
linuxPackages_pinephone-pro = pkgs.callPackage ./kernel { inherit (config.boot) kernelPatches; };
})
];
hardware.firmware = [ pkgs.firmware_pinephone-pro ];
environment.systemPackages = lib.optionals cfg.install-ucm2-rules [ pkgs.pine64-alsa-ucm ];

boot = {
kernelPackages = pkgs.linuxPackagesFor pkgs.linuxPackages_pinephone-pro;
loader = {
generic-extlinux-compatible.enable = true;
grub.enable = false;
};
};
};
}
70 changes: 70 additions & 0 deletions pine64/pinephone-pro/firmware.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# MIT License

# Copyright (c) 2018-2020 Samuel Dionne-Riel and the Mobile NixOS contributors

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

{
runCommand,
firmwareLinuxNonfree,
fetchgit,
fetchFromGitLab,
}:

let
pinephonepro-firmware = fetchFromGitLab {
domain = "gitlab.manjaro.org";
owner = "tsys";
repo = "pinebook-firmware";
rev = "937f0d52d27d7712da6a008d35fd7c2819e2b077";
sha256 = "sha256-Ij5u4IF55kPFs1BGq/sLlI3fjufwSjqrf8OZ2WnvjWI=";
};
ap6256-firmware = fetchFromGitLab {
domain = "gitlab.manjaro.org";
owner = "manjaro-arm";
repo = "packages%2Fcommunity%2Fap6256-firmware";
rev = "a30bf312b268eab42d38fab0cc3ed3177895ff5d";
sha256 = "sha256-i2OEkn7RtEMbJd0sYEE2Hpkvw6KRppz5AbwXJFNa/pE=";
};
brcm-firmware = fetchgit {
url = "https://megous.com/git/linux-firmware";
rev = "6e8e591e17e207644dfe747e51026967bb1edab5";
sha256 = "sha256-TaGwT0XvbxrfqEzUAdg18Yxr32oS+RffN+yzSXebtac=";
};
in

# The minimum set of firmware files required for the device.
runCommand "pine64-pinephonepro-firmware" { src = firmwareLinuxNonfree; } ''
for firmware in \
rockchip/dptx.bin \
; do
mkdir -p "$(dirname $out/lib/firmware/$firmware)"
cp -vrf "$src/lib/firmware/$firmware" $out/lib/firmware/$firmware
done

(PS4=" $ "; set -x
mkdir -p $out/lib/firmware/{brcm,rockchip}
(cd ${ap6256-firmware}
cp -fv *.hcd *blob *.bin *.txt $out/lib/firmware/brcm/
)
cp -fv ${pinephonepro-firmware}/brcm/* $out/lib/firmware/brcm/
cp -fv ${pinephonepro-firmware}/rockchip/* $out/lib/firmware/rockchip/
cp -fv ${brcm-firmware}/brcm/*43455* $out/lib/firmware/brcm/
)
''
3 changes: 3 additions & 0 deletions pine64/pinephone-pro/kernel/builder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source $stdenv/setup
cat $patches | unxz | patch -p1 -N -r -||true
cp -r $src $out
53 changes: 53 additions & 0 deletions pine64/pinephone-pro/kernel/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
lib,
fetchFromGitLab,
fetchurl,
kernelPatches,
callPackage,
buildLinux,
...
}@args:
let
pver = "6.6.44";

src_pine64 = fetchFromGitLab {
owner = "pine64-org";
repo = "linux";
rev = "ppp-6.6-20231104-22589";
sha256 = "sha256-wz2g+wE1DmhQQoldeiWEju3PaxSTIcqLSwamjzry+nc=";
};
#apply mainline fixver patches
upstream_patch = fetchurl {
url = "https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-${pver}.xz";
hash = "sha256-SSDqB/mqUmEWcf7fhZ3RRvGc2wvauORBuVl2ovJjX5M=";
};

ksrc = import ./source.nix;

apply_patch = (
path: {
name = builtins.baseNameOf path;
patch = path;
}
);
patches = [ ./pinephonepro_defconfig.patch ];
in
buildLinux (
args
// {
version = pver;
# todo: find out why builder complains about patch-version
modDirVersion = "${lib.versions.majorMinor pver}.0";
src = callPackage ksrc {
inherit pver upstream_patch;
src = src_pine64;
};
defconfig = "pinephonepro_defconfig";
kernelPatches = kernelPatches ++ map apply_patch patches;
extraMeta = {
platforms = lib.platforms.aarch64;
hydraPlatforms = [ "aarch64-linux" ];
};
}
// args.argsOverride or { }
)
Loading