Create nixos rootfs for aarch64

I want to install nixos into bananapi r64 with mt7622 soc and I cannot find any good tutorial/doc about building rootfs.

I already can build bootable sd card with u-boot & kernel from upstream and Debian stable as rootfs. Now I want to replace Debian with rootfs. What steps should I do to create nixos rootfs for aarch64?

1 Like

Does the generic aarch64 image boot? You probably have to flash your model specific uboot onto the sd card after flashing the generic image.
You can build uboot easily too. NixOS on ARM - NixOS Wiki
Does the board require a specific kernel? You can use a 2nd sd card in case you need to compile natively on an existing arm linux.

No, unfortunately it does not boot. And I think that it is a bit hard to just flash custom u-boot to existing iso from Hydra - Build 160952654 of job nixos:trunk-combined:nixos.sd_image.aarch64-linux since it has also specific first stage bootloader that should be placed in MBR partition with boot flag.

You can build uboot easily too.

Yes I know that I can build and u-boot, my question is not about building u-boot.

Does the board require a specific kernel?

Yes, it requires a bit specific kernel with patches that is not merged to upstream kernel repo. But I think that upstream kernel can boot just there will be issues with pci-e. But again, Iā€™m not asking about building kernel)

I will try to rephrase my question. I have prepared iso with first stage bootloader, correctly signed u-boot, boot partition and root parition. U-boot uses syslinux configs in boot partition to load kernel. Kernel with dtb and syslinux configs is placed in boot partition (lets say partition #2) mounted into /mnt/boot on host system. Kernel options in syslinux config tells to kernel use partition #3 as root file system and this partition mounted to the /mnt/root on host system. Host system is x86-64 NixOS and have binfmt_misc capability.

Can I install aarch64 NixOS into /mnt/root from such host system? And if I can what should I do?