mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-10 03:43:07 +08:00
Compare commits
7 Commits
not-a-rele
...
mnt-reform
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a7b43b595 | ||
|
|
ff1b798346 | ||
|
|
30f1a9952d | ||
|
|
e6c84e7eaf | ||
|
|
5a67562945 | ||
|
|
c4399b921f | ||
|
|
72d7bb9434 |
@@ -94,7 +94,9 @@ See code for all available configurations.
|
||||
| [Dell XPS 15 9560, nvidia only][] | `<nixos-hardware/dell/xps/15-9560/nvidia>` |
|
||||
| [Dell XPS 15 9500][] | `<nixos-hardware/dell/xps/15-9500>` |
|
||||
| [Dell XPS 15 9500, nvidia][] | `<nixos-hardware/dell/xps/15-9500/nvidia>` |
|
||||
| FriendlyARM NanoPC-T4 | `<nixos-hardware/friendlyarm/nanopc-t4>` |
|
||||
| [Google Pixelbook][] | `<nixos-hardware/google/pixelbook>` |
|
||||
| [GPD MicroPC][] | `<nixos-hardware/gpd/micropc>` |
|
||||
| [Inverse Path USB armory][] | `<nixos-hardware/inversepath/usbarmory>` |
|
||||
| Lenovo IdeaPad Z510 | `<nixos-hardware/lenovo/ideapad/z510>` |
|
||||
| Lenovo ThinkPad E470 | `<nixos-hardware/lenovo/thinkpad/e470>` |
|
||||
@@ -113,7 +115,7 @@ See code for all available configurations.
|
||||
| Lenovo ThinkPad T440s | `<nixos-hardware/lenovo/thinkpad/t440s>` |
|
||||
| Lenovo ThinkPad T440p | `<nixos-hardware/lenovo/thinkpad/t440p>` |
|
||||
| Lenovo ThinkPad T450s | `<nixos-hardware/lenovo/thinkpad/t450s>` |
|
||||
| Lenovo ThinkPad T460 | `<nixos-hardware/lenovo/thinkpad/t460>` |
|
||||
| Lenovo ThinkPad T460 | `<nixos-hardware/lenovo/thinkpad/t460>` |
|
||||
| Lenovo ThinkPad T460s | `<nixos-hardware/lenovo/thinkpad/t460s>` |
|
||||
| Lenovo ThinkPad T470s | `<nixos-hardware/lenovo/thinkpad/t470s>` |
|
||||
| Lenovo ThinkPad T480s | `<nixos-hardware/lenovo/thinkpad/t480s>` |
|
||||
@@ -165,6 +167,7 @@ See code for all available configurations.
|
||||
[Dell XPS 15 9560, intel only]: dell/xps/15-9560/intel
|
||||
[Dell XPS 15 9560, nvidia only]: dell/xps/15-9560/nvidia
|
||||
[Google Pixelbook]: google/pixelbook
|
||||
[GPD MicroPC]: gpd/micropc
|
||||
[Inverse Path USB armory]: inversepath/usbarmory
|
||||
[Lenovo ThinkPad X1 (6th Gen)]: lenovo/thinkpad/x1/6th-gen
|
||||
[Lenovo ThinkPad X1 (7th Gen)]: lenovo/thinkpad/x1/7th-gen
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
dell-xps-15-9560-nvidia = import ./dell/xps/15-9560/nvidia;
|
||||
dell-xps-15-9500 = import ./dell/xps/15-9500;
|
||||
dell-xps-15-9500-nvidia = import ./dell/xps/15-9500/nvidia;
|
||||
friendlyarm-nanopc-t4 = import ./friendlyarm/nanopc-t4;
|
||||
google-pixelbook = import ./google/pixelbook;
|
||||
gpd-micropc = import ./gpd/micropc;
|
||||
inversepath-usbarmory = import ./inversepath/usbarmory;
|
||||
lenovo-ideapad-z510 = import ./lenovo/ideapad/z510;
|
||||
lenovo-thinkpad-e470 = import ./lenovo/thinkpad/e470;
|
||||
|
||||
91
friendlyarm/nanopc-t4/README.md
Normal file
91
friendlyarm/nanopc-t4/README.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# Description
|
||||
|
||||
This document on how I configure [NixOS](https://nixos.org/) on [NanoPC-T4](https://wiki.friendlyarm.com/wiki/index.php/NanoPC-T4).
|
||||
|
||||
# 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).
|
||||
|
||||
## NixOS on NVMe with ZFS
|
||||
|
||||
It is possible to migrate the OS from the eMMC storage to the NVMe.
|
||||
|
||||
In my case I migrated `/`, `/nix`, and `/home`, leaving `/boot` on the eMMC.
|
||||
|
||||
Create the ZFS pool and three filesystems on the SSD:
|
||||
```sh
|
||||
zpool create -O xattr=sa -O acltype=posixacl -O mountpoint=none rpool /dev/nvme0n1
|
||||
for VOL in nix root home; do
|
||||
zfs create -o mountpoint=legacy rpool/$VOL
|
||||
mkdir /mnt/$VOL
|
||||
mount.zfs rpool/$VOL /mnt/$VOL
|
||||
done
|
||||
```
|
||||
Then sync the original filesystem on eMMC to the new volumes:
|
||||
```sh
|
||||
rsync -rax /. /mnt/root
|
||||
rsync -rax /nix/. /mnt/nix
|
||||
rsync -rax /home/. /mnt/home
|
||||
rsync -rax /boot/. /
|
||||
```
|
||||
Afterwards create a configuration that looks like this:
|
||||
```nix
|
||||
{
|
||||
# TODO: Make sure to update the eMMC device UUID!
|
||||
fileSystems."/boot" = { device = "/dev/disk/by-uuid/1234-5678"; fsType = "ext4"; };
|
||||
fileSystems."/" = { device = "rpool/root"; fsType = "zfs"; };
|
||||
fileSystems."/nix" = { device = "rpool/nix"; fsType = "zfs"; };
|
||||
fileSystems."/home" = { device = "rpool/home"; fsType = "zfs"; };
|
||||
}
|
||||
```
|
||||
And rebuild he system:
|
||||
```sh
|
||||
sudo nixos-rebuild boot
|
||||
```
|
||||
:warning: __IMPORTANT:__ After that it's necessary to run all the four `rsync` commands again to sync filesystems.
|
||||
|
||||
Once everything is synced you can finally reboot.
|
||||
|
||||
You should also clean up `/boot` afterwards.
|
||||
|
||||
# UART Debug Console
|
||||
|
||||
Device provides a Debug UART 4 Pin 2.54mm header connection, 3V level, 1500000bps.
|
||||
|
||||
To connect to you will need a USB to UART converter/receiver that supports the speed of 1500000bps.
|
||||
|
||||
The serial port parameters are [8-N-1](https://en.wikipedia.org/wiki/8-N-1).
|
||||
|
||||
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 picocom -b 1500000 /dev/ttyUSB0
|
||||
```
|
||||
But you'll need to disable flow control with `Ctrl-A x`.
|
||||
|
||||
Here is a good overview of UART USB-to-Serial adapters:
|
||||
|
||||
* https://www.sjoerdlangkemper.nl/2019/03/20/usb-to-serial-uart/
|
||||
* https://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf
|
||||
|
||||
Pin layout where #4 is next to USB-C port:
|
||||
|
||||
| Pin num.| #1 | #2 | #3 | #4 |
|
||||
|---------|-----|----|----|----|
|
||||
| Purpose | GND | V5 | TX | RX |
|
||||
|
||||
Remember that the `TX` and `RX` ports should be swapped between UART adapter and the board.
|
||||
|
||||
The V5 pin does not need to be connected if you're powering the board from another source.
|
||||
|
||||
See the full board diagram for more details:
|
||||
|
||||

|
||||
|
||||
You can access the recovery console by holding the __Recovery__ button and then pressing the __Power__ button.
|
||||
For this to work the device will have to be off, which requires holding the __Power__ button long enough.
|
||||
|
||||
26
friendlyarm/nanopc-t4/default.nix
Normal file
26
friendlyarm/nanopc-t4/default.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
boot.loader = {
|
||||
grub.enable = lib.mkDefault false;
|
||||
# Enables the generation of /boot/extlinux/extlinux.conf.
|
||||
generic-extlinux-compatible.enable = lib.mkDefault true;
|
||||
};
|
||||
|
||||
# UART debug console bitrates.
|
||||
services.mingetty.serialSpeed = [ 1500000 115200 ];
|
||||
|
||||
# Enable additional firmware (such as Wi-Fi drivers).
|
||||
hardware.enableRedistributableFirmware = lib.mkDefault true;
|
||||
|
||||
# Fix for not detecting the M.2 NVMe SSD. Will cause recompilation.
|
||||
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.10") (lib.mkDefault pkgs.linuxPackages_latest);
|
||||
boot.kernelPatches = lib.mkDefault [{
|
||||
name = "pcie-rockchip-config.patch";
|
||||
patch = null;
|
||||
extraConfig = ''
|
||||
PHY_ROCKCHIP_PCIE y
|
||||
PCIE_ROCKCHIP_HOST y
|
||||
'';
|
||||
}];
|
||||
}
|
||||
11
gpd/micropc/default.nix
Normal file
11
gpd/micropc/default.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
../../common/pc/laptop
|
||||
../../common/pc/laptop/ssd
|
||||
];
|
||||
|
||||
# Needed to have the keyboard working during the initrd sequence
|
||||
boot.initrd.availableKernelModules = [ "battery" ];
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
{
|
||||
imports = [
|
||||
./dwc2.nix
|
||||
./modesetting.nix
|
||||
];
|
||||
|
||||
@@ -15,6 +16,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
hardware.deviceTree.filter = "bcm2711-rpi-*.dtb";
|
||||
|
||||
# Required for the Wireless firmware
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
||||
77
raspberry-pi/4/dwc2.nix
Normal file
77
raspberry-pi/4/dwc2.nix
Normal file
@@ -0,0 +1,77 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.hardware.raspberry-pi."4".dwc2;
|
||||
in
|
||||
{
|
||||
options.hardware = {
|
||||
raspberry-pi."4".dwc2 = {
|
||||
enable = lib.mkEnableOption ''
|
||||
Enable the UDC controller to support USB OTG gadget functions.
|
||||
|
||||
In order to verify that this works, connect the Raspberry Pi with
|
||||
another computer via the USB C cable, and then do one of:
|
||||
|
||||
- `modprobe g_serial`
|
||||
- `modprobe g_mass_storage file=/path/to/some/iso-file.iso`
|
||||
|
||||
On the Raspberry Pi, `dmesg` should then show success-indicating output
|
||||
that is related to the dwc2 and g_serial/g_mass_storage modules.
|
||||
On the other computer, a serial/mass-storage device should pop up in
|
||||
the system logs.
|
||||
|
||||
For more information about what gadget functions exist along with handy
|
||||
guides on how to test them, please refer to:
|
||||
https://www.kernel.org/doc/Documentation/usb/gadget-testing.txt
|
||||
'';
|
||||
dr_mode = lib.mkOption {
|
||||
type = lib.types.enum [ "host" "peripheral" "otg" ];
|
||||
default = "otg";
|
||||
description = ''
|
||||
Dual role mode setting for the dwc2 USB controller driver.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Configure for modesetting in the device tree
|
||||
hardware.deviceTree = {
|
||||
overlays = [
|
||||
# this *should* be equivalent to (which doesn't work):
|
||||
# https://github.com/raspberrypi/linux/blob/rpi-5.10.y/arch/arm/boot/dts/overlays/dwc2-overlay.dts
|
||||
# but actually it's obtained using
|
||||
# dtc -I dtb -O dts ${config.hardware.deviceTree.kernelPackage}/dtbs/overlays/dwc2.dtbo
|
||||
# (changes: modified top-level "compatible" field)
|
||||
# which is slightly different and works
|
||||
{
|
||||
name = "dwc2-overlay";
|
||||
dtsText = ''
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
compatible = "brcm,bcm2711";
|
||||
|
||||
fragment@0 {
|
||||
target = <&usb>;
|
||||
#address-cells = <0x01>;
|
||||
#size-cells = <0x01>;
|
||||
|
||||
__overlay__ {
|
||||
compatible = "brcm,bcm2835-usb";
|
||||
dr_mode = "${cfg.dr_mode}";
|
||||
g-np-tx-fifo-size = <0x20>;
|
||||
g-rx-fifo-size = <0x22e>;
|
||||
g-tx-fifo-size = <0x200 0x200 0x200 0x200 0x200 0x100 0x100>;
|
||||
status = "okay";
|
||||
phandle = <0x01>;
|
||||
};
|
||||
};
|
||||
};
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -29,7 +29,6 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Configure for modesetting in the device tree
|
||||
hardware.deviceTree = {
|
||||
filter = "bcm2711-rpi-*.dtb";
|
||||
overlays = [
|
||||
# Equivalent to:
|
||||
# https://github.com/raspberrypi/linux/blob/rpi-5.10.y/arch/arm/boot/dts/overlays/cma-overlay.dts
|
||||
|
||||
Reference in New Issue
Block a user