Merge branch 'NixOS:master' into asus-tuf-fa507nv

This commit is contained in:
Emre Çebi 2024-04-23 17:38:44 +02:00 committed by GitHub
commit a47af4b59f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
60 changed files with 1014 additions and 42 deletions

View File

@ -5,8 +5,7 @@ queue_rules:
defaults:
actions:
queue:
allow_merging_configuration_change: true
method: rebase
merge_method: rebase
pull_request_rules:
- name: merge using the merge queue
conditions:

View File

@ -80,6 +80,7 @@ See code for all available configurations.
| [Apple MacBook Pro 11,5](apple/macbook-pro/11-5) | `<nixos-hardware/apple/macbook-pro/11-5>` |
| [Apple MacBook Pro 12,1](apple/macbook-pro/12-1) | `<nixos-hardware/apple/macbook-pro/12-1>` |
| [Apple MacBook Pro 14,1](apple/macbook-pro/14-1) | `<nixos-hardware/apple/macbook-pro/14-1>` |
| [Apple MacMini (2010, Intel, Nvidia)](apple/macmini/4) | `<nixos-hardware/apple/macmini/4>` |
| [Apple Macs with a T2 Chip](apple/t2) | `<nixos-hardware/apple/t2>` |
| [Asus ROG Ally RC71L (2023)](asus/ally/rc71l) | `<nixos-hardware/asus/ally/rc71l>` |
| [Asus ROG Strix G513IM](asus/rog-strix/g513im) | `<nixos-hardware/asus/rog-strix/g513im>` |
@ -104,6 +105,7 @@ See code for all available configurations.
| [Dell Latitude 3340](dell/latitude/3340) | `<nixos-hardware/dell/latitude/3340>` |
| [Dell Latitude 3480](dell/latitude/3480) | `<nixos-hardware/dell/latitude/3480>` |
| [Dell Latitude 5520](dell/latitude/5520) | `<nixos-hardware/dell/latitude/5520>` |
| [Dell Latitude 7280](dell/latitude/7280) | `<nixos-hardware/dell/latitude/7280>` |
| [Dell Latitude 7390](dell/latitude/7390) | `<nixos-hardware/dell/latitude/7390>` |
| [Dell Latitude 7430](dell/latitude/7430) | `<nixos-hardware/dell/latitude/7430>` |
| [Dell Latitude 7490](dell/latitude/7490) | `<nixos-hardware/dell/latitude/7490>` |
@ -143,9 +145,11 @@ See code for all available configurations.
| [Framework 12th Gen Intel Core](framework/13-inch/12th-gen-intel) | `<nixos-hardware/framework/13-inch/12th-gen-intel>` |
| [Framework 13th Gen Intel Core](framework/13-inch/13th-gen-intel) | `<nixos-hardware/framework/13-inch/13th-gen-intel>` |
| [Framework 13 AMD Ryzen 7040 Series](framework/13-inch/7040-amd) | `<nixos-hardware/framework/13-inch/7040-amd>` |
| [Framework 16 AMD Ryzen 7040 Series](framework/16-inch/cpu/7040-amd) | `<nixos-hardware/framework/16-inch/cpu/7040-amd>` |
| [FriendlyARM NanoPC-T4](friendlyarm/nanopc-t4) | `<nixos-hardware/friendlyarm/nanopc-t4>` |
| [FriendlyARM NanoPi R5s](friendlyarm/nanopi-r5s) | `<nixos-hardware/friendlyarm/nanopi-r5s>` |
| [Focus M2 Gen 1](focus/m2/gen1) | `<nixos-hardware/focus/m2/gen1>` |
| [Gigabyte B550](gigabyte/b550) | `<nixos-hardware/gigabyte/b550>` |
| [GPD MicroPC](gpd/micropc) | `<nixos-hardware/gpd/micropc>` |
| [GPD P2 Max](gpd/p2-max) | `<nixos-hardware/gpd/p2-max>` |
| [GPD Pocket 3](gpd/pocket-3) | `<nixos-hardware/gpd/pocket-3>` |
@ -171,6 +175,7 @@ See code for all available configurations.
| [Lenovo Legion 7 16achg6 (Hybrid)](lenovo/legion/16achg6/hybrid) | `<nixos-hardware/lenovo/legion/16achg6/hybrid>` |
| [Lenovo Legion 7 16achg6 (Nvidia)](lenovo/legion/16achg6/nvidia) | `<nixos-hardware/lenovo/legion/16achg6/nvidia>` |
| [Lenovo Legion 7i Pro 16irx8h (Intel)](lenovo/legion/16irx8h) | `<nixos-hardware/lenovo/legion/16irx8h>` |
| [Lenovo Legion Slim 7 Gen 7 (AMD)](lenovo/legion/16arha7/) | `<nixos-hardware/lenovo/legion/16arha7>` |
| [Lenovo Legion Y530 15ICH](lenovo/legion/15ich) | `<nixos-hardware/lenovo/legion/15ich>` |
| [Lenovo ThinkPad E14 (AMD)](lenovo/thinkpad/e14/amd) | `<nixos-hardware/lenovo/thinkpad/e14/amd>` |
| [Lenovo ThinkPad E14 (Intel)](lenovo/thinkpad/e14/intel) | `<nixos-hardware/lenovo/thinkpad/e14/intel>` |
@ -224,7 +229,8 @@ See code for all available configurations.
| [Lenovo ThinkPad X1 Nano Gen 1](lenovo/thinkpad/x1-nano/gen1) | `<nixos-hardware/lenovo/thinkpad/x1-nano/gen1>` |
| [Lenovo ThinkPad X13 Yoga](lenovo/thinkpad/x13/yoga) | `<nixos-hardware/lenovo/thinkpad/x13/yoga>` |
| [Lenovo ThinkPad X13 Yoga (3th Gen)](lenovo/thinkpad/x13/yoga/3th-gen) | `<nixos-hardware/lenovo/thinkpad/x13/yoga/3th-gen>` |
| [Lenovo ThinkPad X13](lenovo/thinkpad/x13) | `<nixos-hardware/lenovo/thinkpad/x13>` |
| [Lenovo ThinkPad X13 (Intel)](lenovo/thinkpad/x13/intel) | `<nixos-hardware/lenovo/thinkpad/x13/intel>` |
| [Lenovo ThinkPad X13 (AMD)](lenovo/thinkpad/x13/amd) | `<nixos-hardware/lenovo/thinkpad/x13/amd>` |
| [Lenovo ThinkPad X140e](lenovo/thinkpad/x140e) | `<nixos-hardware/lenovo/thinkpad/x140e>` |
| [Lenovo ThinkPad X200s](lenovo/thinkpad/x200s) | `<nixos-hardware/lenovo/thinkpad/x200s>` |
| [Lenovo ThinkPad X220](lenovo/thinkpad/x220) | `<nixos-hardware/lenovo/thinkpad/x220>` |
@ -235,7 +241,8 @@ See code for all available configurations.
| [Lenovo ThinkPad X280](lenovo/thinkpad/x280) | `<nixos-hardware/lenovo/thinkpad/x280>` |
| [Lenovo ThinkPad X390](lenovo/thinkpad/x390) | `<nixos-hardware/lenovo/thinkpad/x390>` |
| [Lenovo ThinkPad Z Series](lenovo/thinkpad/z) | `<nixos-hardware/lenovo/thinkpad/z>` |
| [Lenovo ThinkPad Z13](lenovo/thinkpad/z/z13) | `<nixos-hardware/lenovo/thinkpad/z/z13>` |
| [Lenovo ThinkPad Z13 Gen 1](lenovo/thinkpad/z/gen1/z13) | `<nixos-hardware/lenovo/thinkpad/z/gen1/z13>` |
| [Lenovo ThinkPad Z13 Gen 2](lenovo/thinkpad/z/gen2/z13) | `<nixos-hardware/lenovo/thinkpad/z/gen2/z13>` |
| [LENOVO Yoga 6 13ALC6 82ND](lenovo/yoga/6/13ALC6) | `<nixos-hardware/lenovo/yoga/6/13ALC6>` |
| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/amdgpu) | `<nixos-hardware/lenovo/yoga/7/14ARH7/amdgpu>` |
| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/nvidia) | `<nixos-hardware/lenovo/yoga/7/14ARH7/nvidia>` |
@ -251,8 +258,8 @@ See code for all available configurations.
| [Microsoft Surface Range (Common Modules)](microsoft/surface/common) | `<nixos-hardware/microsoft/surface/common>` |
| [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `<nixos-hardware/microsoft/surface-pro/3>` |
| [Morefine M600](morefine/m600) | `<nixos-hardware/morefine/m600>` |
| [NXP iMX8 MPlus Evaluation Kit](nxp/imx8mp-evk) | `<nixos-hardware/nxp/imx8mp-evk>` |
| [NXP iMX8 MQuad Evaluation Kit](nxp/imx8mq-evk) | `<nixos-hardware/nxp/imx8mq-evk>` |
| [NXP iMX8 MPlus Evaluation Kit](nxp/imx8mp-evk) | `<nixos-hardware/nxp/imx8mp-evk>` |
| [NXP iMX8 MQuad Evaluation Kit](nxp/imx8mq-evk) | `<nixos-hardware/nxp/imx8mq-evk>` |
| [Hardkernel Odroid HC4](hardkernel/odroid-hc4/default.nix) | `<nixos-hardware/hardkernel/odroid-hc4>` |
| [Hardkernel Odroid H3](hardkernel/odroid-h3/default.nix) | `<nixos-hardware/hardkernel/odroid-h3>` |
| [Omen 15-en0010ca](omen/15-en0010ca) | `<nixos-hardware/omen/15-en0010ca>` |
@ -265,6 +272,7 @@ See code for all available configurations.
| [PINE64 Pinebook Pro](pine64/pinebook-pro/) | `<nixos-hardware/pine64/pinebook-pro>` |
| [PINE64 RockPro64](pine64/rockpro64/) | `<nixos-hardware/pine64/rockpro64>` |
| [PINE64 STAR64](pine64/star64/) | `<nixos-hardware/pine64/star64>` |
| [Protectli VP4670](protectli/vp4670/) | `<nixos-hardware/protectli/vp4670>` |
| [Purism Librem 13v3](purism/librem/13v3) | `<nixos-hardware/purism/librem/13v3>` |
| [Purism Librem 15v3](purism/librem/13v3) | `<nixos-hardware/purism/librem/15v3>` |
| [Purism Librem 5r4](purism/librem/5r4) | `<nixos-hardware/purism/librem/5r4>` |
@ -282,4 +290,5 @@ See code for all available configurations.
| [Toshiba Chromebook 2 `swanky`](toshiba/swanky) | `<nixos-hardware/toshiba/swanky>` |
| [Tuxedo InfinityBook v4](tuxedo/infinitybook/v4) | `<nixos-hardware/tuxedo/infinitybook/v4>` |
| [TUXEDO InfinityBook Pro 14 - Gen7](tuxedo/infinitybook/pro14/gen7) | `<nixos-hardware/tuxedo/infinitybook/pro14/gen7>` |
| [TUXEDO Pulse 14 - Gen3](tuxedo/pulse/14/gen3) | `<nixos-hardware/tuxedo/pulse/14/gen3>` |
| [TUXEDO Pulse 15 - Gen2](tuxedo/pulse/15/gen2) | `<nixos-hardware/tuxedo/pulse/15/gen2>` |

View File

@ -0,0 +1,28 @@
{
lib,
...
}:
let
inherit (lib) mkDefault;
in
{
imports = [
../.
];
services.xserver.videoDrivers = mkDefault [ "nvidiaLegacy340" ];
hardware.opengl = {
enable = mkDefault true;
driSupport = mkDefault true;
driSupport32Bit = mkDefault true;
};
hardware.nvidia = {
modesetting.enable = mkDefault true;
powerManagement.enable = mkDefault false;
powerManagement.finegrained = mkDefault false;
open = mkDefault false;
nvidiaSettings = mkDefault true;
};
}

View File

@ -0,0 +1,6 @@
{
imports = [
../.
../../common/cpu/intel
];
}

View File

@ -15,7 +15,7 @@
# This will also cause "PCI-Express Runtime D3 Power Management" to be enabled by default
modesetting.enable = lib.mkDefault true;
dynamicBoost.enable = true;
dynamicBoost.enable = lib.mkDefault true;
prime = {
amdgpuBusId = "PCI:4:0:0";

View File

@ -0,0 +1,7 @@
{
imports = [ ../. ];
boot.kernelParams = [
"i915.enable_guc=2"
];
}

View File

@ -4,6 +4,4 @@
boot.blacklistedKernelModules = lib.optionals (!config.hardware.enableRedistributableFirmware) [
"ath3k"
];
services.xserver.libinput.enable = lib.mkDefault true;
}

View File

@ -0,0 +1,9 @@
{ lib, ... }:
{
imports = [
../../../common/cpu/intel
../../../common/pc/laptop
../../../common/pc/laptop/ssd
];
}

View File

@ -13,6 +13,7 @@
apple-macbook-pro-11-5 = import ./apple/macbook-pro/11-5;
apple-macbook-pro-12-1 = import ./apple/macbook-pro/12-1;
apple-macbook-pro-14-1 = import ./apple/macbook-pro/14-1;
apple-macmini-4-1 = import ./apple/macmini/4;
apple-t2 = import ./apple/t2;
asus-battery = import ./asus/battery.nix;
asus-ally-rc71l = import ./asus/ally/rc71l;
@ -38,6 +39,7 @@
dell-latitude-3340 = import ./dell/latitude/3340;
dell-latitude-3480 = import ./dell/latitude/3480;
dell-latitude-5520 = import ./dell/latitude/5520;
dell-latitude-7280 = import ./dell/latitude/7280;
dell-latitude-7390 = import ./dell/latitude/7390;
dell-latitude-7430 = import ./dell/latitude/7430;
dell-latitude-7490 = import ./dell/latitude/7490;
@ -76,6 +78,7 @@
framework-12th-gen-intel = import ./framework/13-inch/12th-gen-intel;
framework-13th-gen-intel = import ./framework/13-inch/13th-gen-intel;
framework-13-7040-amd = import ./framework/13-inch/7040-amd;
framework-16-7040-amd = import ./framework/16-inch/cpu/7040-amd;
friendlyarm-nanopc-t4 = import ./friendlyarm/nanopc-t4;
friendlyarm-nanopi-r5s = import ./friendlyarm/nanopi-r5s;
focus-m2-gen1 = import ./focus/m2/gen1;
@ -103,6 +106,7 @@
lenovo-legion-16achg6-hybrid = import ./lenovo/legion/16achg6/hybrid;
lenovo-legion-16achg6-nvidia = import ./lenovo/legion/16achg6/nvidia;
lenovo-legion-16aph8 = import ./lenovo/legion/16aph8;
lenovo-legion-16arha7 = import ./lenovo/legion/16arha7;
lenovo-legion-16ithg6 = import ./lenovo/legion/16ithg6;
lenovo-legion-16irx8h = import ./lenovo/legion/16irx8h;
lenovo-legion-y530-15ich = import ./lenovo/legion/15ich;
@ -160,7 +164,8 @@
lenovo-thinkpad-x1-extreme-gen4 = import ./lenovo/thinkpad/x1-extreme/gen4;
lenovo-thinkpad-x1-nano = import ./lenovo/thinkpad/x1-nano;
lenovo-thinkpad-x1-nano-gen1 = import ./lenovo/thinkpad/x1-nano/gen1;
lenovo-thinkpad-x13 = import ./lenovo/thinkpad/x13;
lenovo-thinkpad-x13 = import ./lenovo/thinkpad/x13/intel;
lenovo-thinkpad-x13-amd = import ./lenovo/thinkpad/x13/amd;
lenovo-thinkpad-x13-yoga = import ./lenovo/thinkpad/x13/yoga;
lenovo-thinkpad-x13-yoga-3th-gen = import ./lenovo/thinkpad/x13/yoga/3th-gen;
lenovo-thinkpad-x140e = import ./lenovo/thinkpad/x140e;
@ -173,7 +178,8 @@
lenovo-thinkpad-x280 = import ./lenovo/thinkpad/x280;
lenovo-thinkpad-x390 = import ./lenovo/thinkpad/x390;
lenovo-thinkpad-z = import ./lenovo/thinkpad/z;
lenovo-thinkpad-z13 = import ./lenovo/thinkpad/z/z13;
lenovo-thinkpad-z13-gen1 = import ./lenovo/thinkpad/z/gen1/z13;
lenovo-thinkpad-z13-gen2 = import ./lenovo/thinkpad/z/gen2/z13;
lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6;
lenovo-yoga-7-14ARH7 = import ./lenovo/yoga/7/14ARH7;
lenovo-yoga-7-slim-gen8 = import ./lenovo/yoga/7/slim/gen8;
@ -184,6 +190,7 @@
microsoft-surface-laptop-amd = import ./microsoft/surface/surface-laptop-amd;
microsoft-surface-common = import ./microsoft/surface/common;
microsoft-surface-pro-3 = import ./microsoft/surface-pro/3;
milkv-pioneer = import ./milkv/pioneer;
morefine-m600 = import ./morefine/m600;
msi-b350-tomahawk = import ./msi/b350-tomahawk;
msi-b550-a-pro = import ./msi/b550-a-pro;
@ -204,6 +211,7 @@
pine64-pinebook-pro = import ./pine64/pinebook-pro;
pine64-rockpro64 = import ./pine64/rockpro64;
pine64-star64 = import ./pine64/star64;
protectli-vp4670 = import ./protectli/vp4670;
purism-librem-13v3 = import ./purism/librem/13v3;
purism-librem-15v3 = import ./purism/librem/15v3;
purism-librem-5r4 = import ./purism/librem/5r4;
@ -223,12 +231,14 @@
toshiba-swanky = import ./toshiba/swanky;
tuxedo-infinitybook-v4 = import ./tuxedo/infinitybook/v4;
tuxedo-infinitybook-pro14-gen7 = import ./tuxedo/infinitybook/pro14/gen7;
tuxedo-pulse-14-gen3 = import ./tuxedo/pulse/14/gen3;
tuxedo-pulse-15-gen2 = import ./tuxedo/pulse/15/gen2;
common-cpu-amd = import ./common/cpu/amd;
common-cpu-amd-pstate = import ./common/cpu/amd/pstate.nix;
common-cpu-amd-raphael-igpu = import ./common/cpu/amd/raphael/igpu.nix;
common-cpu-intel = import ./common/cpu/intel;
common-cpu-intel-comet-lake = import ./common/cpu/intel/comet-lake;
common-cpu-intel-cpu-only = import ./common/cpu/intel/cpu-only.nix;
common-cpu-intel-kaby-lake = import ./common/cpu/intel/kaby-lake;
common-cpu-intel-sandy-bridge = import ./common/cpu/intel/sandy-bridge;

View File

@ -0,0 +1,4 @@
# [Framework Laptop 16](https://frame.work/)
## Updating Firmware
The Framework Laptop 16 uses LVFS, so it can be updated via fwupd; see https://wiki.nixos.org/wiki/Fwupd for details

View File

@ -0,0 +1,10 @@
{ config, lib, pkgs, ... }:
{
imports = [
../common
../common/amd.nix
../../../../common/cpu/amd/raphael/igpu.nix
];
}

View File

@ -0,0 +1,14 @@
{ lib, config, ... }: {
imports = [
../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix
../../../../common/gpu/amd
];
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/
boot.kernelParams = lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") ["rtc_cmos.use_acpi_alarm=1"] ;
# AMD has better battery life with PPD over TLP:
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
services.power-profiles-daemon.enable = lib.mkDefault true;
}

View File

@ -0,0 +1,27 @@
{ lib, pkgs, ... }: {
imports = [
../../../../common/pc/laptop
../../../../common/pc/laptop/ssd
];
# Fix TRRS headphones missing a mic
# https://community.frame.work/t/headset-microphone-on-linux/12387/3
boot.extraModprobeConfig = lib.mkIf (lib.versionOlder pkgs.linux.version "6.6.8") ''
options snd-hda-intel model=dell-headset-multi
'';
# For fingerprint support
services.fprintd.enable = lib.mkDefault true;
# Custom udev rules
services.udev.extraRules = ''
# Ethernet expansion card support
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20"
'';
# Needed for desktop environments to detect/manage display brightness
hardware.sensor.iio.enable = lib.mkDefault true;
# Enable keyboard customization
hardware.keyboard.qmk.enable = lib.mkDefault true;
}

View File

@ -4,7 +4,7 @@ This document on how I configure [NixOS](https://nixos.org/) on [NanoPC-T4](http
# Installation
To install NixOS on you can follow the [official instructions](https://nixos.wiki/wiki/NixOS_on_ARM/NanoPC-T4) and use the [pre-built images](https://github.com/tmountain/arch-nanopct4/tree/main/images/) from @tmountain. You can also build the U-Boot image yourself from `nixpkgs` based on changes added in [#111034](https://github.com/NixOS/nixpkgs/pull/111034).
To install NixOS on you can follow the [official instructions](https://wiki.nixos.org/wiki/NixOS_on_ARM/NanoPC-T4) and use the [pre-built images](https://github.com/tmountain/arch-nanopct4/tree/main/images/) from @tmountain. You can also build the U-Boot image yourself from `nixpkgs` based on changes added in [#111034](https://github.com/NixOS/nixpkgs/pull/111034).
## NixOS on NVMe with ZFS
@ -62,7 +62,7 @@ A reader using `CP2102` chip did not work but `FT232RL` works fine:
You can use `minicom` or `picocom` to connect:
```
sudo minicom -b 1500000 -D /dev/ttyUSB0
sudo minicom -b 1500000 -D /dev/ttyUSB0
sudo picocom -b 1500000 /dev/ttyUSB0
```
But you'll need to disable flow control with `Ctrl-A x`.

47
gigabyte/b550/README.md Normal file
View File

@ -0,0 +1,47 @@
# B550 suspend bug
Gigabyte B550-family motherboards have a hard to diagnose (At least, from the system log events) suspend bug.
As of the F18 bios for the b550m-d3sh (My machine), released in 2024-02-27, this is still unfixed by the manufacurer and has been for over 4 years.
Symptoms:
- Suspend PC
- It goes into suspend, then seems to boot and hang. Sometimes it suspends successfully, but waking it from suspend puts it in the "zombie" state.
- By playing chicken with volatile storage and flicking the power switch on the back of power supply, you can sometimes get it to wake from suspend as the card un-powers before volatile storage does.
Fix: disable GPP0 and GPP8 (And, for some cards, potentially PTXH, I can't test) in /proc/acpi/wakeup
- To do this permanently, a systemd service is provided
## This affects at least:
- Gigabyte b550m-d3sh (my machine)
- Gigabyte B550i AORUS Pro Ax https://www.reddit.com/r/gigabyte/comments/p5ewjn/b550i_pro_ax_f13_bios_sleep_issue_on_linux/
- Gigabyte B550 Vision D https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hb32elw/
- Gigabyte B550 Aorus Pro https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ijsx8ia/
- Gigabyte B550 Aorus Pro AC https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/j6cbnwq/
- Gigabyte B550 Aorus Pro v2 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/imx7sz0/
- B550 Aorus Pro may need GPP0 and PTXH instead of GPP8, I don't have hardware to test
- Gigabyte B550 Aurus Elite v2 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/k2psbgu/
- Gigabyte B550m pro https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/huocd81/
- Gigabyte B550m Aorus Elite https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hzngaa7/
- Gigabyte B550 Gaming X v2 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hvojl44/
- Gigabyte B550 Aorus Master v1.0 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/j1alpxk/
### Anecdotes of other boards:
- Gigabyte A520M https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/i57jpjw/
## Shoutouts:
- thanks to [/u/dustythermals's reddit comment](https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hb32elw/) for the systemd service blueprint
- thanks to help from [@ToxicFrog](https://github.com/ToxicFrog) for advice on making it not toggle when `nixos-rebuild switch` is ran
- thanks to [/u/Demotay's reddit comment](https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/) for how to make it check and only fire if these are enabled
- Huge thanks to /u/theHugePotato who found the [root cause](https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/h9plj88/) and put it where everyone could find
## Breadcrumbs:
https://www.reddit.com/r/gigabyte/comments/p5ewjn/b550i_pro_ax_f13_bios_sleep_issue_on_linux/
https://www.reddit.com/r/archlinux/comments/11urtla/systemctl_suspend_hibernate_and_hybridsleep_all/
https://forum.manjaro.org/t/system-do-not-wake-up-after-suspend/76681/2

View File

@ -0,0 +1,35 @@
{ pkgs, lib, ... } :
{
systemd.services.bugfixSuspend-GPP0 = {
enable = lib.mkDefault true;
description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)";
unitConfig = {
Type = "oneshot";
};
serviceConfig = {
User = "root"; # root may not be necessary
# check for gppN, disable if enabled
# lifted from https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/ /u/Demotay
ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP0' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP0' > /proc/acpi/wakeup; fi'";
RemainAfterExit = "yes"; # required to not toggle when `nixos-rebuild switch` is ran
};
wantedBy = ["multi-user.target"];
};
systemd.services.bugfixSuspend-GPP8 = {
enable = lib.mkDefault true;
description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)";
unitConfig = {
Type = "oneshot";
};
serviceConfig = {
User = "root";
ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP8' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP8' > /proc/acpi/wakeup; fi''";
RemainAfterExit = "yes";
};
wantedBy = ["multi-user.target"];
};
}

View File

@ -0,0 +1,5 @@
{
imports = [
./b550-fix-suspend.nix
];
}

View File

@ -0,0 +1,30 @@
## Introduction
Due to the introduction of DDG feature, you may toggle DDG frequently, so for the default settings of this laptop, we use "specialization" feature of Nix so that you can easily select the required graphics card driver in the startup menu.
**But It will slow down NixOS evaluation by factor 2 and increase memory usage.**
So if you don't need specialization feature, you can just use hybrid only configuration or nvidia only (DDG only) configuration
## Using multiple drives with this configuration
When using more than one drive, the value of `hardware.nvidia.prime.amdgpuBusId` will change from the default of `PCI:5:0:0`.
Make sure you override this default in your personal configuration. For two drives, it should be `PCI:6:0:0`.
## Setup at the time of testing
```
$ nix-info -m
- system: `"x86_64-linux"`
- host os: `Linux 6.0.9, NixOS, 22.11 (Raccoon), 22.11beta19.c9538a9b707`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.11.0`
- channels(root): `"nixos-22.11"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
```
```
$ lspci
...
01:00.0 VGA compatible controller: NVIDIA Corporation GA104M [GeForce RTX 3070 Mobile / Max-Q] (rev a1)
...
06:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne (rev c5)
...
```

View File

@ -0,0 +1,11 @@
{ ... }:
{
imports = [ ./hybrid ];
specialisation.ddg.configuration = {
# This specialisation is for the case where "DDG" (Dual-Direct GFX, A hardware feature that can enable in bios) is enabled, since the amd igpu is blocked at hardware level and the built-in display is directly connected to the dgpu, we no longer need the amdgpu and prime configuration.
system.nixos.tags = [ "Dual-Direct-GFX-Mode" ];
imports = [ ./nvidia ];
};
}

View File

@ -0,0 +1,35 @@
{ lib, ... }:
{
imports = [
../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix
../../../../common/gpu/amd
../../../../common/gpu/nvidia/prime.nix
../../../../common/pc/laptop
../../../../common/pc/laptop/ssd
];
# Still needs to load at some point if we want X11 to work
boot.kernelModules = [ "amdgpu" ];
# modesetting just doesn't work (on X11?), so get rid of it by only explicitly declaring nvidia
# Needed due to https://github.com/NixOS/nixos-hardware/commit/630a8e3e4eea61d35524699f2f59dbc64886357d
# See also https://github.com/NixOS/nixos-hardware/issues/628
# options.services.xserver.drivers will have a amdgpu entry from using the prime stuff in nixpkgs
services.xserver.videoDrivers = [ "nvidia" ];
hardware = {
amdgpu.loadInInitrd = lib.mkDefault false;
nvidia = {
modesetting.enable = lib.mkDefault true;
powerManagement.enable = lib.mkDefault true;
prime = {
amdgpuBusId = lib.mkDefault "PCI:6:0:0";
nvidiaBusId = "PCI:1:0:0";
};
};
};
}

View File

@ -0,0 +1,26 @@
{ ... }:
{
imports = [ ../hybrid ];
services.xserver.videoDrivers = [ "nvidia" ]; # This will override services.xserver.videoDrivers = lib.mkDefault [ "amdgpu" "nvidia" ];
# When I play the game through proton, I found that in the case of Dual-Direct GFX
# enabled (dGPU disabled), proton will crash directly. But in the case of hybrid,
# the game runs fine with or without nvidia-offload After investigation, this is
# because when writing the specialization of Dual-Direct GFX, I did not completely
# remove all packages for amd igpu. I only removed amdgpu from
# services.xserver.videoDrivers by overriding. This is because the specialization
# of nix cannot implement such an operation as canceling an import. In the end, if
# it is enabled in Dual-Direct GFX In the absence of amd igpu, the amdvlk package
# caused the proton to crash. In order to solve this problem, I add the option of
# whether to enable amdvlk to the configuration file of amd gpu, and open it by
# default, and turn it off in specialization, so as to delete amdvlk package and
# other packages for amd igpu in specialization. At the same time, I also added an
# option to amdgpu's opencl runtime.
hardware = {
nvidia.prime.offload.enable = false;
amdgpu = {
amdvlk = false;
opencl = false;
};
};
}

View File

@ -10,7 +10,9 @@ in
{
hardware.firmware = [ chip_edid ];
boot.kernelParams = [ "drm.edid_firmware=edid/16ach6h.bin" ];
# For some reason, the internal display is sometimes eDP-1, and sometimes it's eDP-2
boot.kernelParams = [ "drm.edid_firmware=eDP-1:edid/16ach6h.bin,eDP-2:edid/16ach6h.bin" ];
# This fails at the moment, https://github.com/NixOS/nixos-hardware/issues/795
# Extra refresh rates seem to work regardless
# boot.initrd.extraFiles."lib/firmware/edid/16ach6h.bin".source = pkgs.runCommandLocal "chip_edid" { } "cp ${./16ach6h.bin} $out";

View File

@ -8,8 +8,7 @@
../../../../common/gpu/nvidia/prime.nix
../../../../common/pc/laptop
../../../../common/pc/laptop/ssd
# This seems to break extra monitor modes
# ../edid
../edid
];
# Still needs to load at some point if we want X11 to work

View File

@ -0,0 +1,15 @@
## Introduction
This configuration includes a fix to get audio playing over the speakers, however, the volume is low. If you know of a workaround or fix, please contribute it to the repo!!
## Setup at the time of testing
```
$ nix-info -m
- system: `"x86_64-linux"`
- host os: `Linux 6.8.2-zen2, NixOS, 24.05 (Uakari), 24.05.20240403.fd281bd`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.18.2`
- channels(root): `""`
- nixpkgs: `/home/aires/.nix-defexpr/channels/nixpkgs`
```

View File

@ -0,0 +1,38 @@
# Patch sourced from https://github.com/christian-bendiksen/kernel-6.8.0-63.16ARHA7.fc40
{ pkgs, lib, kernel ? pkgs.linuxPackages_latest.kernel }:
pkgs.stdenv.mkDerivation {
pname = "lenovo-16ARHA7-speaker-fix-module";
inherit (kernel) src version postPatch nativeBuildInputs;
kernel_dev = kernel.dev;
kernelVersion = kernel.modDirVersion;
modulePath = "sound/pci/hda/";
buildPhase = ''
BUILT_KERNEL=$kernel_dev/lib/modules/$kernelVersion/build
cp $BUILT_KERNEL/Module.symvers .
cp $BUILT_KERNEL/.config .
cp $kernel_dev/vmlinux .
make "-j$NIX_BUILD_CORES" modules_prepare
make "-j$NIX_BUILD_CORES" M=$modulePath modules
'';
installPhase = ''
make \
INSTALL_MOD_PATH="$out" \
XZ="xz -T$NIX_BUILD_CORES" \
M="$modulePath" \
modules_install
'';
patches = [ ./lenovo_16ARHA7_sound_fix.patch ];
meta = {
description = "Patch to get the speakers working for Lenovo Legion Slim 7 Gen 7 AMD (16ARHA7)";
license = lib.licenses.gpl3;
};
}

View File

@ -0,0 +1,33 @@
diff -rupN linux-6.8-9791-ge5eb28f6d1af/sound/pci/hda/cs35l41_hda_property.c linux-6.8-9791-ge5eb28f6d1af-patched/sound/pci/hda/cs35l41_hda_property.c
--- linux-6.8-9791-ge5eb28f6d1af/sound/pci/hda/cs35l41_hda_property.c 2024-03-15 02:03:09.000000000 +0100
+++ linux-6.8-9791-ge5eb28f6d1af-patched/sound/pci/hda/cs35l41_hda_property.c 2024-03-17 12:23:48.183404375 +0100
@@ -115,6 +115,8 @@ static const struct cs35l41_config cs35l
{ "17AA38B5", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
{ "17AA38B6", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
{ "17AA38B7", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
+ { "17AA3877", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
+ { "17AA3878", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
{}
};
@@ -503,6 +505,8 @@ static const struct cs35l41_prop_model c
{ "CSC3551", "17AA38B5", generic_dsd_config },
{ "CSC3551", "17AA38B6", generic_dsd_config },
{ "CSC3551", "17AA38B7", generic_dsd_config },
+ { "CSC3551", "17AA3877", generic_dsd_config },
+ { "CSC3551", "17AA3878", generic_dsd_config },
{}
};
diff -rupN linux-6.8-9791-ge5eb28f6d1af/sound/pci/hda/patch_realtek.c linux-6.8-9791-ge5eb28f6d1af-patched/sound/pci/hda/patch_realtek.c
--- linux-6.8-9791-ge5eb28f6d1af/sound/pci/hda/patch_realtek.c 2024-03-15 02:03:09.000000000 +0100
+++ linux-6.8-9791-ge5eb28f6d1af-patched/sound/pci/hda/patch_realtek.c 2024-03-17 12:18:22.241570472 +0100
@@ -10263,6 +10263,8 @@ static const struct snd_pci_quirk alc269
SND_PCI_QUIRK(0x17aa, 0x38b5, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x17aa, 0x38b6, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x17aa, 0x38b7, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
+ SND_PCI_QUIRK(0x17aa, 0x3877, "Legion S7 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
+ SND_PCI_QUIRK(0x17aa, 0x3878, "Legion S7 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),

View File

@ -0,0 +1,21 @@
{ config, pkgs, ... }:
let
lenovo-speaker-fix = pkgs.callPackage ./audio/lenovo-16ARHA7_speaker-fix.nix {
# Make sure the module targets the same kernel as your system is using.
inherit (config.boot.kernelPackages) kernel;
};
in
{
imports = [
../../../common/cpu/amd/pstate.nix
../../../common/gpu/amd
../../../common/pc/laptop
../../../common/pc/laptop/ssd
];
boot.extraModulePackages = [ lenovo-speaker-fix ];
# √(2560² + 1600²) px / 16 in ≃ 189 dpi
services.xserver.dpi = 189;
}

View File

@ -0,0 +1,12 @@
# Thinkpad X13 Deprecations
## Overview
The X13 has multiple variants. Originally, the configs only supported Intel
hardware.
## How to update
If you previously imported the module under `lenovo/thinkpad/x13`, you can now
import `lenovo/thinkpad/x13/intel` instead. Users with the AMD variant should
import `lenovo/thinkpad/x13/amd`.

View File

@ -0,0 +1,6 @@
{ ... }: {
imports = [
../common.nix
../../../../common/cpu/amd
];
}

View File

@ -0,0 +1,10 @@
{ ... }: {
imports = [
../.
../../../common/pc/laptop/acpi_call.nix
../../../common/pc/laptop/ssd
];
# Somehow psmouse does not load automatically on boot for me
boot.initrd.kernelModules = [ "psmouse" ];
}

View File

@ -1,12 +1,8 @@
{ ... }: {
# Reference to hardware: https://certification.ubuntu.com/hardware/202004-27844
imports = [
../.
../../../common/cpu/intel
../../../common/pc/laptop/acpi_call.nix
../../../common/pc/laptop/ssd
{
assertions = [
{
assertion = false;
message = "Importing the x13/ (default.nix) directly is deprecated! See https://github.com/NixOS/nixos-hardware/blob/master/lenovo/thinkpad/x13/OLD-BEHAVIOUR-DEPRECATED.md for more details.";
}
];
# Somehow psmouse does not load automatically on boot for me
boot.initrd.kernelModules = [ "psmouse" ];
}

View File

@ -0,0 +1,7 @@
{ ... }: {
# Reference to hardware: https://certification.ubuntu.com/hardware/202004-27844
imports = [
../common.nix
../../../../common/cpu/intel
];
}

View File

@ -1,6 +1,6 @@
{ config, lib, ... }: {
imports = [
../.
../intel
../../yoga.nix
];

View File

@ -7,17 +7,14 @@
../../../common/pc/laptop
../../../common/pc/laptop/acpi_call.nix
../../../common/pc/laptop/ssd
../../../common/hidpi.nix # can be dropped after nixos 23.05
];
# kernel versions prior to 5.18 won't boot
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") (lib.mkDefault pkgs.linuxPackages_latest);
hardware.enableRedistributableFirmware = lib.mkDefault true;
hardware.trackpoint.device = lib.mkDefault "TPPS/2 Elan TrackPoint";
services.fprintd.enable = lib.mkDefault true;
# kernel versions below 6.0 don't contain ACPI suspend2idle drivers for the Z13s AMD hardware
# kernel versions below 6.0 dont contain ACPI suspend2idle drivers for the Z-series AMD hardware
# my Z13 froze after waking up from suspend/ hibernate
services.logind.lidSwitch = lib.mkIf (lib.versionOlder pkgs.linux.version "6.00") (lib.mkDefault "lock");
}

View File

@ -0,0 +1,8 @@
{ lib, pkgs, ... }: {
imports = [
../../../../lenovo/thinkpad/z
];
# Kernel 5.18 is required for the Ryzen 6000 series
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") (lib.mkDefault pkgs.linuxPackages_latest);
}

View File

@ -0,0 +1,5 @@
{
imports = [
../../../../../lenovo/thinkpad/z/gen1
];
}

View File

@ -0,0 +1,44 @@
{ lib, pkgs, ... }:
{
imports = [
../../../../lenovo/thinkpad/z
];
# Kernel 6.4 is required for the Ryzen 7040 series
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.4") (lib.mkDefault pkgs.linuxPackages_latest);
systemd.services = {
# Modified from Arch Wiki
"touchpad-fix" = {
enable = lib.mkDefault true;
description = "I2C HID devices can fail to initialize so try to reload";
unitConfig = {
Type = "oneshot";
};
serviceConfig = {
User = "root";
};
wantedBy = [ "multi-user.target" ];
after = [ "multi-user.target" ];
script = ''
count=0
while true; do
${lib.getExe pkgs.libinput} list-devices | ${lib.getExe pkgs.gnugrep} --quiet SNSL && break
count=$((count + 1))
if test $count -ge 5; then
echo "Touchpad not read after $count attempts"
break
fi
echo "Touchpad not ready; attempt $count to reload"
${pkgs.kmod}/bin/rmmod i2c_hid_acpi
${pkgs.kmod}/bin/modprobe i2c_hid_acpi
sleep $((2 + (count * 3)))
done
'';
};
};
}

View File

@ -0,0 +1,19 @@
{ pkgs, lib, ...}:
{
imports = [
../../../../../lenovo/thinkpad/z/gen2
];
sound.extraConfig = ''
pcm.!default {
type plug
slave.pcm "hw:1,0"
}
ctl.!default {
type hw
card 1
}
'';
}

View File

@ -1,5 +0,0 @@
{
imports = [
../../../../lenovo/thinkpad/z
];
}

View File

@ -0,0 +1,10 @@
{
assertions = [
{
assertion = true;
message = ''
Lenovo Z-series received a second generation so the hardware configuration has been split by generation. For the Z13 Gen 1 config, change from `lenovo-thinkpad-z13` to `lenovo-thinkpad-z13-gen1`.
'';
}
];
}

View File

@ -5,7 +5,7 @@ let
in {
imports = [
./linux-6.6.x
./linux-6.8.x
];
options.microsoft-surface.kernelVersion = mkOption {

View File

@ -7,14 +7,14 @@ let
cfg = config.microsoft-surface;
version = "6.6.13";
version = "6.8.6";
kernelPatches = surfacePatches {
inherit version;
patchFn = ./patches.nix;
};
kernelPackages = linuxPackage {
inherit version kernelPatches;
sha256 = "sha256-iLiefdQerU46seQRyLuNWSV1rPgVzx3zwNxX4uiCwLw=";
sha256 = "sha256-nnIyMtYDq0Xr8EPDRxTEjyd6sZXCmry4Ry8qTDpaGZU=";
ignoreConfigErrors=true;
};

View File

@ -4,8 +4,8 @@
linux-surface = fetchFromGitHub {
owner = "linux-surface";
repo = "linux-surface";
rev = "arch-6.6.6-1";
hash = "sha256-0pP/A0XllR/iheIBEBwEApaXpyFYzsnGZ+wdm4w5Jjg=";
rev = "arch-6.8.6-1";
hash = "sha256-kLnHcYFeQ7/8lbSL4p9D2aC4V/Ib1tU225UOkRcNnH4=";
};
# This is the owner and repo for the pre-patched kernel from the "linux-surface" project:

50
milkv/pioneer/README.md Normal file
View File

@ -0,0 +1,50 @@
# Creating an installation SD card image
Create and customize a `flake.nix` file:
```nix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:nixos/nixos-hardware";
};
outputs = { nixpkgs, nixos-hardware, ... }:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"riscv64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSupportedSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
packages = forAllSupportedSystems (system: rec {
default = sd-image;
sd-image = (import "${nixpkgs}/nixos" {
configuration = {
imports = [
"${nixos-hardware}/milkv/pioneer/sd-image-installer.nix"
];
nixpkgs.buildPlatform.system = system;
nixpkgs.hostPlatform.system = "riscv64-linux";
system.stateVersion = "24.05";
};
inherit system;
}).config.system.build.sdImage;
});
};
}
```
Then build the image by running `nix build .#` in the same folder.
# Known issues
LinuxBoot will not output the boot menu on the serial console, only on the graphical console.
Unfortuately, it might also pick up boot options from other devices, e.g. an nvme or sata drive.
It might end up booting by default from those instead of booting from the SD card.

28
milkv/pioneer/default.nix Normal file
View File

@ -0,0 +1,28 @@
{ config, lib, pkgs, ... }:
{
boot = {
consoleLogLevel = lib.mkDefault 7;
initrd = {
availableKernelModules = [
"amdgpu"
"radeon"
"mmc_block"
"sdhci_sophgo"
];
};
kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./linux.nix {
inherit (config.boot) kernelPatches;
});
kernelParams = lib.mkDefault [
"earlycon"
"console=ttyS0,115200"
"console=tty1"
];
};
hardware.deviceTree = {
enable = true;
name = lib.mkDefault "sophgo/mango-milkv-pioneer.dtb";
};
}

7
milkv/pioneer/fip.nix Normal file
View File

@ -0,0 +1,7 @@
{ fetchurl, ... }:
# Download the vendor's Firmware Image Package
fetchurl {
url = "https://github.com/sophgo/bootloader-riscv/raw/3f750677e0249ff549ad3fe20bbc800998503539/firmware/fip.bin";
hash = "sha256-rav00Ok6+FU77lI0piQPHCaz7Tw1RSbyUal4PyeSccg=";
}

View File

@ -0,0 +1,46 @@
{ stdenv
, writeText
, opensbi
, fip
, zsbl
, linuxboot-kernel
, linuxboot-initrd
, dtbs ? "${linuxboot-kernel}/dtbs"
, ...
}:
let
# Configure a conf.init for linuxboot. If this is not found on the sdcard,
# zsbl will load it from spi flash even when booting from sd. That conf.ini
# might be configured differently and thus not properly boot from sd.
conf-ini = writeText "conf.ini" ''
[sophgo-config]
[devicetree]
name = mango-milkv-pioneer.dtb
[kernel]
name = riscv64_Image
[firmware]
name = fw_dynamic.bin
[ramfs]
name = initrd.img
[eof]
'';
in
stdenv.mkDerivation {
name = "milkv-pioneer-firmware";
buildCommand = ''
install -D ${conf-ini} $out/riscv64/conf.ini
install -D ${fip} $out/fip.bin
install -D ${zsbl} $out/zsbl.bin
install -D ${opensbi}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin $out/riscv64/
install -D ${linuxboot-initrd}/initrd.img $out/riscv64/
install -D ${dtbs}/sophgo/mango-milkv-pioneer.dtb $out/riscv64/
install -D ${linuxboot-kernel}/Image $out/riscv64/riscv64_Image
'';
}

44
milkv/pioneer/linux.nix Normal file
View File

@ -0,0 +1,44 @@
{ buildLinux, fetchFromGitHub, kernelPatches, lib, ... } @ args:
let
modDirVersion = "6.6.20";
in
buildLinux (args // {
inherit kernelPatches modDirVersion;
version = "${modDirVersion}-milkv-pioneer";
src = fetchFromGitHub {
owner = "sophgo";
repo = "linux-riscv";
rev = "caa949e3690fe8a4656313b2b56f52666fa880db";
hash = "sha256-qJpR3KMgvP4tfPfBfQ/MiEWg/uuuxHYuACK8taKKK3E=";
};
defconfig = "sophgo_mango_normal_defconfig";
structuredExtraConfig = let inherit (lib.kernel) freeform module yes; in {
# LinuxBoot will override the console bootparams which will result
# in the distro kernel to be booted with e.g. console=tty1 only.
# https://github.com/sophgo/bootloader-riscv/issues/71
# Force output on serial console through the config. This is also
# needed to get the forced serial-getty to be started.
# We also list tty1 again because according to
# https://docs.kernel.org/admin-guide/serial-console.html and
# https://0pointer.de/blog/projects/serial-console.html
# this will be the main console.
CMDLINE = freeform "console=ttyS0,115200 console=tty1";
CMDLINE_EXTEND = yes;
# Enable these explicitly because they are not enabled by the defconfig.
# The all-hardware profile expects these to be built.
VIRTIO_MENU = yes;
VIRTIO_PCI = module;
# There is an i2c mcu driver (drivers/soc/sophgo/umcu) which is always
# compiled into the kernel. Hence some of the i2c support also needs to
# be compiled in instead of being compiled as a module.
I2C = yes;
I2C_CHARDEV = yes;
I2C_DESIGNWARE_PLATFORM = yes;
};
extraMeta.branch = "sg2042-dev-6.6";
} // (args.argsOverride or { }))

View File

@ -0,0 +1,73 @@
{ buildPackages
, fetchFromGitHub
, fetchpatch
, linux-firmware
, buildGoModule
, ...
}:
# Based on
# https://github.com/sophgo/bootloader-riscv/blob/e0839852d571df106db622611f4786ae17e8df0f/scripts/envsetup.sh#L809-L819
let
u-root = buildPackages.buildGoModule rec {
pname = "u-root";
version = "0.14.0";
src = fetchFromGitHub {
owner = "u-root";
repo = "u-root";
rev = "v${version}";
hash = "sha256-8zA3pHf45MdUcq/MA/mf0KCTxB1viHieU/oigYwIPgo=";
};
vendorHash = null;
patches = [
(fetchpatch {
url = "https://github.com/sophgo/bootloader-riscv/commit/322c3305763872a9b88a1c85d79bca63b8fbe7a6.patch";
hash = "sha256-l5r3DbcMqRYD5FhRBqtEIEscZAdDvjmQJE4BIAtWYWE=";
stripLen = 1;
})
];
postInstall = ''
cp -r . $out/src
'';
# We only build the u-root binary in the build phase and the initrd in the
# postBuild hook.
subPackages = [ "." ];
# Tests time out after 10min for native riscv64 builds on the pioneer.
doCheck = false;
};
in
buildGoModule {
name = "linuxboot-initrd";
src = null;
vendorHash = null;
dontUnpack = true;
nativeBuildInputs = [ u-root ];
buildPhase = ''
runHook preBuild
pushd ${u-root}/src
mkdir -p $out
GOROOT="$(go env GOROOT)" u-root \
-build bb \
-uinitcmd=boot \
-files "${linux-firmware}/lib/firmware/amdgpu/:lib/firmware/amdgpu/" \
-files "${linux-firmware}/lib/firmware/radeon/:lib/firmware/radeon/" \
-o $out/initramfs.cpio \
core boot
popd
# The vendor does not compress the initrd. We do since we include more
# firmware files. CRC32 is required by the kernel's decompressor.
xz --check=crc32 $out/initramfs.cpio
runHook postBuild
'';
installPhase = ''
runHook preInstall
mv $out/initramfs.cpio.xz $out/initrd.img
runHook postInstall
'';
}

View File

@ -0,0 +1,15 @@
{ fetchFromGitHub, lib, linuxManualConfig, stdenv, ... }:
linuxManualConfig rec {
inherit lib stdenv;
modDirVersion = "6.6.20";
version = "${modDirVersion}-milkv-pioneer";
src = fetchFromGitHub {
owner = "sophgo";
repo = "linux-riscv";
rev = "caa949e3690fe8a4656313b2b56f52666fa880db";
hash = "sha256-qJpR3KMgvP4tfPfBfQ/MiEWg/uuuxHYuACK8taKKK3E=";
};
configfile = "${src}/arch/riscv/configs/sophgo_mango_normal_defconfig";
extraMeta.branch = "sg2042-dev-6.6";
}

22
milkv/pioneer/opensbi.nix Normal file
View File

@ -0,0 +1,22 @@
{ fetchFromGitHub, opensbi, ... }:
opensbi.overrideAttrs (attrs: {
# Based on the vendor's sg2042-master branch.
version = "1.4-git-a6e158f7";
src = fetchFromGitHub {
owner = "sophgo";
repo = "opensbi";
rev = "a6e158f71aab17155e2bf25a325ce4f0be51d9dd";
hash = "sha256-5ggrEx1e53pB2+m0TBjDzDJXf2wjsQ2edu01FqqGt/Y=";
};
makeFlags =
# Based on the vendor options
# https://github.com/sophgo/bootloader-riscv/blob/01dc52ce10e7cf489c93e4f24b6bfe1bf6e55919/scripts/envsetup.sh#L299
attrs.makeFlags ++ [
"PLATFORM=generic"
"FW_PIC=y"
"BUILD_INFO=y"
"DEBUG=1"
];
})

View File

@ -0,0 +1,12 @@
{ modulesPath, ... }:
{
imports = [
"${modulesPath}/profiles/installation-device.nix"
./sd-image.nix
];
# the installation media is also the installation target,
# so we don't want to provide the installation configuration.nix.
installer.cloneConfig = false;
}

View File

@ -0,0 +1,57 @@
{ config, lib, modulesPath, pkgs, ... }:
let
inherit (pkgs) callPackage;
fip = callPackage ./fip.nix { };
zsbl = callPackage ./zsbl.nix { };
opensbi = callPackage ./opensbi.nix { };
linuxboot-kernel = callPackage ./linuxboot-kernel.nix { };
linuxboot-initrd = callPackage ./linuxboot-initrd.nix { };
dtbs = config.hardware.deviceTree.package;
firmware = callPackage ./firmware.nix {
inherit fip zsbl opensbi linuxboot-kernel linuxboot-initrd dtbs;
};
in
{
imports = [
"${modulesPath}/profiles/base.nix"
"${modulesPath}/installer/sd-card/sd-image.nix"
./default.nix
];
boot.loader = {
grub.enable = lib.mkDefault false;
generic-extlinux-compatible.enable = lib.mkDefault true;
};
hardware.enableRedistributableFirmware = true;
# For some reason the serial getty is not started automatically
# even though console=ttyS0,115200 is passed to the kernel.
# https://docs.kernel.org/admin-guide/serial-console.html
# https://github.com/NixOS/nixpkgs/issues/84105
systemd.services."serial-getty@ttyS0" = {
enable = true;
wantedBy = [ "getty.target" ];
serviceConfig.Restart = "always";
};
sdImage = {
imageName = "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-milkv-pioneer.img";
populateFirmwareCommands = ''
mkdir -p firmware/
cp -a ${firmware}/* firmware/
touch firmware/BOOT
'';
firmwarePartitionOffset = 1;
firmwareSize = 128;
populateRootCommands = ''
mkdir -p ./files/boot
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
'';
};
}

View File

@ -0,0 +1,15 @@
--- a/drivers/sd/sd.c
+++ b/drivers/sd/sd.c
@@ -560,11 +560,11 @@ static int bm_sd_read(int lba, uintptr_t buf, size_t size)
} else {
udelay(1);
timeout++;
}
- if (timeout >= 10000) {
+ if (timeout >= 100000) {
printf("sdhci read data timeout\n");
goto timeout;
}
}

51
milkv/pioneer/zsbl.nix Normal file
View File

@ -0,0 +1,51 @@
{ buildPackages
, bison
, fetchFromGitHub
, flex
, lib
, stdenv
, ...
}:
stdenv.mkDerivation rec {
pname = "zsbl-sg2042";
version = "git-cc806273";
src = fetchFromGitHub {
owner = "sophgo";
repo = "zsbl";
rev = "cc806273e0f679bef2f6b017c68adede1594ad31";
hash = "sha256-zOlBM7mwz8FUM/BlzOxJmpI8LI/KcFOGXegvgiilbaM=";
};
patches = [
# Depending on the sdcard, reading larger initrds (say >= 25MB)
# can hit the timeout.
./zsbl-increase-timeout.patch
];
nativeBuildInputs = [
bison
flex
];
depsBuildBuild = [
buildPackages.stdenv.cc
];
hardeningDisable = [
"fortify"
"stackprotector"
];
makeFlags = [
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
];
configurePhase = "make sg2042_defconfig";
installPhase = "install -D zsbl.bin $out";
enableParallelBuilding = true;
dontStrip = true;
meta = {
homepage = "https://github.com/sophgo/zsbl";
description = "Sophgo RISC-V Zero Stage Boot Loader";
license = lib.licenses.gpl2;
};
}

View File

@ -55,7 +55,7 @@ let
# brute force disable drm
CEC_CORE = no;
CEC_NOTIFIER = no;
DRM = no;
DRM = lib.mkForce no;
DRM_MIPI_DBI = no;
DRM_MIPI_DSI = no;
DRM_DP_AUX_BUS = no;

View File

@ -0,0 +1,9 @@
{
imports = [
../../common/cpu/intel/comet-lake
];
boot.initrd.kernelModules = [
"sdhci_pci" # 16G eMMC on board
];
}

View File

@ -0,0 +1,7 @@
# TUXEDO Pulse 14 - Gen3
## About
[NixOS hardware configuration](https://github.com/NixOS/nixos-hardware) for
[TUXEDO Pulse 14 -
Gen3](https://www.tuxedocomputers.com/en/TUXEDO-Pulse-14-Gen3).

View File

@ -0,0 +1,9 @@
{pkgs, ...}: {
imports = [
../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix
../../../../common/cpu/amd/raphael/igpu.nix
../../../../common/pc/laptop
../../../../common/pc/laptop/ssd
];
}