Difference between revisions of "NixOS on ARM/Orange Pi Zero2 H616"

From NixOS Wiki
Jump to: navigation, search
m (rollback unauthorized mass edits)
Tag: Rollback
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{ARM/breadcrumb}}
+
This page has been moved to the official NixOS Wiki:
<div class="infobox">
 
{|class="table"
 
!colspan="2" class="title"|Orange Pi Zero2 (H616)
 
|-
 
|colspan="2"|[[File:Orange-pi-zero-two-h616.png|frameless|256px|An Orange Pi Zero Plus2 (H5).]]
 
|-
 
!Manufacturer
 
|Xunlong / Orange Pi
 
|-
 
!Architecture
 
|AArch64
 
|-
 
!Bootloader
 
|[https://hydra.nixos.org/job/nixpkgs/trunk/ubootOrangePiZero2.aarch64-linux Upstream u-boot]<ref>https://github.com/NixOS/nixpkgs/pull/125743</ref>
 
|-
 
!Maintainer
 
|[[User:Ein-shved|Ein-shved]]
 
|}
 
</div>
 
  
== Status ==
+
    ⇒ '''[https://wiki.nixos.org/wiki/NixOS_on_ARM/Orange_Pi_Zero2_H616 NixOS on ARM/Orange Pi Zero2 H616]'''
  
Upstream unstable NixOS AArch64 image will boot on the Orange Pi Zero2 (H616), using the proper upstream u-boot.
+
''— samueldr, Lead of NixOS on ARM.''
 
 
The support of allwiner H616 soc was introduced to the Linux upstream kernel since 6.0 version, but the 5.15.78 kernel still able to boot from unstable NixOS brunch.
 
 
 
== Board-specific installation notes ==
 
 
 
=== Fastest way ===
 
 
 
First follow the [[NixOS_on_ARM#Installation|generic installation steps]] to get the installer image on an SD card.
 
 
 
U-Boot needs to be copied to specific sectors on the microSD card with <code>dd</code>. Download u-boot for the board, and copy it to the correct location with (again, replace <code>/dev/sdX</code> with the correct path to the SD card device):
 
 
 
<syntaxhighlight lang="bash">sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8</syntaxhighlight>
 
 
 
Then, install using the [[NixOS_on_ARM#NixOS_installation_.26_configuration|installation and configuration steps]].
 
 
 
=== Better way ===
 
 
 
You can use next flake to prepare ready-to-work image
 
 
 
<syntaxHighlight lang=nix>
 
{
 
  description = "Build image for Orange Pi Zero2 H616";
 
  inputs.nixpkgs.url = github:nixos/nixpkgs;
 
  outputs = { self, nixpkgs }: rec {
 
    # Better to avoid cross-compiling to
 
    # download derivations from cache
 
    system = "aarch64-linux";
 
    nixosConfigurations.orpiz2 = nixpkgs.lib.nixosSystem rec {
 
      system = "aarch64-linux";
 
      modules = [
 
        # Based on generic aarch64 image
 
        "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
 
        {
 
          config = let
 
            # Appropriate bootloader
 
            bootloader = nixpkgs.legacyPackages.
 
              aarch64-linux.ubootOrangePiZero2;
 
          in {
 
            system.stateVersion = "22.11";
 
            # Use the supported kernel
 
            boot.kernelPackages = nixpkgs.legacyPackages.
 
              aarch64-linux.linuxKernel.packages.linux_6_0;
 
            sdImage.postBuildCommands = ''
 
              # Emplace bootloader to specific place in firmware file
 
              dd if=${bootloader}/u-boot-sunxi-with-spl.bin of=$img \
 
                  bs=1024 seek=8 \
 
                  conv=notrunc # avoid truncation of image
 
            '';
 
          };
 
        }
 
      ];
 
    };
 
    images = {
 
      orpiz2 = nixosConfigurations.orpiz2.config.system.build.sdImage;
 
    };
 
  };
 
}
 
</syntaxHighlight>
 
 
 
Run <syntaxhighlight lang="bash">nix build .#images.orpiz2</syntaxhighlight> to prepare image
 
 
 
== Serial console==
 
 
 
The default  console configuration from sd-image-aarch64 works out of the box.
 
 
 
== Ethernet ==
 
 
 
Connected at 1Gbps mode.
 
 
 
== USB ==
 
 
 
The vanilla dts from kernel 6.0.9 does not contains required usb sections. Working on correct dts overlay for it.
 
 
 
== Wireless ==
 
 
 
Not tested
 
 
 
== HDMI ==
 
 
 
Not tested
 
 
 
== Resources ==
 
 
 
* [http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/Orange-Pi-Zero-2.html Official product page]
 
* [https://linux-sunxi.org/Xunlong_Orange_Pi_Zero2 wiki page]
 

Latest revision as of 11:07, 6 April 2024

This page has been moved to the official NixOS Wiki:

    ⇒ NixOS on ARM/Orange Pi Zero2 H616

— samueldr, Lead of NixOS on ARM.