
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
104 lines
3.5 KiB
Nix
104 lines
3.5 KiB
Nix
# To build, use:
|
|
# nix-build nixos -I nixos-config=nixos/modules/installer/sd-card/sd-image-aarch64.nix -A config.system.build.sdImage
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
{
|
|
imports = [
|
|
../../profiles/base.nix
|
|
./sd-image.nix
|
|
];
|
|
|
|
boot.loader.grub.enable = false;
|
|
boot.loader.generic-extlinux-compatible.enable = true;
|
|
|
|
boot.consoleLogLevel = lib.mkDefault 7;
|
|
|
|
# The serial ports listed here are:
|
|
# - ttyS0: for Tegra (Jetson TX1)
|
|
# - ttyAMA0: for QEMU's -machine virt
|
|
boot.kernelParams = [
|
|
"console=ttyS0,115200n8"
|
|
"console=ttyAMA0,115200n8"
|
|
"console=tty0"
|
|
];
|
|
|
|
sdImage = {
|
|
populateFirmwareCommands =
|
|
let
|
|
configTxt = pkgs.writeText "config.txt" ''
|
|
[pi3]
|
|
kernel=u-boot-rpi3.bin
|
|
|
|
# Otherwise the serial output will be garbled.
|
|
core_freq=250
|
|
|
|
[pi02]
|
|
kernel=u-boot-rpi3.bin
|
|
|
|
[pi4]
|
|
kernel=u-boot-rpi4.bin
|
|
enable_gic=1
|
|
armstub=armstub8-gic.bin
|
|
|
|
# Otherwise the resolution will be weird in most cases, compared to
|
|
# what the pi3 firmware does by default.
|
|
disable_overscan=1
|
|
|
|
# Supported in newer board revisions
|
|
arm_boost=1
|
|
|
|
[cm4]
|
|
# Enable host mode on the 2711 built-in XHCI USB controller.
|
|
# This line should be removed if the legacy DWC2 controller is required
|
|
# (e.g. for USB device mode) or if USB support is not required.
|
|
otg_mode=1
|
|
|
|
[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
|
|
''
|
|
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
|
|
|
|
# Add the config
|
|
cp ${configTxt} firmware/config.txt
|
|
|
|
# Add pi3 specific files
|
|
cp ${pkgs.ubootRaspberryPi3_64bit}/u-boot.bin firmware/u-boot-rpi3.bin
|
|
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2710-rpi-2-b.dtb firmware/
|
|
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2710-rpi-3-b.dtb firmware/
|
|
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2710-rpi-3-b-plus.dtb firmware/
|
|
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2710-rpi-cm3.dtb firmware/
|
|
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2710-rpi-zero-2.dtb firmware/
|
|
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2710-rpi-zero-2-w.dtb firmware/
|
|
|
|
# Add pi4 specific files
|
|
cp ${pkgs.ubootRaspberryPi4_64bit}/u-boot.bin firmware/u-boot-rpi4.bin
|
|
cp ${pkgs.raspberrypi-armstubs}/armstub8-gic.bin firmware/armstub8-gic.bin
|
|
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-4-b.dtb firmware/
|
|
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-400.dtb firmware/
|
|
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-cm4.dtb firmware/
|
|
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-cm4s.dtb firmware/
|
|
'';
|
|
populateRootCommands = ''
|
|
mkdir -p ./files/boot
|
|
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
|
|
'';
|
|
};
|
|
}
|