mirror of
https://github.com/nix-community/raspberry-pi-nix.git
synced 2025-11-08 19:46:03 +01:00
add config.txt docs
This commit is contained in:
parent
e7513ab173
commit
ed2df925d5
1 changed files with 124 additions and 0 deletions
124
README.md
124
README.md
|
|
@ -98,6 +98,130 @@ partition.
|
||||||
As noted, the `config.txt` file is generated by the NixOS
|
As noted, the `config.txt` file is generated by the NixOS
|
||||||
configuration and automatically updated on system activation.
|
configuration and automatically updated on system activation.
|
||||||
|
|
||||||
|
The relevant nixos option is
|
||||||
|
`hardware.raspberry-pi.config`. Configuration is partitioned into
|
||||||
|
three sections:
|
||||||
|
|
||||||
|
1. Base device tree parameters `base-dt-params`
|
||||||
|
2. Device tree overlays `dt-overlays`
|
||||||
|
3. Firmware options `options`
|
||||||
|
|
||||||
|
Other than that, the format follows pretty closely to the config.txt
|
||||||
|
format. For example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
hardware.raspberry-pi.config = {
|
||||||
|
cm4 = {
|
||||||
|
options = {
|
||||||
|
otg_mode = {
|
||||||
|
enable = true;
|
||||||
|
value = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
pi4 = {
|
||||||
|
options = {
|
||||||
|
arm_boost = {
|
||||||
|
enable = true;
|
||||||
|
value = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
dt-overlays = {
|
||||||
|
vc4-kms-v3d = {
|
||||||
|
enable = true;
|
||||||
|
params = { cma-512 = { enable = true; }; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
all = {
|
||||||
|
options = {
|
||||||
|
# The firmware will start our u-boot binary rather than a
|
||||||
|
# linux kernel.
|
||||||
|
kernel = {
|
||||||
|
enable = true;
|
||||||
|
value = "u-boot-rpi-arm64.bin";
|
||||||
|
};
|
||||||
|
arm_64bit = {
|
||||||
|
enable = true;
|
||||||
|
value = true;
|
||||||
|
};
|
||||||
|
enable_uart = {
|
||||||
|
enable = true;
|
||||||
|
value = true;
|
||||||
|
};
|
||||||
|
avoid_warnings = {
|
||||||
|
enable = true;
|
||||||
|
value = true;
|
||||||
|
};
|
||||||
|
camera_auto_detect = {
|
||||||
|
enable = true;
|
||||||
|
value = true;
|
||||||
|
};
|
||||||
|
display_auto_detect = {
|
||||||
|
enable = true;
|
||||||
|
value = true;
|
||||||
|
};
|
||||||
|
disable_overscan = {
|
||||||
|
enable = true;
|
||||||
|
value = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
dt-overlays = {
|
||||||
|
vc4-kms-v3d = {
|
||||||
|
enable = true;
|
||||||
|
params = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
base-dt-params = {
|
||||||
|
krnbt = {
|
||||||
|
enable = true;
|
||||||
|
value = "on";
|
||||||
|
};
|
||||||
|
spi = {
|
||||||
|
enable = true;
|
||||||
|
value = "on";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
generates the following config.txt:
|
||||||
|
|
||||||
|
```
|
||||||
|
# This is a generated file. Do not edit!
|
||||||
|
[all]
|
||||||
|
arm_64bit=1
|
||||||
|
avoid_warnings=1
|
||||||
|
camera_auto_detect=1
|
||||||
|
disable_overscan=1
|
||||||
|
display_auto_detect=1
|
||||||
|
enable_uart=1
|
||||||
|
kernel=u-boot-rpi-arm64.bin
|
||||||
|
dtparam=krnbt=on
|
||||||
|
dtparam=spi=on
|
||||||
|
dtoverlay=vc4-kms-v3d
|
||||||
|
|
||||||
|
dtoverlay=
|
||||||
|
|
||||||
|
[cm4]
|
||||||
|
otg_mode=1
|
||||||
|
|
||||||
|
[pi4]
|
||||||
|
arm_boost=1
|
||||||
|
dtoverlay=vc4-kms-v3d
|
||||||
|
dtparam=cma-512
|
||||||
|
dtoverlay=
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to preview the generated `config.txt`, you can find
|
||||||
|
it at the path `config.hardware.raspberry-pi.config-output`. For
|
||||||
|
example, if you had the above configuration then you could build the
|
||||||
|
`config.txt` file with:
|
||||||
|
|
||||||
|
```
|
||||||
|
nix build '.#nixosConfigurations.rpi-example.config.hardware.raspberry-pi.config-output'
|
||||||
|
```
|
||||||
|
|
||||||
## Firmware partition implementation notes
|
## Firmware partition implementation notes
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue