mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat(sakuya): system.build.sdImage
This commit is contained in:
parent
c74790c6dd
commit
7e7d6b01f7
1 changed files with 43 additions and 1 deletions
|
|
@ -1,11 +1,15 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
modulesPath,
|
||||
meta,
|
||||
...
|
||||
}: {
|
||||
imports = let
|
||||
inherit (meta) nixos;
|
||||
in [
|
||||
(modulesPath + "/installer/sd-card/sd-image.nix")
|
||||
nixos.base
|
||||
nixos.sops
|
||||
nixos.tailscale
|
||||
];
|
||||
|
|
@ -13,9 +17,47 @@
|
|||
grub.enable = false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
sdImage = let
|
||||
# TODO: boot0 requires additional BSL processing applied to the uboot bin:
|
||||
# https://github.com/longsleep/build-pine64-image/tree/master/u-boot-postprocess
|
||||
uboot = pkgs.ubootPine64;
|
||||
# Arch Linux ARM has already done this for us...
|
||||
ubootPrepackagedARM = pkgs.fetchurl {
|
||||
url = "http://os.archlinuxarm.org/os/allwinner/boot/pine64/u-boot-sunxi-with-spl.bin";
|
||||
sha256 = "sha256-qT5M93p/t7eW6lqZq4dC8z8BkYcQOkTgiN+jZatObuo=";
|
||||
};
|
||||
ubootProcessed = ubootPrepackagedARM;
|
||||
in {
|
||||
postBuildCommands = ''
|
||||
dd if=${ubootProcessed} of=$img bs=8k seek=1
|
||||
'';
|
||||
# taken from sd-image-aarch64.nix
|
||||
populateFirmwareCommands = let
|
||||
configTxt = pkgs.writeText "config.txt" ''
|
||||
[all]
|
||||
# Boot in 64-bit mode.
|
||||
arm_64bit=1
|
||||
|
||||
# U-Boot needs this to work, regardless of whether UART is actually used or not.
|
||||
# Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still
|
||||
# a requirement in the future.
|
||||
enable_uart=1
|
||||
|
||||
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
|
||||
# when attempting to show low-voltage or overtemperature warnings.
|
||||
avoid_warnings=1
|
||||
'';
|
||||
in ''
|
||||
cp ${configTxt} firmware/config.txt
|
||||
'';
|
||||
populateRootCommands = ''
|
||||
mkdir -p ./files/boot
|
||||
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
|
||||
'';
|
||||
};
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
|
||||
device = "/dev/disk/by-label/NIXOS_SD";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue