Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pi 5 support #13

Closed
adminy opened this issue Apr 18, 2024 · 14 comments
Closed

Pi 5 support #13

adminy opened this issue Apr 18, 2024 · 14 comments

Comments

@adminy
Copy link

adminy commented Apr 18, 2024

Awesome project! As you know some things are going out of nixpkgs repo for 24.11, and official support for the pi 5 won't be prioritised. So I'm looking forward to see that support here!

Thanks

@tstat
Copy link
Owner

tstat commented May 2, 2024

Thanks! Raspberry pi 5 support was added in b39b556, just not with uboot, so you need to disable it with raspberry-pi-nix.uboot.enable = false (option documented here).

@adminy
Copy link
Author

adminy commented May 7, 2024

wifi seems to not be working.

iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

@malteneuss
Copy link

As far as i know basic pi 5 support (e.g. booting from SD but not USB,NVMe) was added in uboot version 2024.04, which has already landed in nixpkgs-unstable https://github.com/NixOS/nixpkgs/blob/8f9b659d9fb9af9d39cef689e2c3da5dd661b23a/pkgs/misc/uboot/default.nix#L31

Would that help here to not need to disable uboot?

@tstat
Copy link
Owner

tstat commented May 8, 2024

Oh great, I didn't know a new version of uboot was released. I'll probably give it a test later. If you feel motivated to test it, then you probably just need to update the source and version in these two places.

https://github.com/tstat/raspberry-pi-nix/blob/master/flake.nix#L7
https://github.com/tstat/raspberry-pi-nix/blob/master/overlays/default.nix#L46

@tstat
Copy link
Owner

tstat commented May 8, 2024

@adminy hard to have anything to reply to without more information. Wifi, bluetooth, etc all work fine with my pi 5 and the example project linked in the readme. I've been using it with nixos for months.

@malteneuss
Copy link

malteneuss commented May 8, 2024

@tstat I'll wait for the bump to land in your main branch ;) I'm currently working on the documentation for NixOS on Pi 5 at https://wiki.nixos.org/wiki/NixOS_on_ARM/Raspberry_Pi_5 and tinkering with how to use the official Pi 5 Debian OS with Nix as a remote builder to native-build a pre-setup NixOS image using your flake (i couldn't get cross-compile to work, and emulated native-compile is way too slow). The goal is to document the steps and make it easy for people to get NixOS on the Pi until NixOS hardware has better Pi 5 support and cached compiled kernels.

Thinking of which, do you see a way to move this setup to NixOS-hardware for greater visibility? (Some generic kernel was introduced recently with NixOS/nixos-hardware#927) I wasn't able to find your repo until someone mentioned it. And btw, could you explain why we would want uboot when it seems to work without? Other people are pushing for UEFI, because only it would allow the usual systemd-boot bootloader with support for different NixOS generations; as i understood uboot wouldn't support that.

@shnCanos
Copy link

Hello, this might be a bit of a noob question, but how is the option raspberry-pi-nix.uboot.enable = false meant to be enabled? With the configuration below (which is the example repo with a modified modules section)

{
  description = "raspberry-pi-nix example";
  nixConfig = {
    extra-substituters = [ "https://raspberry-pi-nix.cachix.org" ];
    extra-trusted-public-keys = [
      "raspberry-pi-nix.cachix.org-1:WmV2rdSangxW0rZjY/tBvBDSaNFQ3DyEQsVw8EvHn9o="
    ];
  };
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/8bf65f17d8070a0a490daf5f1c784b87ee73982c";
    raspberry-pi-nix.url = "github:tstat/raspberry-pi-nix";
  };

  outputs = { self, nixpkgs, raspberry-pi-nix }:
    let
      inherit (nixpkgs.lib) nixosSystem;
      basic-config = { pkgs, lib, ... }: {
        time.timeZone = "America/New_York";
        users.users.root.initialPassword = "root";
        networking = {
          hostName = "basic-example";
          useDHCP = false;
          interfaces = { wlan0.useDHCP = true; };
        };
        environment.systemPackages = with pkgs; [ bluez bluez-tools ];
        hardware = {
          bluetooth.enable = true;
          raspberry-pi = {
            config = {
              all = {
                base-dt-params = {
                  # enable autoprobing of bluetooth driver
                  # https://github.com/raspberrypi/linux/blob/c8c99191e1419062ac8b668956d19e788865912a/arch/arm/boot/dts/overlays/README#L222-L224
                  krnbt = {
                    enable = true;
                    value = "on";
                  };
                };
              };
            };
          };
        };
      };

    in
    {
      nixosConfigurations = {
        rpi-example = nixosSystem {
          system = "aarch64-linux";
          modules = [ raspberry-pi-nix.nixosModules.raspberry-pi basic-config { raspberry-pi-nix.uboot.enable = false; } ]; # <-- Added option here
        };
      };
    };
}

