Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formats/sd* #203

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bors.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cut_body_after = "" # don't include text from the PR body in the merge commit message
status = [
"build (macos-latest)",
"build (ubuntu-latest)"
]
2 changes: 1 addition & 1 deletion formats/sd-aarch64-installer.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ config, modulesPath, ... }:
{
imports = [
"${toString modulesPath}/installer/sd-card/sd-image-aarch64.nix"
"${toString modulesPath}/installer/sd-card/sd-image-aarch64-installer.nix"
];

formatAttr = "sdImage";
Expand Down
50 changes: 2 additions & 48 deletions formats/sd-aarch64.nix
Original file line number Diff line number Diff line change
@@ -1,54 +1,8 @@
{ config, lib, pkgs, modulesPath, ... }:
let
extlinux-conf-builder =
import "${toString modulesPath}/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix" {
pkgs = pkgs.buildPackages;
};

in {
{
imports = [
"${toString modulesPath}/installer/sd-card/sd-image.nix"
"${toString modulesPath}/installer/sd-card/sd-image-aarch64.nix"
];

boot.loader = {
grub.enable = false;
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
# Also increase the amount of CMA to ensure the virtual console on the RPi3 works.
boot.kernelParams = ["cma=32M" "console=ttyS0,115200n8" "console=ttyAMA0,115200n8" "console=tty0"];

sdImage = {
populateFirmwareCommands = let
configTxt = pkgs.writeText "config.txt" ''
kernel=u-boot-rpi3.bin

# Boot in 64-bit mode.
arm_control=0x200

# U-Boot used to need this to work, regardless of whether UART is actually used or not.
# TODO: check when/if this can be removed.
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/)
cp ${pkgs.ubootRaspberryPi3_64bit}/u-boot.bin firmware/u-boot-rpi3.bin
cp ${configTxt} firmware/config.txt
'';
populateRootCommands = ''
mkdir -p ./files/boot
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./files/boot
'';
};

formatAttr = "sdImage";
}