ryan4yin / nixos-rk3588

Minimal NixOS running on RK3588/RK3588s based SBC(Orange Pi 5 Plus, Orange Pi 5, Rock 5A, etc)
MIT License
156 stars 28 forks source link

Newer kernel support #22

Closed BananchickPasha closed 8 months ago

BananchickPasha commented 8 months ago

Hi, are there any plans about supporting newer, 6.1.43 kernel? And what steps need to be done to boot from it?

Also I've tried to add it by myself, but none of my attempts were successfull. Could you please suggest what I did wrong or what else I should do for it to work? Here is what I did:

Armbian kernel

Got kernel from https://github.com/armbian/linux-rockchip/archive/refs/tags/linux-6.1-stan-rkr1.zip and defcofig from https://github.com/armbian/build/blob/main/config/kernel/linux-rk35xx-vendor.config. Then I've copied this config to linux-6.1-stan-rkr1/arch/arm64/configs/opi_defconfig, executed make ARCH=arm64 opi_defconfig and copied .config file to nixos-rk3588/pkgs/kernel/rk35xx_legacy_config and ofc replacing all source urls, versions and hashes in legacy.nix

Then I've run nix build .#rawEfiImage-opi5plus --show-trace -L --verbose (and changed pkgsKernel to pkgsNative as kernel builds for 2 or 3 hours via qemu) and created boot image without any errors.
On boot it shows nixos logo, but it doesn't go any further. It's output is the same as in working 5.10 image, but last line shows just Exiting boot services... instead of Exiting boot services and installing virtual address map

Ubuntu-rockchip kernel

ubuntu-rockchip have their own kernel, build scripts for every system and they will use 6.1.43 in 24.04 release, so I've tried their kernel too. Just as in their scripts, I've used rockchip_defconfig to generate .config, but nix-build fails with:

       Failed assertions:
       - CONFIG_AUTOFS_FS is not enabled!

I've tried to enable this option, and I've got compilation error after few minutes. However, on ubuntu system installed on my orange pi, same kernel builds without any errors with same config

I also tried plenty of other configurations, collabora kernels, but all of them couldnt boot beyond nixos logo in uefi.

I don't know what else needs to be done. Device tree is inside kernel sources, kernel config seems to be configured as in documentation. What I have missed?

ryan4yin commented 8 months ago

couldnt boot beyond nixos logo in uefi.

Have you ever tried uboot? work with uboot, but not with UEFI (EDKII-RK3588)?

ryan4yin commented 8 months ago

I tried kernel 6.1 and confirmed the problem exists, temporarily reverted to the legacy kernel. https://github.com/ryan4yin/nixos-rk3588/commit/546196524f4985fbb830b33daf8dd6022b0856f7

ryan4yin commented 8 months ago

The problem comes from edk2-rk3588, related issues:

ryan4yin commented 8 months ago

Solution has been added to the document: https://github.com/ryan4yin/nixos-rk3588/blob/main/UEFI.md