mirror of
https://github.com/nix-community/raspberry-pi-nix.git
synced 2025-11-08 19:46:03 +01:00
use nix based config.txt generation
This commit is contained in:
parent
fdbe51e3b0
commit
67f257e524
3 changed files with 26 additions and 75 deletions
|
|
@ -22,11 +22,16 @@ let
|
|||
args = render-dt-kvs v;
|
||||
}) overlays);
|
||||
render-config-section = k:
|
||||
{ options, base-dtb-params, dt-overlays }: ''
|
||||
{ options, base-dtb-params, dt-overlays }:
|
||||
let
|
||||
all-config = lib.concatStringsSep "\n" (lib.filter (x: x != "") [
|
||||
(render-options options)
|
||||
(render-base-dt-params base-dtb-params)
|
||||
(render-dt-overlays dt-overlays)
|
||||
]);
|
||||
in ''
|
||||
[${k}]
|
||||
${render-options options}
|
||||
${render-base-dt-params base-dtb-params}
|
||||
${render-dt-overlays dt-overlays}
|
||||
${all-config}
|
||||
'';
|
||||
in conf:
|
||||
lib.strings.concatStringsSep "\n"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,17 @@
|
|||
{
|
||||
imports = [ ../sd-image ./config.nix ];
|
||||
|
||||
system.activationScripts.raspberrypi = {
|
||||
text = ''
|
||||
if ! grep -qs '/boot/firmware ' /proc/mounts; then
|
||||
mount /dev/disk/by-label/${config.sdImage.firmwarePartitionName} /boot/firmware
|
||||
fi
|
||||
cp ${pkgs.uboot_rpi_arm64}/u-boot.bin /boot/firmware/u-boot-rpi-arm64.bin
|
||||
cp -r ${pkgs.raspberrypifw}/share/raspberrypi/boot/{start*.elf,*.dtb,bootcode.bin,fixup*.dat,overlays} /boot/firmware
|
||||
cp ${config.raspberrypi-config-output} /boot/firmware/config.txt
|
||||
'';
|
||||
};
|
||||
|
||||
raspberrypi-config = {
|
||||
pi4 = {
|
||||
options = {
|
||||
|
|
@ -17,16 +28,12 @@
|
|||
pi02 = { dt-overlays = { vc4-kms-v3d = { cma-256 = null; }; }; };
|
||||
all = {
|
||||
options = {
|
||||
kernel = "u-boot-rpi_arm64.bin";
|
||||
kernel = "u-boot-rpi-arm64.bin";
|
||||
enable_uart = true;
|
||||
avoid_warnings = true;
|
||||
arm_64bit = true;
|
||||
};
|
||||
base-dtb-params = {
|
||||
i2c = "on";
|
||||
audio = "on";
|
||||
krnbt = "on";
|
||||
};
|
||||
base-dtb-params = { krnbt = "on"; };
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue