127 lines
3.7 KiB
Nix
Executable File
127 lines
3.7 KiB
Nix
Executable File
{
|
|
pkgs,
|
|
lib,
|
|
namespace,
|
|
...
|
|
}:
|
|
{
|
|
boot = {
|
|
# loader.raspberry-pi = {
|
|
# bootloader = "kernel";
|
|
# firmwarePackage = pkgs.raspberrypifw;
|
|
# };
|
|
kernelPackages = pkgs.${namespace}.linuxPackages_rpi5-latest;
|
|
initrd = {
|
|
availableKernelModules = lib.mkForce [ ];
|
|
kernelModules = {
|
|
bcachefs = lib.mkForce false;
|
|
};
|
|
};
|
|
supportedFilesystems = lib.mkForce [ ];
|
|
};
|
|
|
|
nixpkgs = {
|
|
overlays = [
|
|
(_self: _super: {
|
|
linuxPackages_pi5-16k = pkgs.linuxPackagesFor (
|
|
pkgs.linux_6_19.override {
|
|
structuredExtraConfig = with lib.kernel; {
|
|
CONFIG_ARM64_4K_PAGES = lib.mkForce no;
|
|
CONFIG_ARM64_64K_PAGES = lib.mkForce no;
|
|
CONFIG_ARM64_16K_PAGES = lib.mkForce yes;
|
|
CONFIG_OF = yes;
|
|
CONFIG_OF_CONFIGFS = yes;
|
|
CONFIG_CONFIGFS_FS = yes;
|
|
CONFIG_OF_OVERLAY = yes;
|
|
};
|
|
ignoreConfigErrors = true;
|
|
}
|
|
);
|
|
})
|
|
];
|
|
};
|
|
|
|
specialisation = {
|
|
"linux-stable".configuration = {
|
|
boot = {
|
|
kernelPackages = lib.mkOverride 90 pkgs.${namespace}.linuxPackages_rpi5-lts;
|
|
# loader.systemd-boot.installDeviceTree = true;
|
|
};
|
|
# hardware.deviceTree = {
|
|
# enable = true;
|
|
# package = lib.mkForce pkgs.${namespace}.linuxPackages_rpi5-lts.kernel;
|
|
# name = "bcm2712-rpi-5-b.dtb";
|
|
# filter = "bcm2712*";
|
|
# };
|
|
# boot.bootspec.extensions."org.nixos.systemd-boot" = lib.mkForce {
|
|
# inherit (config.boot.loader.systemd-boot) sortKey;
|
|
# devicetree = "./bcm2712-rpi-5-b.dtb";
|
|
# };
|
|
};
|
|
};
|
|
|
|
${namespace}.hardware.raspberry-pi.config = {
|
|
# extra-config = {
|
|
# armstub = "RPI_EFI.fd";
|
|
# };
|
|
all = {
|
|
# # [all] conditional filter, https://www.raspberrypi.com/documentation/computers/config_txt.html#conditional-filters
|
|
|
|
# options = {
|
|
# # https://www.raspberrypi.com/documentation/computers/config_txt.html#enable_uart
|
|
# # in conjunction with `console=serial0,115200` in kernel command line (`cmdline.txt`)
|
|
# # creates a serial console, accessible using GPIOs 14 and 15 (pins
|
|
# # 8 and 10 on the 40-pin header)
|
|
# enable_uart = {
|
|
# enable = true;
|
|
# value = true;
|
|
# };
|
|
# # https://www.raspberrypi.com/documentation/computers/config_txt.html#uart_2ndstage
|
|
# # enable debug logging to the UART, also automatically enables
|
|
# # UART logging in `start.elf`
|
|
# uart_2ndstage = {
|
|
# enable = true;
|
|
# value = true;
|
|
# };
|
|
# };
|
|
|
|
# Base DTB parameters
|
|
# https://github.com/raspberrypi/linux/blob/a1d3defcca200077e1e382fe049ca613d16efd2b/arch/arm/boot/dts/overlays/README#L132
|
|
base-dt-params = {
|
|
|
|
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#enable-pcie
|
|
pciex1 = {
|
|
enable = true;
|
|
value = "on";
|
|
};
|
|
# PCIe Gen 3.0
|
|
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#pcie-gen-3-0
|
|
pciex1_gen = {
|
|
enable = true;
|
|
value = "3";
|
|
};
|
|
|
|
};
|
|
|
|
# extra-config = ''
|
|
# armstub=RPI_EFI.fd
|
|
# device_tree_address=0x1f0000
|
|
# device_tree_end=0x210000
|
|
|
|
# # Force 32 bpp framebuffer allocation.
|
|
# framebuffer_depth=32
|
|
|
|
# # Disable compensation for displays with overscan.
|
|
# disable_overscan=1
|
|
|
|
# # Force maximum USB power regardless of the power supply.
|
|
# usb_max_current_enable=1
|
|
|
|
# # Force maximum CPU speed.
|
|
# force_turbo=1
|
|
# '';
|
|
|
|
};
|
|
};
|
|
}
|