pi4 stuff

This commit is contained in:
mjallen18
2025-12-30 20:40:22 -06:00
parent 5ee4da5b08
commit 374bd4348f
6 changed files with 39 additions and 33 deletions

View File

@@ -213,10 +213,10 @@
pi4 = { pi4 = {
modules = with inputs; [ modules = with inputs; [
disko.nixosModules.disko disko.nixosModules.disko
nixos-raspberrypi.nixosModules.raspberry-pi-4.base # nixos-raspberrypi.nixosModules.raspberry-pi-4.base
nixos-raspberrypi.nixosModules.raspberry-pi-4.display-vc4 # nixos-raspberrypi.nixosModules.raspberry-pi-4.display-vc4
nixos-raspberrypi.nixosModules.nixpkgs-rpi # nixos-raspberrypi.nixosModules.nixpkgs-rpi
nixos-raspberrypi.nixosModules.trusted-nix-caches # nixos-raspberrypi.nixosModules.trusted-nix-caches
# nixos-raspberrypi.lib.inject-overlays # nixos-raspberrypi.lib.inject-overlays
# nixos-raspberrypi.lib.inject-overlays-global # nixos-raspberrypi.lib.inject-overlays-global
]; ];

View File

@@ -68,7 +68,7 @@ let
}; };
ubootBuilder = import ./uboot-builder.nix { ubootBuilder = import ./uboot-builder.nix {
inherit pkgs; inherit pkgs;
ubootPackage = pkgs.${namespace}.uboot-pi5; ubootPackage = (if (cfg.variant == "5") then pkgs.${namespace}.uboot-pi5 else pkgs.${namespace}.uboot-pi4);
firmwareBuilder = firmwarePopulateCmd; firmwareBuilder = firmwarePopulateCmd;
extlinuxConfBuilder = config.boot.loader.generic-extlinux-compatible.populateCmd; extlinuxConfBuilder = config.boot.loader.generic-extlinux-compatible.populateCmd;
}; };
@@ -93,7 +93,7 @@ let
populateUbootBuilder = import ./uboot-builder.nix { populateUbootBuilder = import ./uboot-builder.nix {
inherit ubootBinName; inherit ubootBinName;
pkgs = pkgs.buildPackages; pkgs = pkgs.buildPackages;
ubootPackage = pkgs.${namespace}.uboot-pi5; ubootPackage = (if (cfg.variant == "5") then pkgs.${namespace}.uboot-pi5 else pkgs.${namespace}.uboot-pi4);
firmwareBuilder = firmwarePopulateCmd; firmwareBuilder = firmwarePopulateCmd;
extlinuxConfBuilder = config.boot.loader.generic-extlinux-compatible.populateCmd; extlinuxConfBuilder = config.boot.loader.generic-extlinux-compatible.populateCmd;
}; };
@@ -167,7 +167,7 @@ in
loader = { loader = {
generic-extlinux-compatible = { generic-extlinux-compatible = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
useGenerationDeviceTree = true; useGenerationDeviceTree = lib.mkOverride 60 true;
}; };
grub.enable = lib.mkForce false; grub.enable = lib.mkForce false;
}; };
@@ -214,7 +214,7 @@ in
/plugin/; /plugin/;
/ { / {
compatible = "raspberrypi,4-model-b"; compatible = "brcm,bcm2711";
fragment@0 { fragment@0 {
target-path = "/"; target-path = "/";
@@ -227,24 +227,24 @@ in
}; };
''; '';
} }
{ # {
name = "enable-xhci"; # name = "enable-xhci";
dtsText = '' # dtsText = ''
/dts-v1/; # /dts-v1/;
/plugin/; # /plugin/;
/ { # / {
compatible = "brcm,bcm2711"; # compatible = "brcm,bcm2711";
fragment@0 { # fragment@0 {
//target-path = "/scb/xhci@7e9c0000"; # //target-path = "/scb/xhci@7e9c0000";
target = <&xhci>; # target = <&xhci>;
__overlay__ { # __overlay__ {
status = "okay"; # status = "okay";
}; # };
}; # };
}; # };
''; # '';
} # }
] else ] else
[ [
{ {

View File

@@ -39,7 +39,7 @@ dtb_path=$SRC_FIRMWARE_DIR
echo "copying firmware..." echo "copying firmware..."
# Device Tree # Device Tree
useVendorDeviceTree=1
if [ -n "$useVendorDeviceTree" ]; then if [ -n "$useVendorDeviceTree" ]; then
echo -n "using vendor firmware from " echo -n "using vendor firmware from "
dtb_path=$SRC_FIRMWARE_DIR dtb_path=$SRC_FIRMWARE_DIR
@@ -50,6 +50,7 @@ fi
echo $dtb_path echo $dtb_path
DTBS=("$dtb_path"/*.dtb) DTBS=("$dtb_path"/*.dtb)
echo "dtbs all: $DTBS"
for dtb in "${DTBS[@]}"; do for dtb in "${DTBS[@]}"; do
# for dtb in $dtb_path/broadcom/*.dtb; do # for dtb in $dtb_path/broadcom/*.dtb; do
dst="$target/$(basename $dtb)" dst="$target/$(basename $dtb)"

View File

@@ -53,8 +53,10 @@ echo "$dtb_path"
# firmware package has dtbs in its root, # firmware package has dtbs in its root,
# dtbs built with kernel are in broadcom/ # dtbs built with kernel are in broadcom/
DTBS=("$dtb_path"/*.dtb "$dtb_path"/broadcom/*.dtb) DTBS=("$dtb_path"/*.dtb "$dtb_path"/broadcom/*.dtb)
echo "all dtbs: $DTBS"
for dtb in "${DTBS[@]}"; do for dtb in "${DTBS[@]}"; do
dst="$target/$(basename "$dtb")" dst="$target/$(basename "$dtb")"
echo "$dtb"
copyForced "$dtb" "$dst" copyForced "$dtb" "$dst"
filesCopied[$dst]=1 filesCopied[$dst]=1
done done

View File

@@ -36,5 +36,6 @@ in
linuxPackages_cachyos-rc-lto-znver4 = cachyosPackages.cachyos-rc-lto-znver4; linuxPackages_cachyos-rc-lto-znver4 = cachyosPackages.cachyos-rc-lto-znver4;
uboot-pi5 = ubootPackages.ubootRaspberryPi5; uboot-pi5 = ubootPackages.ubootRaspberryPi5;
uboot-pi4 = ubootPackages.ubootRaspberryPi4;
}; };
} }

View File

@@ -1,22 +1,24 @@
{ {
pkgs, pkgs,
lib, lib,
namespace,
... ...
}: }:
let let
kernelBundle = pkgs.linuxAndFirmware.latest; # kernelBundle = pkgs.linuxAndFirmware.latest;
in in
{ {
boot = { boot = {
loader.raspberry-pi = { # loader.raspberry-pi = {
firmwarePackage = kernelBundle.raspberrypifw; # firmwarePackage = kernelBundle.raspberrypifw;
variant = "4"; # variant = "4";
}; # };
kernelPackages = kernelBundle.linuxPackages_rpi4; # kernelPackages = kernelBundle.linuxPackages_rpi4;
kernelPackages = pkgs.${namespace}.linuxPackages_rpi4;
supportedFilesystems = lib.mkForce [ ]; supportedFilesystems = lib.mkForce [ ];
}; };
hardware.raspberry-pi.config = { ${namespace}.hardware.raspberry-pi.config = {
all = { all = {
# [all] conditional filter, https://www.raspberrypi.com/documentation/computers/config_txt.html#conditional-filters # [all] conditional filter, https://www.raspberrypi.com/documentation/computers/config_txt.html#conditional-filters