-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
Raspberry Pi 4 support #63720
Comments
It would be especially nice if hardware video acceleration would now finally work due to OSS video firmware |
After a definitely-not-impulsive trek to Cambridge yesterday, myself and @nekomimiscience both have Pi 4 4GB's as of yesterday and we can spend some time writing / testing some stuff to get these working properly. From her experimentation yesterday night, the current kernel shipped with the aarch64 image does not boot, but fudging it by copying the kernel from the new official image (which is now based on debian/buster) at least gets the system to start. We'll probably need to bring over some of the kernel patches from their fork (see here for a summary, though it'll probably involve quite a lot of the stuff committed on June 21st here), then it will probably be a case of just pulling the firmware Pi3B+ style. Should we be mainlining these patches onto the main kernel tree here, or would it be saner to have a separate package? |
Most of the work in getting the Pi 4B to at least boot (without hacks) I've scoped out so far is upstream (U-Boot, Linux kernel). I'm going to see how far I can get in bringing up U-Boot in my spare time but I don't have too much time to devote to it until Sunday. No promises at this stage. Otherwise, version bumps on Raspberry Pi related packages seem to be the near-term way forwards (in particular, Extremely excited about the new OSS video firmware though. |
There appear to be some blocking issues on the current kernel when built for aarch64 which I would argue block merging it into NixOS. Some of these are tracked in the following issue: raspberrypi/linux#3032 From what I can ascertain, at the time of writing this comment:
Someone has succeeded in getting Gentoo to boot with an aarch64 kernel, written up here - but that memory problem feels like a bit of a blocker. Keeping an eye on that issue to see if there's a resolution. I guess once that's fixed, we could target a specific commit of the kernel instead of the 20190620-1 release - though I'm not sure merging that kind of potential instability is a good idea. Open to comment. |
If you get it to work, please add the instructions here: https://nixos.wiki/wiki/NixOS_on_ARM/Raspberry_Pi |
I linked from the wiki page back to this issue so that users consulting the wiki can see what is going on over here. |
I've managed to get nixos fully booting on my new pi4 (and am posting this from it!). I built this fork of the rpi kernel before it was merged: raspberrypi/linux#3144. Compile with
Right now, the most obvious deficits you can read about in e.g. the gentoo build, of sd cards, wifi, and RAM not working, are no longer an issue. Beyond that, it seems like a pretty standard aarch64 build (though it's the first one I've done). I did not look into the sdcard image builder. (I did some messy hack for running the activation script on the chroot'd x86_64 host instead) I'll try to do a more proper writeup, and make pull reqs for the nixos modules needed over the weekend. |
@tkerber congrats! I'm excited for the write-up! Did you get 4GB of ram working? My understanding is that the aarch64 kernel had a bug where it could only use 1GB of ram. |
Not sure to be honest. I've compiled a kernel which I believe to patch the core issue, but I still had symptoms which look very much like those of running without limiting the RAM... I'll try a more up-to-date kernel tomorrow, and see if that persists. |
This issue is known upstream: raspberrypi/linux#3157 - for now, I guess limiting to 1G is the best action to take for a stable system (maybe only while downloading with WiFi as the issue suggests - I wouldn't know, there is little else I do with machines :p). |
raspberrypi/linux#3159 should fix WiFi issue I run arm64 gentoolto on RPI4 4G without any trouble now. |
I've just made a pull request. Here's how to build a working config against it: Example ConfigReplace UUIDs as appropriate.
How to BuildThis is what I did to set up my microsd. It's quite hacky, but it works. Any command below should be in a root shell (apart from the initial build).
|
The main reason @NekomimiScience and I held off on suggesting that |
Looking again at raspberrypi/linux#3159, it does seem it's not solved yet. I'm withdrawing my pull req until this gets a consistent upstream fix. I'll leave up the branch, as people can build against it for now. It does seem like it'll still be a few weeks before the kernel is stable, though. |
@tkerber If you're able to use the full range of memory, then I'd say it can probably be merged with a "probably unstable" note attached to it. Probably worth a test! |
I don't plan to use WiFi, since there is Gigabit Ethernet onboard, so if the WiFi is the only issue, I'm ok with it! Are Gigabit Ethernet and USB 3.0 ports working? I hope to get an RPi4 ~soon-ish, so I might be able to pitch in and help with testing it (mostly in headless mode) |
I can't personally attest to either at the moment. That said, I haven't seen them being brought up as an issue anywhere, and things seem to be moving fast to patch the issues that are remaining. |
FWIW, I have just submitted a fresh PR raspberrypi/linux#3164 to address the WIFI DMA issue. |
@tkerber FYI U-boot DOES work on the RPI4 using some work which doesn't look like it has been integrated into upstream yet. My RPI4 is able to boot using this: https://github.com/agherzan/u-boot/tree/ag/v2019.07-rpi4-wip |
@satmandu One of the reasons why these changes hasn't integrated into U-Boot upstream yet is the fact that the devicetree sources are under review during Linux upstreaming. It's not a good idea to adopt the downstream files directly. |
@tkerber I've tried to follow your instructions, but I don't have a computer with NixOS installed on it. I cloned your branch on an arm AWS instance and tried to build an sd card image, but I could only get a rainbow screen on the pi. Do you have any suggestions on getting the sd card image working? |
@jbaum98 I'm not sure - I don't know enough about the sdcard making process to know what could go wrong. It sounds like an issue in early boot though, so likely the boot partition isn't set up correctly. The pi loads the first partition, which should be fat32, and does a bunch of stuff with it, before booting a specified kernel and initramfs. Sounds like this could be either a) this not being properly set up for whatever reason, or b) it straight up failing to execute the kernel. |
I got it working following your instructions! I just booted from a live USB of NixOS and it all worked great. |
How do I add your git repo as a channel? Edit: We got it working. You have to export nixpkgs=/path/to/repo in NIX_PATH before switching to the new config. |
It seems like the major issues mentioned in this thread have been solved using the latest commit from the https://github.com/raspberrypi/linux kernel repo? Specifically, I got the full 4GB of RAM to work fine (and it seems like the Wi-Fi issues have been solved as well, although I don't use Wi-Fi so I can't test it). Anyone willing to make a PR? |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/has-any-one-succeeded-to-drive-all-devices-of-rpi4b-8gb/11850/1 |
Hi there, i have discovered the same problem with the raspberry image, and when trying to build a new one from master i additionally get this problem: $ nix-build nixos/release.nix -A sd_image_raspberrypi4
...
root module: sun4i_drm
modprobe: FATAL: Module sun4i_drm not found in directory /nix/store/4p7kd78cdzb93zqvhs651nlqvwk94ry5-linux-5.4.79-1.20201201-modules/lib/modules/5.4.79
builder for '/nix/store/kpmyrhdgbxqka3zly1q0p55a5v9dxm6y-linux-5.4.79-1.20201201-modules-shrunk.drv' failed with exit code 1
... when removing those modules from the file |
On which system are you trying to build? e.g. x86 or arm? Because if you are on x86 or so I think you need to add "--system aarch64-linux" or so. But maybe I just forgot and this is a different issue |
@mohe2015 just tried, did not change anything unfortunately. Your assumptions are correct, i am building on an x86 box. although the raspi image boots just fine on the raspi4 without |
I just bisected the wifi problem. Wifi doesn't work on the rpi4 since this commit: d7c4ca2de61c27ccc It updates the nonfree firmware... |
With these two patches, the nixpkgs master successfully builds the sd image for the rpi4 with working wifi: 1.) remove the index 96ebb7537da..dbeb4897ae0 100644
--- a/nixos/modules/installer/sd-card/sd-image-aarch64.nix
+++ b/nixos/modules/installer/sd-card/sd-image-aarch64.nix
@@ -21,8 +21,6 @@
boot.initrd.availableKernelModules = [
# Allows early (earlier) modesetting for the Raspberry Pi
"vc4" "bcm2835_dma" "i2c_bcm2835"
- # Allows early (earlier) modesetting for Allwinner SoCs
- "sun4i_drm" "sun8i_drm_hdmi" "sun8i_mixer"
];
sdImage = { 2.) update the nonfree linux firmware blobs again, since the pre-latest version that d7c4ca2 introduced does not work:
|
Is the Hydra builds failing a known issue? I tried following the Wiki Guide and updating to NixOS-Unstable, and my boot device can't find NIXOS_SD after rebooting. Based on the most recent commits, it looks like the Allwinner stuff was removed, but the Hydra build logs show a failure looking for it. Edit: I see now what's happening: #111683 |
For getting usb only boot working I replaced the files in partition 1 with the versions from the raspberry pi os image. Not config.txt; and I didn't add any new files. I'm not sure what the difference is here, maybe some new change to support booting from USB? The original files booted the SD card fine, but failed when only the usb was present (no SD card). |
It appears to still be broken. Booting the latest image from Hydra ( https://hydra.nixos.org/build/142828023 ) results in the image being unable to find /nix/.../init, and failing to continue booting from there. |
I've written a draft for Raspberry Pi tutorial. I'd be happy if someone gives it a try and reports back if it works and if they got lost at some point. Bonus karma for a screencast :) I've also opened NixOS-hardware PR. |
I've moved GPU/acceleration issues into a separate thread: #122726 |
I just finished your tutorial - works great! Tried it on an 8GB Raspberry Pi 4B. Only issue I had was that I had to unplug my keyboard and plug it back in after each reboot for it to work. I also saw some messages about bluetooth at the login shell (found an ArchLinux post about this - you are probably aware of any issues). Btw: completely new to NixOS, but I will try my best if there is something you want me to test on my installation. :) |
@kwaerner welcome to NixOS/nix! If you need any help there's the discourse, irc, or posting an issue here. And the docs + wiki are pretty solid. More details on the nixos.org website. |
That's warming to hear @kwaerner :) The tutorial is now live at https://nix.dev/tutorials/installing-nixos-on-a-raspberry-pi As @samueldr has aced #122726, I believe we can close this issue. There are probably still some issues with configuring hardware, please open specific issues for those. |
If this issue is closed, should the asterisk be removed from the support column in the table here? |
YES |
Just want to run this by others who may still be following this before opening a specific issue: I don't seem to be able to get past To be clear, this is straight from Is anyone else experiencing this? |
@cmacrae I would try a self-built image first if you have the resources to do so (qemu binfmt may work well). I booted a self-built image with |
Thanks @mohe2015 :) Alright, I'll give that a shot, then |
Just to update others who may have a similar issue to the one I experienced above: my problem was that I hadn't updated my Pi's firmware. After following the steps outlined here, I was able to boot the Hydra provided images :) |
Nice that you could fix it. I would've recommended you to check for firmware updates if you would've used USB boot but I didn't know it's also needed for SD card boot. |
That's why I recommend updating firmware as an installation step. Maybe that needs to move further up before even booting the image? |
Thanks @cmacrae - NixOS/nix.dev#166 |
Perfect, that's exactly what I was going to suggest :) Thanks @domenkozar 🙇 |
Raspberry Pi just announced immediate availability of the Model 4. It will probably be some time until the aarch64 maintainers can get their hands on these, but I figured this can go into the backlog already.
The text was updated successfully, but these errors were encountered: