jakubgs Posted February 9, 2021 Posted February 9, 2021 (edited) I'm trying to run NixOS on my NanoPC-T4, and it's having trouble detecting the NVMe drive connected to the M.2 port. I've tried running Armbian, specifically Armbian_21.02.1_Nanopct4_focal_current_5.10.12.img downloaded from here, and it appears to detect it just fine. On NixOS I'm running a stock 5.10.13 kernel, which is newer than the 5.10.12 that Armbian is using. I'm assuming that I'm missing some kind of specific patch that makes this work on Armbian. I examined the kernel I was running on Armbian: qwe@nanopct4:~$ ls -l /boot/ | grep rockchip total 63872 -rw-r--r-- 1 root root 221399 Feb 3 19:55 config-5.10.12-rockchip64 lrwxrwxrwx 1 root root 22 Feb 4 12:11 dtb -> dtb-5.10.12-rockchip64 drwxr-xr-x 6 root root 4096 Feb 4 12:11 dtb-5.10.12-rockchip64 lrwxrwxrwx 1 root root 26 Feb 4 12:10 Image -> vmlinuz-5.10.12-rockchip64 -rw-r--r-- 1 root root 15339843 Feb 4 12:14 initrd.img-5.10.12-rockchip64 -rw-r--r-- 1 root root 5835612 Feb 3 19:55 System.map-5.10.12-rockchip64 lrwxrwxrwx 1 root root 26 Feb 4 12:14 uInitrd -> uInitrd-5.10.12-rockchip64 -rw-r--r-- 1 root root 15339907 Feb 4 12:14 uInitrd-5.10.12-rockchip64 -rw-r--r-- 1 root root 28582400 Feb 3 19:55 vmlinuz-5.10.12-rockchip64 And it appears to be be coming from a linux-image-current-rockchip64/now package: qwe@nanopct4:/boot$ sudo apt list | grep current-rockchip64 linux-dtb-current-rockchip64/now 21.02.1 arm64 [installed,local] linux-headers-current-rockchip64/focal 20.11.4 arm64 linux-image-current-rockchip64/now 21.02.1 arm64 [installed,local] I'm trying to identify what source was used to build this image, but there is no linux-source package. I looked at the repo: https://github.com/armbian/build And I found this: https://github.com/armbian/build/blob/a1e96e68d864ddc2fef169f3f503a9493311313b/config/sources/families/rockchip64.conf But it seems to only reference kernel version 4.4.202 from https://github.com/ayufan-rock64/linux-kernel which looks wrong. Can someone please help me figure out what kernel source was used to build the image? Ideally I'd find the exact patch that fixes the NVMe drive and apply just that, but I'd settle for building the whole thing if it works. Edited February 9, 2021 by jakubgs
NicoD Posted February 9, 2021 Posted February 9, 2021 I don't have a T4, so I'm not aware of hardware support on it. But this topic might give some info. So it might work using an older kernel. You could also use the legacy kernel 4.4 if it works for your use case. I use it on my RK3399's with NVMe.
tparys Posted February 9, 2021 Posted February 9, 2021 I may be missing something here, but can't you just ask the the running kernel what version it is? $ uname -r
Igor Posted February 9, 2021 Posted February 9, 2021 3 hours ago, jakubgs said: On NixOS I'm running a stock 5.10.13 kernel, which is newer than the 5.10.12 that Armbian is using. https://docs.armbian.com/#what-is-the-difference-between-armbian-and-debianubuntu
jakubgs Posted February 10, 2021 Author Posted February 10, 2021 @NicoD I think all three of you misunderstood me. I want to identify the exact repository and commit from which the Armbian kernel was built in order to get the same fixes on NixOS. @tparys The version alone - like 5.10.12 - is useless by itself and does not contain the necessary information to find the exact source code needed. @Igor Not sure what you're trying to say. I need the commit and repo from which the kernel was built. I found this: https://github.com/armbian/build/blob/e107f37475af8854259aab9a8df446d15ebcde7a/config/sources/arm64.conf#L25 Which appears to show that the default value for KERNELSOURCE is MAINLINE_KERNEL_SOURCE, which appears to be set here: https://github.com/armbian/build/blob/705bbd431bd2f3751c74a8a84eb4d4a4cb3a09e8/lib/configuration.sh#L65-L67 Which appears to default to linux-stable: https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable I also found out that the value of KERNELPATCHDIR found here: https://github.com/armbian/build/blob/a1e96e68d864ddc2fef169f3f503a9493311313b/config/sources/families/rockchip64.conf#L11 Seems to indicate this folder contains the patches that were applied to the kernel: https://github.com/armbian/build/tree/804c57dd5925e67383a3d82c85f18868a6173d4b/patch/kernel/rockchip64-dev So currently I'm trying to build the 5.10.x kernel used by NixOS with all the patches that mention rk3399 in the name. We'll see what that does.
Igor Posted February 10, 2021 Posted February 10, 2021 26 minutes ago, jakubgs said: Not sure what you're trying to say. Just giving you some facts about Armbian. Also this one: https://github.com/armbian/build#compare-with-industry-standards We don't support porting of our work to 3rd party Linux distributions, but you are ofc welcome to do that on your time and make use of any code that is available. We simply can't afford to guide you. Code and its maintaining also does not appear from a thin air.
jakubgs Posted March 1, 2021 Author Posted March 1, 2021 >Code and its maintaining also does not appear from a thin air. Wait, it doesn't?
Werner Posted March 1, 2021 Posted March 1, 2021 Free software is not free. It never was. Somebody always has to pay the electrical bill
jakubgs Posted March 1, 2021 Author Posted March 1, 2021 But it says "free" in the name. I feel cheated. I demand a refund!
Recommended Posts