diff options
author | Samuel Dionne-Riel <samuel@dionne-riel.com> | 2020-09-12 22:48:05 -0400 |
---|---|---|
committer | Milan <me@pbb.lc> | 2020-12-31 18:20:49 +0100 |
commit | f9d5de05d255dca286d12a6630a97a2b81dcaea7 (patch) | |
tree | 05af9d3212cc629dfda0d89e8e0a3819db9a817b /nixos | |
parent | 95cd8c8d7be15606a0ec418dc313726ff170d9ee (diff) |
sd-image-raspberrypi4: Use u-boot for booting
This includes setting up everything for the mainline Raspberry Pi 4 image. In fact, the only difference left in the Raspberry Pi 4-specific image is the kernel from the vendor.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/installer/cd-dvd/sd-image-aarch64.nix | 27 | ||||
-rw-r--r-- | nixos/modules/installer/cd-dvd/sd-image-raspberrypi4.nix | 32 |
2 files changed, 25 insertions, 34 deletions
diff --git a/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix b/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix index a5bc436be8262..e73bc5a22e0b8 100644 --- a/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix +++ b/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix @@ -30,13 +30,25 @@ sdImage = { populateFirmwareCommands = let configTxt = pkgs.writeText "config.txt" '' + [pi3] 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 + + [all] # Boot in 64-bit mode. arm_64bit=1 - # 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. + # 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 @@ -45,8 +57,17 @@ ''; 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 + + # Add the config cp ${configTxt} firmware/config.txt + + # Add pi3 specific files + cp ${pkgs.ubootRaspberryPi3_64bit}/u-boot.bin firmware/u-boot-rpi3.bin + + # 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/ ''; populateRootCommands = '' mkdir -p ./files/boot diff --git a/nixos/modules/installer/cd-dvd/sd-image-raspberrypi4.nix b/nixos/modules/installer/cd-dvd/sd-image-raspberrypi4.nix index 87545e8420308..5bdec7de86e8a 100644 --- a/nixos/modules/installer/cd-dvd/sd-image-raspberrypi4.nix +++ b/nixos/modules/installer/cd-dvd/sd-image-raspberrypi4.nix @@ -3,36 +3,6 @@ { config, lib, pkgs, ... }: { - imports = [ - ../../profiles/base.nix - ../../profiles/installation-device.nix - ./sd-image.nix - ]; - - boot.loader.grub.enable = false; - boot.loader.raspberryPi.enable = true; - boot.loader.raspberryPi.version = 4; + imports = [ ./sd-image-aarch64.nix ]; boot.kernelPackages = pkgs.linuxPackages_rpi4; - - boot.consoleLogLevel = lib.mkDefault 7; - - sdImage = { - firmwareSize = 128; - firmwarePartitionName = "NIXOS_BOOT"; - # This is a hack to avoid replicating config.txt from boot.loader.raspberryPi - populateFirmwareCommands = - "${config.system.build.installBootLoader} ${config.system.build.toplevel} -d ./firmware"; - # As the boot process is done entirely in the firmware partition. - populateRootCommands = ""; - }; - - fileSystems."/boot/firmware" = { - # This effectively "renames" the attrsOf entry set in sd-image.nix - mountPoint = "/boot"; - neededForBoot = true; - }; - - # the installation media is also the installation target, - # so we don't want to provide the installation configuration.nix. - installer.cloneConfig = false; } |