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

View File

@ -31,6 +31,7 @@ let
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 {
# https://en.wikipedia.org/wiki/Aka_Manto
networking.hostName = "akamanto";
@ -40,92 +41,73 @@ in {
imports = with inputs.self.nixosModules; [
"${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image.nix"
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 = {
compressImage = false;
firmwareSize = 1024;
imageName =
"${config.sdImage.imageBaseName}-${pkgs.stdenv.hostPlatform.system}-${config.networking.hostName}.img";
populateFirmwareCommands = let
configTxt = pkgs.writeText "config.txt" ''
[pi3]
kernel=u-boot-rpi3.bin
populateFirmwareCommands = ''
storePath() {
local path="$1"
echo ''${path/\/nix\/store\/}
}
[pi02]
kernel=u-boot-rpi3.bin
cp ${pkgs.rpi5-uefi}/boot/* firmware
[pi4]
kernel=u-boot-rpi4.bin
enable_gic=1
armstub=armstub8-gic.bin
mkdir -p firmware/EFI/nixos
touch firmware/EFI/nixos-sd-system-image
# Otherwise the resolution will be weird in most cases, compared to
# what the pi3 firmware does by default.
disable_overscan=1
kernelFile=$(storePath ${config.boot.kernelPackages.kernel})-${config.system.boot.loader.kernelFile}
initrdFile=$(storePath ${config.system.build.initialRamdisk})-${config.system.boot.loader.initrdFile}
# Supported in newer board revisions
arm_boost=1
cp ${config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile} \
firmware/EFI/nixos/$kernelFile
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# 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
cp ${config.system.build.initialRamdisk + "/" + config.system.boot.loader.initrdFile} \
firmware/EFI/nixos/$initrdFile
[all]
# Boot in 64-bit mode.
arm_64bit=1
mkdir -p firmware/EFI/boot
# U-Boot needs this to work, regardless of whether UART is actually used or not.
# Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still
# a requirement in the future.
enable_uart=1
# making our own efi program; grub-install tries to probe for things
MODULES=( fat part_gpt part_msdos normal boot linux configfile efifwsetup
ls search search_label search_fs_uuid search_fs_file echo serial test
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
# when attempting to show low-voltage or overtemperature warnings.
avoid_warnings=1
'';
in ''
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
terminal_output console serial
# Add the config
cp ${configTxt} firmware/config.txt
timeout 10
set default="0"
# Add pi3 specific files
cp ${pkgs.ubootRaspberryPi3_64bit}/u-boot.bin firmware/u-boot-rpi3.bin
# Add pi4 specific files
cp ${pkgs.ubootRaspberryPi4_64bit}/u-boot.bin firmware/u-boot-rpi4.bin
cp ${pkgs.raspberrypi-armstubs}/armstub8-gic.bin firmware/armstub8-gic.bin
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/
'';
menuentry '${config.system.nixos.distroName} ${config.system.nixos.label}' {
linux /EFI/nixos/$kernelFile init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
initrd /EFI/nixos/$initrdFile
devicetree /bcm2712-rpi-5-b.dtb
}
EOF
'';
populateRootCommands = ''
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.firmware = with pkgs; [ raspberrypiWirelessFirmware wireless-regdb ];
hardware = {
raspberry-pi."4".apply-overlays-dtmerge.enable = true;
deviceTree = {
enable = true;
filter = "*rpi-4-*.dtb";
};
};
boot = {
kernelPackages = lib.mkForce pkgs.linuxKernel.packages.linux_rpi4;
kernelPackages = lib.mkForce pkgs.linuxPackages_rpi5;
supportedFilesystems = lib.mkForce [ "vfat" "ext4" ];
kernelParams = [ "console=ttyS1,115200n8" "fbcon=rotate:2" ];
loader.grub.enable = false;
loader.generic-extlinux-compatible.enable = true;
kernelParams = [ "fbcon=rotate:2" "8250.nr_uarts=11" "console=ttyAMA10,115200" "console=tty0" ];
initrd.availableKernelModules = lib.mkForce [
"usbhid"
"usb_storage"
@ -133,6 +115,24 @@ in {
"pcie_brcmstb" # required for the pcie bus to work
"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;

View File

@ -8,4 +8,6 @@ self: super: rec {
};
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";
};
}