Arcayr / orangepizero3-nix

kernel source and uboot configuration for linux 6.1.31 for the orange pi zero 3. mirror of https://forgejo.rascals.net/arcayr/orangepizero3-nix
https://forgejo.rascals.net/arcayr/orangepizero3-nix
4 stars 2 forks source link
linux-kernel nix nixos orangepi

kernel source and uboot configuration for linux 6.1.31 for the orange pi zero 3.

disclaimers

layout

└───packages
    └───aarch64-linux
        ├───firmwareOrangePiZero3: package 'uwe5622-firmware-6.1.31-sun50iw9'
        ├───linuxOrangePiZero3: package 'linux-6.1.31-sun50iw9'
        └───ubootOrangePiZero3: package 'uboot-orangepi_zero3_defconfig-2021.07-sunxi'

sources

usage

for your own orange pi zero 3: here's a snapshot of my own configuration, which should be a good starting point. some of the options are probably redundant, but i'd rather be safe than sorry.

{
  imports = [
    "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
  ];

  nixpkgs.hostPlatform = "aarch64-linux";

  # dodge "module <x> not found" error for socs.
  hardware.enableRedistributableFirmware = false;
  nixpkgs.overlays = [
      (final: super: {
      makeModulesClosure = x:
          super.makeModulesClosure (x // { allowMissing = true; });
      })
  ];

  # u-boot, no grub, no efi.
  boot.loader.grub.enable = false;
  boot.loader.generic-extlinux-compatible.enable = true;
  boot.loader.efi.canTouchEfiVariables = false;

  # slim supported filesystems.
  boot.supportedFilesystems = pkgs.lib.mkForce ["vfat" "ext4"];
  boot.initrd.supportedFilesystems = pkgs.lib.mkForce ["vfat" "ext4"];

  # your shiny custom kernel.
  boot.kernelPackages = pkgs.orangePiZero3; # however you get the package here is up to you - overlay or directly from the flake.

  # opi needs the uboot image written to a specific part of the firmware.
  sdImage.postBuildCommands = ''dd if=${inputs.opiz3-nix.packages.aarch64-linux.ubootOrangePiZero3}/u-boot-sunxi-with-spl.bin of=$img bs=8 seek=1024 conv=notrunc'';

  # this gets burned straight onto an sd. no point in zstd.
  sdImage.compressImage = false;
}

then you can build the sd image with nix build .#<configuration name>.config.system.build.sdImage.

for the defconfig use pkgs/linux/sun50iw9_defconfig. the vendor-provided one is short a bunch of things.

contributing

if you have a forgejo instance, or access to one, you can fork and submit patches. i personally recommend codeberg if you aren't hosting your own.

license

everything outside of src/ is agpl licensed except the defconfig.

pkgs/linux/sun50iw9_defconfig is the same license as the linux kernel.

directories in src/ contain their own licenses, as they are verbatim copies of the upstream sources.