I get an error saying that the option raspberry-pi-nix.uboot doesn't exist when I run nix build --extra-experimental-features "nix-command flakes" '.#nixosConfigurations.rpi-example.config.system.build.sdImage' as root.

@malteneuss
Copy link

It works on my machine with the function-style NixOS-config for that setting:

modules = [
  raspberry-pi-nix.nixosModules.raspberry-pi
  ({ pkgs, ... }: {
     # uboot not yet supported for pi5
     # https://github.com/tstat/raspberry-pi-nix/issues/13#issuecomment-2090601812 
     raspberry-pi-nix.uboot.enable = false;
    })
   ...
];

That shouldn't make a difference, but I can't see any other difference.

@shnCanos
Copy link

shnCanos commented May 12, 2024

Thanks for the quick reply! Nothing changed, however I'll try to investigate it and see if I can figure it out
(Editing so I don't spam this issue)
It was absolutely my bad, sorry. For anyone with the same issue, don't forget to run nix flake update in the example repo. Apparently, the flake.lock file had an outdated version of this repo which didn't have the uboot option...

@amorx1
Copy link

amorx1 commented May 13, 2024

I've got the RPi 5 booting using the provided example, but keep getting the following error on every nixos-rebuild switch:

...
updating GRUB 2 menu ...
Failed to get blkid info (returned 512) for / on /dev/root at /nix/store/___________-install-grub.pl line 208.
warning: error(s) occured while switching to the new configuration

with a single generated fileSystem in hardware-configuration.nix:

fileSystems."/" = 
    { device = "/dev/disk/by-uuid/4444444-4444-4444-8888-888888888888";
       fsType = "ext4";
    };

Has anyone else come across this error? It looks like the derivation builds successfully but fails just as the switch is meant to happen.

@tstat
Copy link
Owner

tstat commented May 13, 2024

@amorx1 it looks like you have enabled grub. This repo doesn't support that bootloader -- it only supports uboot or raspberry pi's normal boot process.

Note that this repo disables grub.

grub.enable = lib.mkDefault false;

@tstat
Copy link
Owner

tstat commented May 14, 2024

@malteneuss

I'm currently working on the documentation for NixOS on Pi 5 at https://wiki.nixos.org/wiki/NixOS_on_ARM/Raspberry_Pi_5 and tinkering with how to use the official Pi 5 Debian OS with Nix as a remote builder to native-build a pre-setup NixOS image using your flake (i couldn't get cross-compile to work, and emulated native-compile is way too slow). The goal is to document the steps and make it easy for people to get NixOS on the Pi until NixOS hardware has better Pi 5 support and cached compiled kernels.

Oh, very cool. I compile the raspberry pi kernel on nixos-running raspberry pis. Note that I have sd images of releases in the example repo.

Thinking of which, do you see a way to move this setup to NixOS-hardware for greater visibility? (Some generic kernel was introduced recently with NixOS/nixos-hardware#927)

I'm happy to discuss moving this stuff to somewhere more visible.

And btw, could you explain why we would want uboot when it seems to work without? Other people are pushing for UEFI, because only it would allow the usual systemd-boot bootloader with support for different NixOS generations; as i understood uboot wouldn't support that.

uboot supports different NixOS generations -- when you boot up the example config for example it presents a list of previous generations to select from if desired. This is presented over hdmi and uart.

@tstat
Copy link
Owner

tstat commented May 15, 2024

pi 5 works with uboot as well in latest release https://github.com/tstat/raspberry-pi-nix/releases/tag/v0.3.0

@tstat tstat closed this as completed May 15, 2024
@malteneuss
Copy link

@tstat Thanks for the update.

Understanding this post NixOS/nixpkgs#260754 (comment) a bit better now i think that the nixpkgs and nixos-hardware people don't want (to maintain) Pi-specific kernels, firmware etc, like is being done in this repo. So there's probably no better place to move this repo into. Instead i added it to the Wiki guide at https://wiki.nixos.org/wiki/NixOS_on_ARM/Raspberry_Pi_5 to be easier to find in the mean time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants