|
|
(2 intermediate revisions by 2 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 limited support of allwiner H616 soc was introduced to the Linux upstream kernel since 6.0 version, see [[#Periphery|periphery]] for details.
| |
− | | |
− | == 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 ===
| |
− | | |
− | To get the more useful output from board better to build image with kernel which supports more periphery (like USB). See [[#Periphery|periphery]].
| |
− | | |
− | == Serial console==
| |
− | | |
− | The default console configuration from sd-image-aarch64 works out of the box.
| |
− | | |
− | == Ethernet ==
| |
− | | |
− | Connected at 1Gbps mode.
| |
− | | |
− | == Periphery==
| |
− | | |
− | Current newest numerated kernel version 6.1 does not contains full H616 sock support. At least some regulators and USB blocks are [https://github.com/torvalds/linux/blob/v6.1-rc8/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi missing] in DTS. But they are [https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi available] in master branch.
| |
− | | |
− | Here is flake with which an image with better periphery support (at least - USB) may be build.
| |
− | | |
− | <syntaxHighlight lang=nix>
| |
− | {
| |
− | description = "Build image for OrangePi Zero 2";
| |
− | inputs = {
| |
− | nixpkgs.url = github:nixos/nixpkgs/nixos-22.11;
| |
− | };
| |
− | outputs = { self, nixpkgs }: let
| |
− | system = "aarch64-linux";
| |
− | | |
− | #Build manipulation
| |
− | stateVersion = "22.11"; # NixOS Version
| |
− | useUnstableKernel = true; # Set to false to use mainline kernel
| |
− | compressImage = true; # Set to false to disable image compressing
| |
− | | |
− | pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgsCross.aarch64-multiplatform;
| |
− | | |
− | # Build unstable kernel
| |
− | kernel =
| |
− | with pkgs;
| |
− | with lib;
| |
− | buildLinux rec {
| |
− | kernelPatches = [
| |
− | linuxKernel.kernelPatches.bridge_stp_helper
| |
− | linuxKernel.kernelPatches.request_key_helper
| |
− | ];
| |
− | src = fetchGit {
| |
− | url = git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git;
| |
− | rev = "8395ae05cb5a2e31d36106e8c85efa11cda849be";
| |
− | };
| |
− | version = "6.1.0";
| |
− | modDirVersion = version;
| |
− | extraMeta.branch = versions.majorMinor version;
| |
− | };
| |
− | | |
− | # Boot related configuration
| |
− | bootConfig = let
| |
− | bootloaderPackage = pkgs.ubootOrangePiZero2;
| |
− | bootloaderSubpath = "/u-boot-sunxi-with-spl.bin";
| |
− | # Disable ZFS support to prevent problems with fresh kernels.
| |
− | filesystems = pkgs.lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs"
| |
− | "ntfs" "cifs" /* "zfs" */ "ext4" "vfat"
| |
− | ];
| |
− | in {
| |
− | system.stateVersion = stateVersion;
| |
− | boot.kernelPackages = if useUnstableKernel
| |
− | then pkgs.linuxPackagesFor kernel
| |
− | else pkgs.linuxPackages_latest;
| |
− | boot.supportedFilesystems = filesystems;
| |
− | boot.initrd.supportedFilesystems = filesystems;
| |
− | sdImage = {
| |
− | postBuildCommands = ''
| |
− | # Emplace bootloader to specific place in firmware file
| |
− | dd if=${bootloaderPackage}${bootloaderSubpath} of=$img \
| |
− | bs=8 seek=1024 \
| |
− | conv=notrunc # prevent truncation of image
| |
− | '';
| |
− | inherit compressImage;
| |
− | };
| |
− | };
| |
− | | |
− | # NixOS configuration
| |
− | nixosSystem = nixpkgs.lib.nixosSystem rec {
| |
− | inherit system;
| |
− | modules = [
| |
− | # Default aarch64 SOC System
| |
− | "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
| |
− | # Minimal configuration
| |
− | "${nixpkgs}/nixos/modules/profiles/minimal.nix"
| |
− | { config = bootConfig; }
| |
− | # Put your configuration here. e.g. ./configuration.nix
| |
− | ];
| |
− | };
| |
− | in {
| |
− | inherit system;
| |
− | # Run nix build .#images.orangePiZero2 to build image.
| |
− | images = {
| |
− | orangePiZero2 = nixosSystem.config.system.build.sdImage;
| |
− | };
| |
− | };
| |
− | }
| |
− | </syntaxHighlight>
| |
− | | |
− | {{note|Be careful with such firmware - the unstable kernel version may be harmfull}}
| |
− | | |
− | === USB ===
| |
− | | |
− | The suggested master kernel supports only the onboard usb ports (not sure about USB type-C). If you want to use extension board or D+/D- pins, you need to add dts overlay to enable ehci and ohci ports. Just enable them all, putting this to configuration:
| |
− | | |
− | <syntaxHighlight lang=nix>
| |
− | hardware.deviceTree = {
| |
− | enable = true;
| |
− | filter = "sun50i-h616-orangepi-zero2.dtb";
| |
− | overlays = [
| |
− | {
| |
− | name = "sun50i-h616-orangepi-zero2.dtb";
| |
− | dtsText = ''
| |
− | /dts-v1/;
| |
− | /plugin/;
| |
− | | |
− | / {
| |
− | compatible = "xunlong,orangepi-zero2", "allwinner,sun50i-h616";
| |
− | };
| |
− | | |
− | &ehci0 {
| |
− | status = "okay";
| |
− | };
| |
− | | |
− | &ehci1 {
| |
− | status = "okay";
| |
− | };
| |
− | | |
− | &ehci2 {
| |
− | status = "okay";
| |
− | };
| |
− | | |
− | &ehci3 {
| |
− | status = "okay";
| |
− | };
| |
− | | |
− | &ohci0 {
| |
− | status = "okay";
| |
− | };
| |
− | | |
− | &ohci1 {
| |
− | status = "okay";
| |
− | };
| |
− | | |
− | &ohci2 {
| |
− | status = "okay";
| |
− | };
| |
− | | |
− | &ohci3 {
| |
− | status = "okay";
| |
− | };
| |
− | '';
| |
− | }
| |
− | ];
| |
− | };
| |
− | </syntaxHighlight>
| |
− | | |
− | === WiFi ===
| |
− | | |
− | According to SOC [https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi dts], Wi-Fi does not supported yet in mainline.
| |
− | | |
− | === HDMI ===
| |
− | | |
− | According to SOC [https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi dts], HDMI does not supported yet in mainline.
| |
− | | |
− | == 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]
| |