mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-12-23 18:19:44 +01:00
parent
1facb18f43
commit
f39a23dab7
8 changed files with 289 additions and 0 deletions
|
@ -136,6 +136,7 @@ See code for all available configurations.
|
|||
| [Lenovo ThinkPad X13][] | `<nixos-hardware/lenovo/thinkpad/x13` |
|
||||
| [Microsoft Surface Range][] | `<nixos-hardware/microsoft/surface>` |
|
||||
| [Microsoft Surface Pro 3][] | `<nixos-hardware/microsoft/surface-pro/3>` |
|
||||
| [MNT Reform (i.MX8M)][] | `<nixos-hardware/mnt/reform2-nitrogen8m>` |
|
||||
| [MSI GS60 2QE][] | `<nixos-hardware/msi/gs60>` |
|
||||
| PC Engines APU | `<nixos-hardware/pcengines/apu>` |
|
||||
| [Raspberry Pi 2][] | `<nixos-hardware/raspberry-pi/2>` |
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
lenovo-thinkpad-x13-yoga = import ./lenovo/thinkpad/x13-yoga;
|
||||
microsoft-surface = import ./microsoft/surface;
|
||||
microsoft-surface-pro-3 = import ./microsoft/surface-pro/3;
|
||||
mnt-reform2-nitrogen8m = import ./mnt/reform2-nitrogen8m;
|
||||
pcengines-apu = import ./pcengines/apu;
|
||||
raspberry-pi-2 = import ./raspberry-pi/2;
|
||||
raspberry-pi-4 = import ./raspberry-pi/4;
|
||||
|
|
86
mnt/reform2-nitrogen8m/default.nix
Normal file
86
mnt/reform2-nitrogen8m/default.nix
Normal file
|
@ -0,0 +1,86 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ../../common/pc/laptop/ssd ];
|
||||
|
||||
boot = {
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_reformNitrogen8m_latest;
|
||||
|
||||
kernelParams = [ "console=ttymxc0,115200" "console=tty1" "pci=nomsi" ];
|
||||
|
||||
extraModprobeConfig = "options imx-dcss dcss_use_hdmi=0";
|
||||
|
||||
initrd = {
|
||||
kernelModules = [ "nwl-dsi" "imx-dcss" ];
|
||||
availableKernelModules = # hack to remove ATA modules
|
||||
lib.mkForce ([
|
||||
"cryptd"
|
||||
"dm_crypt"
|
||||
"dm_mod"
|
||||
"input_leds"
|
||||
"mmc_block"
|
||||
"nvme"
|
||||
"usbhid"
|
||||
"xhci_hcd"
|
||||
] ++ config.boot.initrd.luks.cryptoModules);
|
||||
};
|
||||
|
||||
loader = {
|
||||
generic-extlinux-compatible.enable = lib.mkDefault true;
|
||||
grub.enable = lib.mkDefault false;
|
||||
timeout = lib.mkDefault 1;
|
||||
# Cannot interact with U-Boot directly
|
||||
};
|
||||
};
|
||||
|
||||
environment.etc."systemd/system.conf".text = "DefaultTimeoutStopSec=15s";
|
||||
|
||||
environment.systemPackages = with pkgs; [ brightnessctl usbutils ];
|
||||
|
||||
hardware.deviceTree.name = lib.mkDefault "freescale/imx8mq-mnt-reform2.dtb";
|
||||
|
||||
hardware.pulseaudio.daemon.config.default-sample-rate = lib.mkDefault "48000";
|
||||
|
||||
nixpkgs = {
|
||||
system = "aarch64-linux";
|
||||
overlays = [
|
||||
(final: prev:
|
||||
with final; {
|
||||
|
||||
linux_5_7 = callPackage ./kernel/linux-5.7.nix {
|
||||
kernelPatches = [
|
||||
kernelPatches.bridge_stp_helper
|
||||
kernelPatches.request_key_helper
|
||||
kernelPatches.export_kernel_fpu_functions."5.3"
|
||||
];
|
||||
};
|
||||
|
||||
linux_reformNitrogen8m_latest =
|
||||
callPackage ./kernel { kernelPatches = [ ]; };
|
||||
|
||||
linuxPackages_reformNitrogen8m_latest =
|
||||
linuxPackagesFor linux_reformNitrogen8m_latest;
|
||||
|
||||
ubootReformImx8mq = callPackage ./uboot { };
|
||||
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
programs.sway.extraPackages = # unbloat
|
||||
lib.mkDefault (with pkgs; [ swaylock swayidle xwayland ]);
|
||||
|
||||
system.activationScripts.asound = let
|
||||
initialAsoundState = pkgs.fetchurl {
|
||||
url =
|
||||
"https://source.mnt.re/reform/reform-system-image/-/raw/84bec717ad7366b1d385f3200da192efb0f5bccb/reform2-imx8mq/template-etc/asound.state";
|
||||
sha256 = "11wfy8fad5mhr6bga36k7lri85wq74rfzwj9bb9j5rp5cll4jnmb";
|
||||
};
|
||||
in ''
|
||||
if [ ! -e "/var/lib/alsa/asound.state" ]; then
|
||||
mkdir -p /var/lib/alsa
|
||||
cp ${initialAsoundState} /var/lib/alsa/asound.state
|
||||
fi
|
||||
'';
|
||||
|
||||
}
|
97
mnt/reform2-nitrogen8m/kernel/default.nix
Normal file
97
mnt/reform2-nitrogen8m/kernel/default.nix
Normal file
|
@ -0,0 +1,97 @@
|
|||
{ lib, buildLinux, fetchurl, fetchgit, linux_5_7, kernelPatches, ... }@args:
|
||||
|
||||
let
|
||||
linux = linux_5_7;
|
||||
systemImageSrc = fetchgit {
|
||||
url = "https://source.mnt.re/reform/reform-system-image.git";
|
||||
rev = "ef6bae4def9ef08ee388254abf4f1839d44c07a1";
|
||||
sha256 = "03nnwjzm8a0bk821p6sfscd04x3jgj29l16ccdkg10xcv2g2z5s8";
|
||||
} + "/reform2-imx8mq";
|
||||
in lib.overrideDerivation (buildLinux (args // {
|
||||
inherit (linux) src version;
|
||||
|
||||
features = {
|
||||
efiBootStub = false;
|
||||
iwlwifi = false;
|
||||
} // (args.features or { });
|
||||
|
||||
kernelPatches = let
|
||||
patchDir = "${systemImageSrc}/template-kernel/patches";
|
||||
reformPatches = map ({ name, extraConfig ? "" }: {
|
||||
inherit name extraConfig;
|
||||
patch = "${patchDir}/${name}.patch";
|
||||
}) [
|
||||
{
|
||||
name = "0001-drm-bridge-Add-NWL-MIPI-DSI-host-controller-support";
|
||||
extraConfig = ''
|
||||
DRM_NWL_MIPI_DSI m
|
||||
'';
|
||||
}
|
||||
{ name = "0002-dt-bindings-display-bridge-Add-binding-for-NWL-mipi-"; }
|
||||
{
|
||||
name =
|
||||
"0003-DCSS-v4-Add-support-for-iMX8MQ-Display-Controller-Subsystem";
|
||||
extraConfig = ''
|
||||
DRM_IMX_DCSS m
|
||||
'';
|
||||
}
|
||||
{ name = "4101-media-vb2-wait-for-dmabuf-fences"; }
|
||||
{ name = "4201-HACK-media-vb2-don-t-validate-buffer-length"; }
|
||||
{ name = "44f0bbdcf0433052b4e85940cb41d04c13fdad57"; }
|
||||
{ name = "git.linuxtv.org-28a202c55963386b8bc45bcc52029362e9aa0d33"; }
|
||||
{ name = "git.linuxtv.org-88d06362d1d052e4c844ac95a2ca308ed4d90452"; }
|
||||
{ name = "mnt1000-pcie-reparent-clocks"; }
|
||||
{ name = "mnt1001-pcie-support-internal-refclk-aspm"; }
|
||||
{ name = "mnt2000-audio-wm8960-add-dacslope-setting"; }
|
||||
{ name = "mnt2001-audio-sai-workaround-rate-matching"; }
|
||||
{ name = "mnt3000-imx-dcss-tweak-DCSS-pixel-rate-to-prevent-sporadic-d"; }
|
||||
{ name = "mnt3001-nwl-dsi-disable-bridge_mode_fixup-that-breaks-hs-vs-"; }
|
||||
{ name = "mnt3002-MNT-Reform2-add-simple-panel-Innolux-N125HCE-GN1"; }
|
||||
{
|
||||
name = "mnt3003-MNT-Reform-import-cadence-HDMI-driver-for-imx8mq-fro";
|
||||
extraConfig = ''
|
||||
DRM_CDNS_AUDIO m
|
||||
DRM_CDNS_DP m
|
||||
DRM_CDNS_HDMI m
|
||||
DRM_CDNS_HDMI_CEC m
|
||||
DRM_CDNS_MHDP m
|
||||
'';
|
||||
}
|
||||
{ name = "mnt3004-MNT-Reform-imx8mq-add-PHY_27M-clock"; }
|
||||
{ name = "mnt3005-MNT-Reform-imx8mq-DCSS-add-module-option-to-toggle-h"; }
|
||||
{ name = "mnt3006-MNT-Reform-imx8mq-add-PHY_27M-clock-missing-define"; }
|
||||
{
|
||||
name = "mnt3007-MNT-Reform-imx8mq-missing-kconf-makefile-for-cadence";
|
||||
extraConfig = ''
|
||||
DRM_IMX_CDNS_MHDP m
|
||||
DRM_IMX_DCSS m
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "mnt3008-MNT-Reform-imx8mq-missing-makefile-change-for-imx-dc";
|
||||
extraConfig = ''
|
||||
DRM_IMX_DCSS m
|
||||
'';
|
||||
}
|
||||
];
|
||||
in lib.lists.unique (kernelPatches ++ reformPatches ++ [{
|
||||
name = "MNT-Reform-imx8mq-config";
|
||||
patch = null;
|
||||
extraConfig = fetchurl {
|
||||
url =
|
||||
"https://github.com/NixOS/nixos-hardware/releases/download/mnt-reform2-nitrogen8m-v1/kernel-config";
|
||||
sha256 = "1brazbr9zflb29i4fjhwn1z87bg475lqvzkksvi5n775zx28fk65";
|
||||
};
|
||||
}]);
|
||||
|
||||
allowImportFromDerivation = true;
|
||||
|
||||
} // (args.argsOverride or { }))) (attrs: {
|
||||
prePatch = attrs.prePatch + ''
|
||||
cp ${systemImageSrc}/template-kernel/*.dts arch/arm64/boot/dts/freescale/
|
||||
cp ${systemImageSrc}/template-kernel/*.dtsi arch/arm64/boot/dts/freescale/
|
||||
echo 'dtb-$(CONFIG_ARCH_MXC) += imx8mq-mnt-reform2.dtb' >> \
|
||||
arch/arm64/boot/dts/freescale/Makefile
|
||||
'';
|
||||
makeFlags = attrs.makeFlags ++ [ "LOADADDR=0x40480000" ];
|
||||
})
|
18
mnt/reform2-nitrogen8m/kernel/linux-5.7.nix
Normal file
18
mnt/reform2-nitrogen8m/kernel/linux-5.7.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ lib, stdenv, buildPackages, fetchurl, perl, buildLinux, modDirVersionArg ? null, ... } @ args:
|
||||
|
||||
with lib;
|
||||
|
||||
buildLinux (args // rec {
|
||||
version = "5.7.19";
|
||||
|
||||
# modDirVersion needs to be x.y.z, will automatically add .0 if needed
|
||||
modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
|
||||
|
||||
# branchVersion needs to be x.y
|
||||
extraMeta.branch = versions.majorMinor version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
|
||||
sha256 = "1rwzp51ddlkdzanj6i8jqj5yh0njpzn7ly4r8nnzwkdfp5465721";
|
||||
};
|
||||
} // (args.argsOverride or {}))
|
16
mnt/reform2-nitrogen8m/uboot/default.nix
Normal file
16
mnt/reform2-nitrogen8m/uboot/default.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ buildUBoot, fetchgit }:
|
||||
|
||||
buildUBoot rec {
|
||||
pname = "uboot-reform2-imx8mq";
|
||||
version = "2020-06-01";
|
||||
src = fetchgit {
|
||||
url = "https://source.mntmn.com/MNT/reform-boundary-uboot.git";
|
||||
rev = version;
|
||||
sha256 = "0ychnwhisjqm0gzyz0nv9xynl9g114xmxpwz4vm0l5w6sc60jshw";
|
||||
};
|
||||
defconfig = "nitrogen8m_som_4g_defconfig";
|
||||
extraMeta.platforms = [ "aarch64-linux" ];
|
||||
filesToInstall = [ "flash.bin" ];
|
||||
patches = [ ./shell-syntax.patch ./env_vars.patch ];
|
||||
makeFlags = filesToInstall;
|
||||
}
|
57
mnt/reform2-nitrogen8m/uboot/env_vars.patch
Normal file
57
mnt/reform2-nitrogen8m/uboot/env_vars.patch
Normal file
|
@ -0,0 +1,57 @@
|
|||
commit 32ba0e0bf12827a67959f435e457fb4594a6708f
|
||||
Author: Emery Hemingway <ehmry@posteo.net>
|
||||
Date: Mon Jul 27 10:18:38 2020 +0200
|
||||
|
||||
reform: set envvars for booting NixOS
|
||||
|
||||
diff --git a/board/boundary/nitrogen8m_som/nitrogen8m_som.c b/board/boundary/nitrogen8m_som/nitrogen8m_som.c
|
||||
index d4d866001d..d1fac5934f 100644
|
||||
--- a/board/boundary/nitrogen8m_som/nitrogen8m_som.c
|
||||
+++ b/board/boundary/nitrogen8m_som/nitrogen8m_som.c
|
||||
@@ -322,17 +322,13 @@ void init_usb_clk(int usbno);
|
||||
|
||||
static void set_env_vars(void)
|
||||
{
|
||||
- printf("set_env_vars()");
|
||||
- env_set("board", "MNT Reform 2.0"); // "nitrogen8m_som");
|
||||
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
|
||||
+ if (!env_get("board"))
|
||||
+ env_set("board", "imx8mq-mnt-reform2");
|
||||
env_set("soc", "imx8mq");
|
||||
env_set("imx_cpu", get_imx_type((get_cpu_rev() & 0xFF000) >> 12));
|
||||
env_set("uboot_defconfig", CONFIG_DEFCONFIG);
|
||||
-
|
||||
- // MNT Reform 2
|
||||
- env_set("fdt_addr", "0x50000000");
|
||||
- env_set("bootargs", "noinitrd root=/dev/mmcblk1p1 rootwait rw console=ttymxc0,115200 console=tty1 cma=512M no_console_suspend pci=nomsi");
|
||||
- env_set("bootcmd", "ext4load mmc 1 ${loadaddr} /Image; ext4load mmc 1 ${fdt_addr} /imx8mq-mnt-reform2.dtb; booti ${loadaddr} - ${fdt_addr}");
|
||||
- env_set("bootdelay", "1");
|
||||
+#endif
|
||||
}
|
||||
|
||||
void board_set_default_env(void)
|
||||
diff --git a/include/configs/nitrogen8m_som.h b/include/configs/nitrogen8m_som.h
|
||||
index 3ada3900db..548e7cd71c 100644
|
||||
--- a/include/configs/nitrogen8m_som.h
|
||||
+++ b/include/configs/nitrogen8m_som.h
|
||||
@@ -208,7 +208,7 @@
|
||||
#define SYS_AUXCORE_BOOTDATA_DDR 0x80000000
|
||||
#define SYS_AUXCORE_BOOTDATA_TCM 0x007E0000
|
||||
|
||||
-/*#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
+#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
"console=" BD_CONSOLE "\0" \
|
||||
"env_dev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
|
||||
"env_part=" __stringify(CONFIG_SYS_MMC_ENV_PART) "\0" \
|
||||
@@ -247,7 +247,10 @@
|
||||
"setenv ipaddr 10.0.0.2; " \
|
||||
"setenv netmask 255.255.255.0; " \
|
||||
"setenv serverip 10.0.0.1;\0" \
|
||||
- BOOTENV*/
|
||||
+ BOOTENV \
|
||||
+ "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
|
||||
+ "ramdisk_addr_r=0x44480000\0" \
|
||||
+ "fdt_addr_r=0x43000000\0"
|
||||
|
||||
/*
|
||||
* PCI express
|
13
mnt/reform2-nitrogen8m/uboot/shell-syntax.patch
Normal file
13
mnt/reform2-nitrogen8m/uboot/shell-syntax.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
|
||||
index f8c3fff1d1..bb68e119e2 100644
|
||||
--- a/scripts/Makefile.lib
|
||||
+++ b/scripts/Makefile.lib
|
||||
@@ -299,7 +299,7 @@ quiet_cmd_dtc = DTC $@
|
||||
# Modified for U-Boot
|
||||
# Bring in any U-Boot-specific include at the end of the file
|
||||
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
|
||||
- (cat $<; $(if $(u_boot_dtsi),echo '\#include "$(u_boot_dtsi)"')) > $(pre-tmp); \
|
||||
+ (cat $<; $(if $(u_boot_dtsi),echo '#include "$(u_boot_dtsi)"')) > $(pre-tmp); \
|
||||
$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
|
||||
$(DTC) -O dtb -o $@ -b 0 \
|
||||
-i $(dir $<) $(DTC_FLAGS) \
|
Loading…
Reference in a new issue