-
Notifications
You must be signed in to change notification settings - Fork 1
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
Research booting NanoPi R6C #3
Comments
I installed Ubuntu using
|
aWe can get more insight into the partitions on the eMMC by using
https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R6C#Install_to_target_board |
Apparently the kernel needs to be written to the 5th partition based on instructions:
And the Ubuntu image actually has no kernel or configuration in
Which is different from how NanoPC-T4 works, since there you actually have an extlinux config file in |
I put in it a Samsung PM981 512 GB M.2 2280 (MZVLB512HAJQ) NVMe and here's some very basic benchmarks:
|
Some potentially interesting resources:
|
I have tried booting a generic SD card image of Nixos, since it works on NanoPC-T4, but it does not work: |
I built the image:
But it's not clear how I'm supposed to install it. But these instructions for ROCK 5B just use
|
I tried installing it in the U-Boot partition to see if I can maybe get the generic SD image to boot with it:
But of course that did not work. And now nothing boots. That was pure wishful thinking. |
Using
As we can see it fails to boot: |
There are instructions on how to build U-Boot from FriendlyELEC source:
https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R6C#Compile_the_uboot |
The Ubuntu flash image boots without issues:
|
At least we can see the NVMe shows up properly at boot here, so maybe NixOS won't have same issue as on NanoPC-T4.
|
If we take a look at an SD card image for Ubuntu we can see the same layout as on the eMMC:
|
Here are official RockChip docs about the boot process: https://opensource.rock-chips.com/wiki_Boot_option |
The docs state that:
https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R6C#The_Boot_order_between_eMMC_and_SD_card |
There are instructions for building an U-Boot using FriendlyELEC scripts:
https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R6C#Build_u-boot_v2017.09 But I'm still don't know how that could be modified to boot NixOS. I might have to read up on U-Boot itself. |
I found some interesting info in this issue. For example this comment describes how to load kernel from Ext4 partition:
|
And indeed, the NanoPi branch in |
I notice that ext4 support is not enabled in the NanoPi 6 build config:
|
In theory this line suggests I could provide U-Boot with custom commands at startup via UART console:
But the real question is how can I modify the config to read |
And it doesn't seem like it supports FAT filesystem either:
But there appears to be several FAT filestem flags:
For example some usage can be seen in Not yet sure how the |
According to the README:
So it seems to me that just means you can enable FAT filesystem support with |
So I think a pretty good assumption would be that current U-Boot can't load the config from generic NixOS sd card because it lacks |
Building U-Boot from Rockchip was failing due to lack of cross platform GCC: > ./make.sh nanopi6
## make nanopi6_defconfig -j24
#
# configuration written to .config
#
which: no aarch64-linux-gnu-gcc in (/nix/store/fwc0m6fsccir8zznkl7m8iznv5wsjznw-bash-interactive-5.1-p16/bin:/nix/store/n845kl3915ri14zlkqq7wf3n3xabmgal-patchelf-0.14.5/bin:/nix/store/ykcrnkiicqg1pwls9kgnmf0hd9qjqp4x-gcc-wrapper-11.3.0/bin:/nix/store/65v2c245h5qa9mpc7dxhqkfjinl6phx0-gcc-11.3.0/bin:/nix/store/rvgp96bwfmgz4b163flszfaygmhx8wl4-glibc-2.34-210-bin/bin:/nix/store/qarssrazji0q9xp80xg8shsm2crckfr0-coreutils-9.0/bin:/nix/store/n5ypzvl7dijcg24isyngvw8fx0ri6hff-binutils-wrapper-2.38/bin:/nix/store/0q9hm42fapihzj1d64nxqmbml7fpb2d6-binutils-2.38/bin:/nix/store/9l2pdqd2cs9hqyk53w543lpnp0vqaysd-ncurses-6.3-p20220507-dev/bin:/nix/store/sb1wx6xz9yj05d13w5lpdljspllarbim-ncurses-6.3-p20220507/bin:/nix/store/qarssrazji0q9xp80xg8shsm2crckfr0-coreutils-9.0/bin:/nix/store/j25abvpcbappy74w23l8lfcz7gkrsjhy-findutils-4.9.0/bin:/nix/store/2kz1pihzg1jfif46mdm917xmj6r9xyz6-diffutils-3.8/bin:/nix/store/yyg26p5j2mrjwpkbk1djh4nxlsm2p4rw-gnused-4.8/bin:/nix/store/p7pqs5c4zfc4y977p626zch11msmmpj8-gnugrep-3.7/bin:/nix/store/pmh9q9k0g9s189v0iqrxpdp8j1g77gmd-gawk-5.1.1/bin:/nix/store/3fw5n1g3bb925hfll7fj7x94bd0q6k0r-gnutar-1.34/bin:/nix/store/nrvhb0yvawiqgrwbmbfmhjrmy934hhs5-gzip-1.12/bin:/nix/store/n7208v30hf3z4sz6127947vmzpfl46nb-bzip2-1.0.6.0.2-bin/bin:/nix/store/c5myz1zs9bsaq3y4s0rcxgkzb11irwra-gnumake-4.3/bin:/nix/store/9zm6br2ri10a0b71dll2wrim5bnhg6b6-bash-5.1-p16/bin:/nix/store/8636bkd1gg5s8675ipb9wf98wrc5mdpw-patch-2.7.6/bin:/nix/store/5ywhaxrasrp3pj72dnyy40mimx13fi0p-xz-5.2.5-bin/bin:/run/wrappers/bin:/home/jakubgs/.nix-profile/bin:/etc/profiles/per-user/jakubgs/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/jakubgs/go/bin:/home/jakubgs/bin:/home/jakubgs/go/bin:/home/jakubgs/bin:/home/jakubgs/go/bin:/home/jakubgs/bin)
ERROR: No find aarch64-linux-gnu-gcc So I will need to create Nix shell for this. |
So I have created a Nix shell using this example: { pkgs ? import <nixpkgs> {
crossSystem = { config = "aarch64-unknown-linux-gnu"; };
}
}:
pkgs.mkShell {
buildInputs = [ gcc ];
} https://nixos.wiki/wiki/Cross_Compiling#How_to_obtain_a_shell_with_a_cross_compiler But I'm getting some issues, for example:
|
This link shows build dependencies for U-Boot on Debian: |
I tried building with a derivation: { pkgs ? import <nixpkgs> {
crossSystem = { config = "aarch64-unknown-linux-gnu"; };
}
}:
pkgs.stdenv.mkDerivation {
name = "uboot-nanopi6";
version = "v2017.09";
src = pkgs.fetchFromGitHub {
owner = "friendlyarm";
repo = "uboot-rockchip";
rev = "nanopi6-v2017.09";
sha256 = "sha256-8zg/7py9FXn+6GY+D5zSAoOk/3NgQj1FMLWBYzZJKZM=";
};
srcs = [
(pkgs.fetchFromGitHub {
owner = "friendlyarm";
repo = "rkbin";
rev = "nanopi6";
sha256 = "sha256-XGnRUW5Foz0U1V08Kd6Cr/OkwY81xzCzS05irdawWjo=";
})
];
buildInputs = with pkgs; [ gcc linuxHeaders ];
nativeBuildInputs = with pkgs; [ which glibc autoPatchelfHook ];
unpackPhase = ''
cp -r $srcs rkbin
cp -r $src uboot-rockchip
find ./ -name 'built-in.o'
cd uboot-rockchip
'';
preBuild = ''
chmod -R +w ./ ../rkbin
autoPatchelf ./ ../rkbin
patchShebangs make.sh scripts arch
function makeWrapper() {
AR=$(which $1)
echo -e "#!$SHELL\nexec $CC \$@" > $TMP_BIN/$2
chmod +x $TMP_BIN/$2
}
TMP_BIN=$(mktemp -d)
export PATH="$TMP_BIN:$PATH"
makeWrapper aarch64-unknown-linux-gnu-gcc cc
makeWrapper aarch64-unknown-linux-gnu-gcc aarch64-linux-gnu-gcc
makeWrapper aarch64-unknown-linux-gnu-ld aarch64-linux-gnu-ld
makeWrapper aarch64-unknown-linux-gnu-ar aarch64-linux-gnu-ar
'';
buildPhase = ''
runHook preBuild
./make.sh nanopi6
runHook postBuild
'';
} But it just fails with the same errors:
I have no idea what the |
I thought that the
|
But the build instructions in the wiki do say we need the toolchain in the
So maybe trying to build this with Nix is a bad idea, if the only easy way is using their toolchain. |
Aaaaand it worked:
Thank fuck. |
This error can be fixed by removing
|
It does have trouble mounting the eMMC:
But that's a minor issue that can probably be solved by moving the EFI partition to the NVMe. |
It seems after booting it just doesn't see the eMMC:
Unlike Armbian. Probably due to lack of DTS for Rock 5B:
|
And there we have it:
Though it seems there's issues with the network interface:
|
Partitioning used: format() {
parted -s --align optimal "$1" -- mklabel gpt;
parted -s --align optimal "$1" -- mkpart 'EFI' 2MB 6GiB set 1 esp on;
parted -s --align optimal "$1" -- mkpart 'SWAP' 6GiB 16GiB;
parted -s --align optimal "$1" -- mkpart 'ROOT' 16GiB '100%';
parted -s --align optimal "$1" -- print;
mkswap /dev/nvme0n1p2;
mkfs.vfat /dev/nvme0n1p1;
mkfs.ext4 /dev/nvme0n1p2;
} |
Looks like the WAN interface isn't recognixed, the
|
This is a weird issue I have not seen before:
You need to run |
I though by using
But unfortunately we can't. Might require the DST patches anyway. |
Added docs and config:
Will migrate NVMe from |
I have found a working slimmed down 6.6-rc6 kernel config:
But it doesn't seem like it actually adds anything, since both eMMC and the WAN interface still don't show up. |
Some cleanup of no longer necessary files:
Can always be restored if necessary. |
Fixed iptables failures in
Fixes errors like:
|
Thanks to a suggestion in this Discourse post I made: I decided to write a stock And the NVMe is detected without issues:
|
Fuck, I can't use unstable NixOS and then switch to stable because mainline ZFS has extra features:
So I have to use |
But when i use
|
And there we have it. NanoPi R6C running NixOS 23.05 with
Changes:
Might write up a wiki page for this device on the weekend: https://nixos.wiki/wiki/NixOS_Wiki:Contributing |
This is helpful, thank you. Did you get the WAN port working? |
No, I'm running NixOS 23.11 with
I don't need both ports so I have not looked into it. |
I followed your instructions here, but I used a newer EFI: and a newer NixOS ISO: https://hydra.nixos.org/build/273422643/download/1/nixos-minimal-24.11pre684053 Everything seems the be working but reads (and I assume writes) to the NVMe are very slow:
Any ideas for something I could have missed in configuration. Or should I reinstall with the older NixOS and/or EFI? |
I'm still on
And as far as I know I've installed Might be more of a firmware issue than software one. |
Thanks for the response! It appears to be an OS/software issue. I booted (using the 0.11.2 EFI) from an SDCard with the vendor's Debian 12 image and installed and ran
I guess I'll try it with |
Update: I'm seeing the same issue when booting from |
I actually lock kernel at nixos-config/hosts/arael/configuration.nix Lines 32 to 33 in 7e5e89c
Maybe it's worth trying a downgrade of the kernel? Though an older edk2-rk3588 might also be worth checking.
You issues suggest to me that I might not want to try to upgrade my version of |
I must confess that I am a NixOS beginner. I use NixPkgs on macOS and Linux, I've played with NixOS VMs, and I've booted a Raspberry Pi with a standard NixOS SDCard image, but this is my first time doing a NixOS install on "real" hardware. I technically had the system running, but every time a did a I have wiped the SSD and will start all over with 0.9.1 of Thanks, again for your help. |
Yeah, since this is not a very powerful device building anything is going to take a while, especially if you have that terrible read performance from the NVMe, and Nix makes a LOT of small reads when re-evaluating configuration. If you have general NixOS questions you can just wite to me over email, it's in my GitHub profile. |
I tried I order a new Samsung 1TB SSD yesterday (I couldn't find your exact model) and it arrived today. I installed it and everything is working great! Thanks for your help! Now it's time to tempt fate and try reinstalling but formatting with BTRFS this time... |
Nice. So as I thought it was some kind of incompatibility between PCIe controller and the NVMe. Also, ZFS is better. |
Yes, thank you for suggesting that. Apparently you can never have too many (working) SSDs... I believe you that ZFS is better. But BTRFS seems to do everything I need for a SBC with a single NVMe SSD. I've also noticed that some builds of NixOS (latest kernels, I think) don't have ZFS. I will give a try eventually, though. I will send you an email. Thanks, again for your help! |
Research into running NixOS on a NanoPi R6C device.
Links:
The text was updated successfully, but these errors were encountered: