diff --git a/README.md b/README.md index 91f95d911..cff156861 100644 --- a/README.md +++ b/README.md @@ -421,6 +421,7 @@ See code for all available configurations. | [Radxa ROCK 5 Model B](radxa/rock-5b) | `` | `rock-5b` | | [Radxa ROCK Pi 4](radxa/rock-pi-4) | `` | `rock-pi-4` | | [Radxa ROCK Pi E](radxa/rock-pi-e) | `` | `rock-pi-e` | +| [Radxa Dragon Q6A](radxa/dragon-q6a) | `` | `dragon-q6a` | | [Raspberry Pi 2](raspberry-pi/2) | `` | `raspberry-pi-2` | | [Raspberry Pi 3](raspberry-pi/3) | `` | `raspberry-pi-3` | | [Raspberry Pi 4](raspberry-pi/4) | `` | `raspberry-pi-4` | diff --git a/flake.nix b/flake.nix index 48ffb4a19..e63012469 100644 --- a/flake.nix +++ b/flake.nix @@ -397,6 +397,7 @@ rock-5b = import ./radxa/rock-5b; rock-pi-4 = import ./radxa/rock-pi-4; rock-pi-e = import ./radxa/rock-pi-e; + dragon-q6a = import ./radxa/dragon-q6a; kobol-helios4 = import ./kobol/helios4; samsung-np900x3c = import ./samsung/np900x3c; slimbook-hero-rpl-rtx = import ./slimbook/hero/rpl-rtx; diff --git a/radxa/README.md b/radxa/README.md index 484f2b3fe..94b72c33f 100644 --- a/radxa/README.md +++ b/radxa/README.md @@ -11,8 +11,9 @@ Our goals are: * No support guarantee. We are not here to teach people how to use NixOS. We explicitly want to avoid packaging the entire vendor SDK bootloader and kernel -in Nix. Those are not going to be accepted in `nixpkgs`, and our targetted audiences -like homelabbers generally ignore the additional hardware features. +in Nix, unless necessary. Those are not going to be accepted in `nixpkgs`, and +our targetted audiences like homelabbers generally ignore the additional hardware +features. This also aligns with [NixOS on ARM](https://wiki.nixos.org/wiki/NixOS_on_ARM)'s definition of "support": diff --git a/radxa/dragon-q6a/default.nix b/radxa/dragon-q6a/default.nix new file mode 100644 index 000000000..115d69953 --- /dev/null +++ b/radxa/dragon-q6a/default.nix @@ -0,0 +1,54 @@ +{ + lib, + pkgs, + config, + ... +}: +{ + imports = [ + ../. + ]; + + config = { + hardware = { + radxa.enable = true; + }; + + boot = { + # We need a out-of-tree kernel for Dragon Q6A, otherwise important hardware such as NVME won't work. + kernelPackages = pkgs.linuxPackagesFor (import ./kernel.nix { inherit lib pkgs; }); + loader = { + systemd-boot = { + enable = lib.mkDefault true; + installDeviceTree = true; + }; + efi.canTouchEfiVariables = false; + }; + kernelParams = [ + "console=ttyMSM0,115200n8" + "earlycon" + "keep_bootcon" + ]; + + initrd = { + availableKernelModules = [ + "usb_storage" + "nvme" + "xhci_hcd" + ]; + }; + }; + + console.earlySetup = lib.mkDefault true; + + hardware = { + firmware = with pkgs; [ + linux-firmware + ]; + deviceTree = { + enable = true; + name = "qcom/qcs6490-radxa-dragon-q6a.dtb"; + }; + }; + }; +} diff --git a/radxa/dragon-q6a/kernel.nix b/radxa/dragon-q6a/kernel.nix new file mode 100644 index 000000000..980109952 --- /dev/null +++ b/radxa/dragon-q6a/kernel.nix @@ -0,0 +1,31 @@ +{ + lib, + pkgs, + ... +}: +pkgs.buildLinux { + defconfig = "qcom_module_defconfig"; + version = "6.17.1-4-q6a-radxa"; + modDirVersion = "6.17.1"; + + src = pkgs.fetchFromGitHub { + owner = "radxa"; + repo = "kernel"; + # Fixed in https://github.com/radxa-pkg/linux-qcom/tree/6.17.1-4 + rev = "996b43f72835d22c2f79e1f476dd34f90f9e69bb"; + hash = "sha256-5nWveVNY5GevkBws1CjKf6WOGLFakBgiNzBsf6B2rrQ="; + }; + + structuredExtraConfig = with lib.kernel; { + EFI_ZBOOT = lib.mkForce no; + NVME_AUTH = lib.mkForce yes; + }; + + extraConfig = '' + NOVA_CORE n + COMPRESSED_INSTALL n + WLAN_VENDOR_AIC8800 n + ''; + + ignoreConfigErrors = true; +}