The sintra live ISO (live.nix) had no serial support — ftdi_sio and the ttyJ5/ttyJ7 udev symlinks were only in hardware/upboard.nix (installed), so booting iso-sintra on real hardware failed on the validator + F56 dispenser while the disk image worked. The two definitions had already drifted (live's tejo block lacked ttyS4). Extract the UP Board serial peripherals (usbserial/ftdi_sio/cp210x, the ttyJ4/ttyJ5/ttyJ7 udev symlinks + permissions, console=tty0) into hardware/upboard-serial.nix and import it from both upboard.nix (installed tejo + sintra) and live.nix (sintra only). Single source of truth — the two artifacts can't drift again. Named upboard-serial (not sintra-serial) since upboard.nix serves both tejo-installed and sintra-installed. Camera + LED/SPI rules stay inline in upboard.nix (installed-specific; the pairing camera works via getUserMedia without the scanner symlink). Verified by eval: live sintra now carries ftdi_sio + console=tty0 + ttyJ7; installed sintra/tejo unchanged (serial present, camera present, no console dupe). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
118 lines
4.2 KiB
Nix
118 lines
4.2 KiB
Nix
# Tejo (UP Board / UP4000) Hardware Configuration
|
|
# Intel Atom/Celeron boards used in Lamassu Tejo ATM machines.
|
|
# Supports both UP Board and UP4000 variants — udev rules for both
|
|
# are included since they match different kernel paths and don't conflict.
|
|
#
|
|
# Serial port mapping:
|
|
# ttyJ4 = Printer (Nippon NP-2511D-2)
|
|
# ttyJ5 = Validator (iVizion, ID003 protocol)
|
|
# ttyJ7 = Dispenser (Fujitsu F53/F56)
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
{
|
|
# Serial peripherals (validator/dispenser/printer modules + udev symlinks +
|
|
# console=tty0) are shared with the live ISO via ./upboard-serial.nix.
|
|
imports = [ ./upboard-serial.nix ];
|
|
|
|
boot = {
|
|
loader = {
|
|
systemd-boot.enable = true;
|
|
efi.canTouchEfiVariables = true;
|
|
timeout = 3;
|
|
};
|
|
|
|
initrd.availableKernelModules = [
|
|
"xhci_pci"
|
|
"ahci"
|
|
"usb_storage"
|
|
"sd_mod"
|
|
"sdhci_pci"
|
|
"sdhci-acpi" # UP Board sintra: eMMC controller is ACPI-enumerated, not PCI
|
|
"mmc_block" # creates /dev/mmcblk* block-device nodes
|
|
"i915"
|
|
];
|
|
|
|
# Force-load the eMMC stack in stage 1 so root-by-label resolves before
|
|
# the kernel hands off to switch_root. Without this, initramfs panics
|
|
# with "An error occurred in stage 1 of the boot process" because
|
|
# /dev/disk/by-label/nixos never materialises in time.
|
|
initrd.kernelModules = [
|
|
"sdhci-acpi"
|
|
"mmc_block"
|
|
];
|
|
|
|
kernelModules = [
|
|
"kvm-intel"
|
|
"i2c-dev"
|
|
"spi-dev"
|
|
# Serial modules (usbserial/ftdi_sio/cp210x) → ./upboard-serial.nix.
|
|
];
|
|
|
|
kernelParams = [
|
|
"i915.enable_psr=0"
|
|
# console=tty0 (keeps ttyS4 free for the F56) → ./upboard-serial.nix.
|
|
"quiet"
|
|
"splash"
|
|
];
|
|
};
|
|
|
|
# Disk layout: GPT with ESP + ext4 root (eMMC on UP Board).
|
|
# Labels match what make-disk-image.nix with partitionTableType="efi"
|
|
# produces — ESP for the FAT partition, nixos for the ext4 root. We
|
|
# previously expected `by-label/boot` here and had to manually
|
|
# `fatlabel` the partition post-flash; aligning the label avoids
|
|
# that hand-step on future re-flashes. (douro.nix already uses ESP.)
|
|
fileSystems."/" = {
|
|
device = "/dev/disk/by-label/nixos";
|
|
fsType = "ext4";
|
|
};
|
|
|
|
fileSystems."/boot" = {
|
|
device = "/dev/disk/by-label/ESP";
|
|
fsType = "vfat";
|
|
};
|
|
|
|
hardware = {
|
|
graphics = {
|
|
enable = true;
|
|
extraPackages = with pkgs; [
|
|
intel-media-driver
|
|
libva-vdpau-driver
|
|
libvdpau-va-gl
|
|
];
|
|
};
|
|
enableRedistributableFirmware = true;
|
|
cpu.intel.updateMicrocode = true;
|
|
};
|
|
|
|
powerManagement = {
|
|
enable = true;
|
|
cpuFreqGovernor = "performance";
|
|
};
|
|
|
|
# Disable suspend/hibernate for kiosk
|
|
systemd.targets = {
|
|
sleep.enable = false;
|
|
suspend.enable = false;
|
|
hibernate.enable = false;
|
|
hybrid-sleep.enable = false;
|
|
};
|
|
|
|
# Camera + LED/SPI peripherals. The serial rules (validator/dispenser/printer
|
|
# symlinks + permissions) are shared with the live ISO in ./upboard-serial.nix.
|
|
services.udev.extraRules = lib.mkAfter ''
|
|
# ── Camera devices ─────────────────────────────────────────────────
|
|
SUBSYSTEM=="video4linux", ATTR{index}=="0", KERNELS=="1-5", ATTRS{idVendor}=="0ac8", ATTRS{idProduct}=="0345", SYMLINK+="video-scan"
|
|
SUBSYSTEM=="video4linux", ATTR{index}=="0", KERNELS=="1-2", ATTRS{idVendor}=="0ac8", ATTRS{idProduct}=="0345", SYMLINK+="video-scan"
|
|
SUBSYSTEM=="video4linux", ATTR{index}=="0", KERNELS=="1-6", ATTRS{idVendor}=="0ac8", ATTRS{idProduct}=="0345", SYMLINK+="video-front"
|
|
SUBSYSTEM=="video4linux", ATTR{index}=="0", KERNELS=="1-3", ATTRS{idVendor}=="0ac8", ATTRS{idProduct}=="0345", SYMLINK+="video-front"
|
|
|
|
# ── LED SPI / peripherals ──────────────────────────────────────────
|
|
KERNEL=="spidev1.0", SYMLINK+="ledspi"
|
|
KERNEL=="spidev2.0", SYMLINK+="ledspi"
|
|
SUBSYSTEM=="spidev", GROUP="spi", MODE="0660"
|
|
SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660"
|
|
SUBSYSTEM=="leds", KERNEL=="upboard:*", ACTION=="add|change", RUN+="${pkgs.findutils}/bin/find /sys$devpath -type f -exec ${pkgs.coreutils}/bin/chmod g+u {} + -exec ${pkgs.coreutils}/bin/chown :leds {} +"
|
|
'';
|
|
}
|