secubox-deb/tools/Tow-Boot/modules/documentation.nix
CyberMind-FR 0d7a21486b feat(tow-boot): Add Tow-Boot with eMMC boot support for MOCHAbin
- Add Tow-Boot source to tools/ with eMMC boot partition support
- Enable CONFIG_SUPPORT_EMMC_BOOT via mmcBootIndex for MOCHAbin variants
- Document boot mode jumpers J17-J22 (SPI 0x32, eMMC 0x2B)
- Document Tow-Boot build and flashing procedures
- Add known hardware issues (SPI intermittent, eMMC BootROM failure)
- Remove incorrect microSD slot reference from MOCHAbin docs
- Fix systemd service path (/lib → /usr/lib) in mitmproxy package

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-03 16:58:25 +02:00

134 lines
3.7 KiB
Nix

{ config, lib, pkgs, ... }:
let
inherit (lib)
mkOption
optionalString
types
;
inherit (config.device)
identifier
;
withMMCBoot = config.hardware.mmcBootIndex != null;
withSPI = config.hardware.SPISize != null;
withDedicatedStorage = withSPI || withMMCBoot;
inherit (config) device;
fullName = "${device.manufacturer} ${device.name}";
in
{
options = {
documentation = {
helpers = {
genericInstallationInstructionsTemplate = mkOption {
type = types.unspecified;
internal = true;
description = ''
Function that returns a markdown snippet with generic installation
instructions.
'';
};
genericSharedStorageInstructionsTemplate = mkOption {
type = types.unspecified;
internal = true;
description = ''
Function that returns a markdown snippet with generic shared
storage strategy instructions.
'';
};
};
sections = {
installationInstructions = mkOption {
type = types.str;
internal = true;
description = ''
Markdown fragment with device installation instructions.
'';
};
};
};
};
config = {
documentation.helpers.genericSharedStorageInstructionsTemplate =
{ storage ? "an SD card or eMMC" }:
''
### Installing to shared storage
Using the shared storage strategy on the *${fullName}* can be done by
writing the `shared.disk-image.img` to ${storage}.
```
# dd if=shared.disk-image.img of=/dev/XXX bs=1M oflag=direct,sync status=progress
```
''
;
documentation.helpers.genericInstallationInstructionsTemplate =
{ storage ? "an SD card"
, startupConflictNote
}:
''
## Installation instructions
${optionalString withSPI ''
### Installing to SPI (recommended)
${startupConflictNote}
By installing Tow-Boot to SPI, your *${fullName}* will be able to
start using standards-based booting without conflicting with the
operating system storage.
To do so, you will need to write the SPI installer image to ${storage}.
```
# dd if=spi.installer.img of=/dev/XXX bs=1M oflag=direct,sync status=progress
```
Once done, start the system, and in the boot menu, select
*Flash firmware to SPI*.
Once this is done, remove the installation media, and verify Tow-Boot
starts from power-on.
''}
${optionalString withMMCBoot ''
### Installing to eMMC Boot${optionalString (!withSPI) " (recommended)"}
${startupConflictNote}
By installing Tow-Boot to eMMC Boot, your *${fullName}* will be able to
start using standards-based booting without conflicting with the
operating system storage.
To do so, you will need to write the eMMC Boot installer image to ${storage}.
```
# dd if=mmcboot.installer.img of=/dev/XXX bs=1M oflag=direct,sync status=progress
```
Once done, start the system, and in the boot menu, select
*Flash firmware to eMMC Boot*.
Once this is done, remove the installation media, and verify Tow-Boot
starts from power-on.
''}
${config.documentation.helpers.genericSharedStorageInstructionsTemplate {}}
''
;
documentation.sections.installationInstructions =
lib.mkOptionDefault
(builtins.throw "${identifier} missing installationInstructions...")
;
};
}