brainix/modules/sd-image/sd-image-brain.nix
2026-02-13 17:06:24 +09:00

55 lines
1.3 KiB
Nix

# Generate sdImage for SHARP Brain (i.MX28)
{ config, lib, pkgs, ... }:
let
bootfiles = builtins.path {
path = ../../bootfiles;
name = "brain-bootfiles";
};
in {
imports = [
./sd-image.nix
];
boot.kernelParams = [
"console=ttyAMA0,115200n8"
"console=tty1"
"rootwait"
"fbcon=font:ProFont6x11"
];
boot.loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
fileSystems = lib.mkForce {
"/boot" = {
device = "/dev/disk/by-label/${config.sdImage.firmwarePartitionName}";
fsType = "vfat";
# Alternatively, this could be removed from the configuration.
# The filesystem is not needed at runtime, it could be treated
# as an opaque blob instead of a discrete FAT32 filesystem.
options = [ "nofail" ];
};
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
};
sdImage = {
imageBaseName = "brain-nixos";
firmwarePartitionName = "BOOT";
firmwareSize = 64; # MiB
populateFirmwareCommands = ''
# Copy Brain boot assets (BrainLILO, u-boot loader, etc.)
cp -R ${bootfiles}/. firmware/
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./firmware
'';
populateRootCommands = ''
mkdir -p ./files/boot
'';
};
}