Compare commits

...

3 Commits

Author SHA1 Message Date
Ari Gerus e2f5044e37 chore: flake lock updates
CI / x86_64-linux (push) Successful in 1m11s Details
CI / aarch64-linux (push) Successful in 2m0s Details
2024-04-17 13:55:53 +02:00
Ari Gerus 0055f0d519 n/akamanto: back to rpi5; mostly works now
still needs changing settings in edk2 on first boot
2024-04-09 09:42:38 +02:00
Ari Gerus 340ed15148 chore: flake lock updates 2024-04-09 09:41:21 +02:00
4 changed files with 114 additions and 84 deletions

View File

@ -304,11 +304,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1712093955, "lastModified": 1713294767,
"narHash": "sha256-94I0sXz6fiVBvUAk2tg6t3UpM5rOImj4JTSTNFbg64s=", "narHash": "sha256-LmaabaQZdx52MPGKPRt9Opoc9Gd9RbwvCdysUUYQoXI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "80546b220e95a575c66c213af1b09fe255299438", "rev": "fa8c16e2452bf092ac76f09ee1fb1e9f7d0796e7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -340,11 +340,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1711231487, "lastModified": 1713333160,
"narHash": "sha256-dRdFjStMA7GeuD/V4vzKblzuHwxMPgzEboRleVdZlUM=", "narHash": "sha256-iz4Uz3vykqsZwIY2hxEMfRrc1DvBgxHVCfSxppuj40s=",
"owner": "Jovian-Experiments", "owner": "Jovian-Experiments",
"repo": "Jovian-NixOS", "repo": "Jovian-NixOS",
"rev": "1171169117f63f1de9ef2ea36efd8dcf377c6d5a", "rev": "d3ce25a385ec7ed899ffb282d1e54ccb4ac9ef0d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -366,11 +366,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1711442573, "lastModified": 1713192402,
"narHash": "sha256-/A3YzcY5erYOPojp5Ffwgxv4X5MTnRiWwuaXfgXbK2g=", "narHash": "sha256-M2rleMvDJyhJEDWMcwhJNAuNFtvZhN3vadve7x2KiOk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "lanzaboote", "repo": "lanzaboote",
"rev": "df7ac26bd24fac8baa94d60a02c3e0f0d4d16368", "rev": "1197e51e8f57135349bed4de791d8bab7f8cc150",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -388,11 +388,11 @@
"spectrum": "spectrum" "spectrum": "spectrum"
}, },
"locked": { "locked": {
"lastModified": 1711753492, "lastModified": 1713189110,
"narHash": "sha256-lLlXQBebD6wd2m7vjXg2zQ8tfJF2a70RL+zXdbaQqn0=", "narHash": "sha256-c/yG/AsPmMBMe4RAxn4KOkOaR4rsW5s3AjtfriOQKD8=",
"owner": "astro", "owner": "astro",
"repo": "microvm.nix", "repo": "microvm.nix",
"rev": "1b7c70b198554d0f0306ec153c94906623437aed", "rev": "a1341f7195e34d9bb88c12314cc3b0c4429f9b0a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -469,11 +469,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1711854532, "lastModified": 1713067146,
"narHash": "sha256-JPStavwlT7TfxxiXHk6Q7sbNxtnXAIjXQJMLO0KB6M0=", "narHash": "sha256-9D20xjblGKEVRVCnM3qWhiizEa9i6OpK6xQJajwcwOQ=",
"owner": "Mic92", "owner": "Mic92",
"repo": "nix-index-database", "repo": "nix-index-database",
"rev": "2844b5f3ad3b478468151bd101370b9d8ef8a3a7", "rev": "93aed67288be60c9ef6133ba2f8de128f4ef265c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -484,11 +484,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1711352745, "lastModified": 1712909959,
"narHash": "sha256-luvqik+i3HTvCbXQZgB6uggvEcxI9uae0nmrgtXJ17U=", "narHash": "sha256-7/5ubuwdEbQ7Z+Vqd4u0mM5L2VMNDsBh54visp27CtQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "9a763a7acc4cfbb8603bb0231fec3eda864f81c0", "rev": "f58b25254be441cd2a9b4b444ed83f1e51244f1f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -579,11 +579,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1711824678, "lastModified": 1713354889,
"narHash": "sha256-vC+haKEZyfPjpy31J3BNDfGEZJMu6YtU1CvOSwjD8HM=", "narHash": "sha256-/wGfpg6ssTd7zISfRNvZxaHYSC849LqCXAv0ELdKHxw=",
"owner": "arachnist", "owner": "arachnist",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9326b449cad68468221504978f335f526c43eb67", "rev": "71053157d9e5c8e01433d546e351fc223186b7a6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -709,11 +709,11 @@
"utils": "utils_2" "utils": "utils_2"
}, },
"locked": { "locked": {
"lastModified": 1710449465, "lastModified": 1713012165,
"narHash": "sha256-2orO8nfplp6uQJBFqKkj1iyNMC6TysmwbWwbb4osTag=", "narHash": "sha256-z/soXKDnz+w4Nw0LkRaM73YqolhSmIYy6cpg1F2ps8I=",
"owner": "simple-nixos-mailserver", "owner": "simple-nixos-mailserver",
"repo": "nixos-mailserver", "repo": "nixos-mailserver",
"rev": "79c8cfcd5873a85559da6201b116fb38b490d030", "rev": "9f6635a0351c190179dc6904545f950108a23dd8",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {

View File

@ -31,6 +31,7 @@ let
sha256 = "sha256-0uoq5bvL/4L9oa/JY54qHMRw5vE7V//HxLFMOEqGUjA="; sha256 = "sha256-0uoq5bvL/4L9oa/JY54qHMRw5vE7V//HxLFMOEqGUjA=";
}; };
}); });
rootfsBuilder = import "${inputs.nixpkgs}/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix" { pkgs = pkgs.buildPackages; };
in { in {
# https://en.wikipedia.org/wiki/Aka_Manto # https://en.wikipedia.org/wiki/Aka_Manto
networking.hostName = "akamanto"; networking.hostName = "akamanto";
@ -40,92 +41,73 @@ in {
imports = with inputs.self.nixosModules; [ imports = with inputs.self.nixosModules; [
"${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image.nix" "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image.nix"
common common
inputs.nixos-hardware.nixosModules.raspberry-pi-4
]; ];
nixpkgs.overlays = [ inputs.self.overlays.rpi5 ];
# don't want to pull in all of installer stuff, so we need to copy some things from sd-image-aarch64.nix:
sdImage = { sdImage = {
compressImage = false; compressImage = false;
firmwareSize = 1024;
imageName = imageName =
"${config.sdImage.imageBaseName}-${pkgs.stdenv.hostPlatform.system}-${config.networking.hostName}.img"; "${config.sdImage.imageBaseName}-${pkgs.stdenv.hostPlatform.system}-${config.networking.hostName}.img";
populateFirmwareCommands = let populateFirmwareCommands = ''
configTxt = pkgs.writeText "config.txt" '' storePath() {
[pi3] local path="$1"
kernel=u-boot-rpi3.bin echo ''${path/\/nix\/store\/}
}
[pi02] cp ${pkgs.rpi5-uefi}/boot/* firmware
kernel=u-boot-rpi3.bin
[pi4] mkdir -p firmware/EFI/nixos
kernel=u-boot-rpi4.bin touch firmware/EFI/nixos-sd-system-image
enable_gic=1
armstub=armstub8-gic.bin
# Otherwise the resolution will be weird in most cases, compared to kernelFile=$(storePath ${config.boot.kernelPackages.kernel})-${config.system.boot.loader.kernelFile}
# what the pi3 firmware does by default. initrdFile=$(storePath ${config.system.build.initialRamdisk})-${config.system.boot.loader.initrdFile}
disable_overscan=1
# Supported in newer board revisions cp ${config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile} \
arm_boost=1 firmware/EFI/nixos/$kernelFile
[cm4] cp ${config.system.build.initialRamdisk + "/" + config.system.boot.loader.initrdFile} \
# Enable host mode on the 2711 built-in XHCI USB controller. firmware/EFI/nixos/$initrdFile
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[all] mkdir -p firmware/EFI/boot
# Boot in 64-bit mode.
arm_64bit=1
# U-Boot needs this to work, regardless of whether UART is actually used or not. # making our own efi program; grub-install tries to probe for things
# Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still MODULES=( fat part_gpt part_msdos normal boot linux configfile efifwsetup
# a requirement in the future. ls search search_label search_fs_uuid search_fs_file echo serial test
enable_uart=1 loadenv ext2 reboot help cat )
${pkgs.grub2_efi}/bin/grub-mkimage --directory=${pkgs.grub2_efi}/lib/grub/arm64-efi \
-o firmware/EFI/boot/bootaa64.efi \
-p /EFI/boot -O arm64-efi ''${MODULES[@]}
cat <<EOF > firmware/EFI/boot/grub.cfg
search --set=root --file /EFI/nixos-sd-system-image
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
# when attempting to show low-voltage or overtemperature warnings. terminal_output console serial
avoid_warnings=1
'';
in ''
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
# Add the config timeout 10
cp ${configTxt} firmware/config.txt set default="0"
# Add pi3 specific files menuentry '${config.system.nixos.distroName} ${config.system.nixos.label}' {
cp ${pkgs.ubootRaspberryPi3_64bit}/u-boot.bin firmware/u-boot-rpi3.bin linux /EFI/nixos/$kernelFile init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
initrd /EFI/nixos/$initrdFile
# Add pi4 specific files devicetree /bcm2712-rpi-5-b.dtb
cp ${pkgs.ubootRaspberryPi4_64bit}/u-boot.bin firmware/u-boot-rpi4.bin }
cp ${pkgs.raspberrypi-armstubs}/armstub8-gic.bin firmware/armstub8-gic.bin EOF
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-4-b.dtb firmware/ '';
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-400.dtb firmware/
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-cm4.dtb firmware/
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-cm4s.dtb firmware/
'';
populateRootCommands = '' populateRootCommands = ''
mkdir -p ./files/boot mkdir -p ./files/boot
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
''; '';
}; };
hardware.enableRedistributableFirmware = lib.mkForce false; hardware.enableRedistributableFirmware = lib.mkForce false;
hardware.firmware = with pkgs; [ raspberrypiWirelessFirmware wireless-regdb ]; hardware.firmware = with pkgs; [ raspberrypiWirelessFirmware wireless-regdb ];
hardware = {
raspberry-pi."4".apply-overlays-dtmerge.enable = true;
deviceTree = {
enable = true;
filter = "*rpi-4-*.dtb";
};
};
boot = { boot = {
kernelPackages = lib.mkForce pkgs.linuxKernel.packages.linux_rpi4; kernelPackages = lib.mkForce pkgs.linuxPackages_rpi5;
supportedFilesystems = lib.mkForce [ "vfat" "ext4" ]; supportedFilesystems = lib.mkForce [ "vfat" "ext4" ];
kernelParams = [ "console=ttyS1,115200n8" "fbcon=rotate:2" ]; kernelParams = [ "fbcon=rotate:2" "8250.nr_uarts=11" "console=ttyAMA10,115200" "console=tty0" ];
loader.grub.enable = false;
loader.generic-extlinux-compatible.enable = true;
initrd.availableKernelModules = lib.mkForce [ initrd.availableKernelModules = lib.mkForce [
"usbhid" "usbhid"
"usb_storage" "usb_storage"
@ -133,6 +115,24 @@ in {
"pcie_brcmstb" # required for the pcie bus to work "pcie_brcmstb" # required for the pcie bus to work
"reset-raspberrypi" # required for vl805 firmware to load "reset-raspberrypi" # required for vl805 firmware to load
]; ];
loader.grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
device = "nodev";
};
};
fileSystems = lib.mkForce {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
options = [ "x-initrd.mount" ];
fsType = "ext4";
};
"/boot" = {
device = "/dev/disk/by-label/FIRMWARE";
fsType = "vfat";
};
}; };
environment.etc."wifi-secrets".text = ci-secrets.wifi; environment.etc."wifi-secrets".text = ci-secrets.wifi;

View File

@ -8,4 +8,6 @@ self: super: rec {
}; };
linuxPackages_rpi5 = self.linuxPackagesFor linux_rpi5; linuxPackages_rpi5 = self.linuxPackagesFor linux_rpi5;
rpi5-uefi = self.callPackage ../pkgs/rpi5-uefi.nix { };
} }

28
pkgs/rpi5-uefi.nix Normal file
View File

@ -0,0 +1,28 @@
{ stdenv, lib, fetchzip }:
let
version = "v0.3";
in
stdenv.mkDerivation {
pname = "rpi5-uefi";
version = version;
src = fetchzip {
url = "https://github.com/worproject/rpi5-uefi/releases/download/${version}/RPi5_UEFI_Release_${version}.zip";
sha256 = "sha256-bjEvq7KlEFANnFVL0LyexXEeoXj7rHGnwQpq09PhIb0=";
stripRoot = false;
};
installPhase = ''
runHook preInstall
mkdir -p $out/boot
mv ./* $out/boot
runHook postInstall
'';
meta = with lib; {
description = "EDK2 port for raspberry pi 5";
};
}