diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index 48d96d4e4184..8cb0986567f2 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -803,6 +803,8 @@ - The new `boot.loader.systemd-boot.windows` option makes setting up dual-booting with Windows on a different drive easier. +- The `boot.loader.raspberryPi` options were marked as deprecated in 23.11 and have now been removed. + - Linux 4.19 has been removed because it will reach its end of life within the lifespan of 24.11. - Unprivileged access to the kernel syslog via `dmesg` is now restricted by default. Users wanting to keep an diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 67545614bdaa..350bb8a0e3cb 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -1632,7 +1632,6 @@ ./system/boot/loader/external/external.nix ./system/boot/loader/init-script/init-script.nix ./system/boot/loader/loader.nix - ./system/boot/loader/raspberrypi/raspberrypi.nix ./system/boot/loader/systemd-boot/systemd-boot.nix ./system/boot/luksroot.nix ./system/boot/stratisroot.nix diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index ca3b2df9fc9a..7888c9883a70 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -20,6 +20,7 @@ in (mkAliasOptionModuleMD [ "environment" "checkConfigurationOptions" ] [ "_module" "check" ]) # Completely removed modules + (mkRemovedOptionModule [ "boot" "loader" "raspberryPi" ] "The raspberryPi boot loader has been removed. See https://github.com/NixOS/nixpkgs/pull/241534 for what to use instead.") (mkRemovedOptionModule [ "environment" "blcr" "enable" ] "The BLCR module has been removed") (mkRemovedOptionModule [ "environment" "noXlibs" ] '' The environment.noXlibs option was removed, as it often caused surprising breakages for new users. diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.nix deleted file mode 100644 index 64e106036abd..000000000000 --- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ pkgs, configTxt, firmware ? pkgs.raspberrypifw }: - -pkgs.substituteAll { - src = ./raspberrypi-builder.sh; - isExecutable = true; - inherit (pkgs) bash; - path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep]; - inherit firmware configTxt; -} diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh deleted file mode 100644 index 0541ca1ba622..000000000000 --- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh +++ /dev/null @@ -1,143 +0,0 @@ -#! @bash@/bin/sh - -# This can end up being called disregarding the shebang. -set -e - -shopt -s nullglob - -export PATH=/empty -for i in @path@; do PATH=$PATH:$i/bin; done - -usage() { - echo "usage: $0 -c [-d ]" >&2 - exit 1 -} - -default= # Default configuration -target=/boot # Target directory - -while getopts "c:d:" opt; do - case "$opt" in - c) default="$OPTARG" ;; - d) target="$OPTARG" ;; - \?) usage ;; - esac -done - -echo "updating the boot generations directory..." - -mkdir -p $target/old - -# Convert a path to a file in the Nix store such as -# /nix/store/-/file to --. -cleanName() { - local path="$1" - echo "$path" | sed 's|^/nix/store/||' | sed 's|/|-|g' -} - -# Copy a file from the Nix store to $target/kernels. -declare -A filesCopied - -copyToKernelsDir() { - local src="$1" - local dst="$target/old/$(cleanName $src)" - # Don't copy the file if $dst already exists. This means that we - # have to create $dst atomically to prevent partially copied - # kernels or initrd if this script is ever interrupted. - if ! test -e $dst; then - local dstTmp=$dst.tmp.$$ - cp $src $dstTmp - mv $dstTmp $dst - fi - filesCopied[$dst]=1 - result=$dst -} - -copyForced() { - local src="$1" - local dst="$2" - cp $src $dst.tmp - mv $dst.tmp $dst -} - -outdir=$target/old -mkdir -p $outdir || true - -# Copy its kernel and initrd to $target/old. -addEntry() { - local path="$1" - local generation="$2" - - if ! test -e $path/kernel -a -e $path/initrd; then - return - fi - - local kernel=$(readlink -f $path/kernel) - local initrd=$(readlink -f $path/initrd) - local dtb_path=$(readlink -f $path/dtbs) - - if test -n "@copyKernels@"; then - copyToKernelsDir $kernel; kernel=$result - copyToKernelsDir $initrd; initrd=$result - fi - - echo $(readlink -f $path) > $outdir/$generation-system - echo $(readlink -f $path/init) > $outdir/$generation-init - cp $path/kernel-params $outdir/$generation-cmdline.txt - echo $initrd > $outdir/$generation-initrd - echo $kernel > $outdir/$generation-kernel - - if test "$generation" = "default"; then - copyForced $kernel $target/kernel.img - copyForced $initrd $target/initrd - for dtb in $dtb_path/{broadcom,}/bcm*.dtb; do - dst="$target/$(basename $dtb)" - copyForced $dtb "$dst" - filesCopied[$dst]=1 - done - cp "$(readlink -f "$path/init")" $target/nixos-init - echo "`cat $path/kernel-params` init=$path/init" >$target/cmdline.txt - fi -} - -addEntry $default default - -# Add all generations of the system profile to the menu, in reverse -# (most recent to least recent) order. -for generation in $( - (cd /nix/var/nix/profiles && ls -d system-*-link) \ - | sed 's/system-\([0-9]\+\)-link/\1/' \ - | sort -n -r); do - link=/nix/var/nix/profiles/system-$generation-link - addEntry $link $generation -done - -# Add the firmware files -fwdir=@firmware@/share/raspberrypi/boot/ -copyForced $fwdir/bootcode.bin $target/bootcode.bin -copyForced $fwdir/fixup.dat $target/fixup.dat -copyForced $fwdir/fixup4.dat $target/fixup4.dat -copyForced $fwdir/fixup4cd.dat $target/fixup4cd.dat -copyForced $fwdir/fixup4db.dat $target/fixup4db.dat -copyForced $fwdir/fixup4x.dat $target/fixup4x.dat -copyForced $fwdir/fixup_cd.dat $target/fixup_cd.dat -copyForced $fwdir/fixup_db.dat $target/fixup_db.dat -copyForced $fwdir/fixup_x.dat $target/fixup_x.dat -copyForced $fwdir/start.elf $target/start.elf -copyForced $fwdir/start4.elf $target/start4.elf -copyForced $fwdir/start4cd.elf $target/start4cd.elf -copyForced $fwdir/start4db.elf $target/start4db.elf -copyForced $fwdir/start4x.elf $target/start4x.elf -copyForced $fwdir/start_cd.elf $target/start_cd.elf -copyForced $fwdir/start_db.elf $target/start_db.elf -copyForced $fwdir/start_x.elf $target/start_x.elf - -# Add the config.txt -copyForced @configTxt@ $target/config.txt - -# Remove obsolete files from $target and $target/old. -for fn in $target/old/*linux* $target/old/*initrd-initrd* $target/bcm*.dtb; do - if ! test "${filesCopied[$fn]}" = 1; then - rm -vf -- "$fn" - fi -done diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix deleted file mode 100644 index cf1f37bc62b8..000000000000 --- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix +++ /dev/null @@ -1,151 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.boot.loader.raspberryPi; - - builderUboot = import ./uboot-builder.nix { inherit pkgs configTxt; inherit (cfg) version; }; - builderGeneric = import ./raspberrypi-builder.nix { inherit pkgs configTxt; }; - - builder = - if cfg.uboot.enable then - "${builderUboot} -g ${toString cfg.uboot.configurationLimit} -t ${timeoutStr} -c" - else - "${builderGeneric} -c"; - - blCfg = config.boot.loader; - timeoutStr = if blCfg.timeout == null then "-1" else toString blCfg.timeout; - - isAarch64 = pkgs.stdenv.hostPlatform.isAarch64; - optional = pkgs.lib.optionalString; - - configTxt = - pkgs.writeText "config.txt" ('' - # 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 - '' + optional isAarch64 '' - # Boot in 64-bit mode. - arm_64bit=1 - '' + (if cfg.uboot.enable then '' - kernel=u-boot-rpi.bin - '' else '' - kernel=kernel.img - initramfs initrd followkernel - '') + optional (cfg.firmwareConfig != null) cfg.firmwareConfig); - -in - -{ - options = { - - boot.loader.raspberryPi = { - enable = mkOption { - default = false; - type = types.bool; - description = '' - Whether to create files with the system generations in - `/boot`. - `/boot/old` will hold files from old generations. - - ::: {.note} - These options are deprecated, unsupported, and may not work like expected. - ::: - ''; - }; - - version = mkOption { - default = 2; - type = types.enum [ 0 1 2 3 4 ]; - description = ""; - }; - - uboot = { - enable = mkOption { - default = false; - type = types.bool; - description = '' - Enable using uboot as bootmanager for the raspberry pi. - - ::: {.note} - These options are deprecated, unsupported, and may not work like expected. - ::: - ''; - }; - - configurationLimit = mkOption { - default = 20; - example = 10; - type = types.int; - description = '' - Maximum number of configurations in the boot menu. - - ::: {.note} - These options are deprecated, unsupported, and may not work like expected. - ::: - ''; - }; - - }; - - firmwareConfig = mkOption { - default = null; - type = types.nullOr types.lines; - description = '' - Extra options that will be appended to `/boot/config.txt` file. - For possible values, see: https://www.raspberrypi.com/documentation/computers/config_txt.html - - ::: {.note} - These options are deprecated, unsupported, and may not work like expected. - ::: - ''; - }; - }; - }; - - config = mkMerge[ - (mkIf cfg.uboot.enable { - warnings = [ - '' - The option set for `boot.loader.raspberrypi.uboot` has been recommended against - for years, and is now formally deprecated. - - It is possible it already did not work like you expected. - - It never worked on the Raspberry Pi 4 family. - - These options will be removed by NixOS 24.11. - '' - ]; - }) - (mkIf cfg.enable { - warnings = [ - '' - The option set for `boot.loader.raspberrypi` has been recommended against - for years, and is now formally deprecated. - - It is possible it already did not work like you expected. - - It never worked on the Raspberry Pi 4 family. - - These options will be removed by NixOS 24.11. - '' - ]; - }) - (mkIf cfg.enable { - assertions = singleton { - assertion = !pkgs.stdenv.hostPlatform.isAarch64 || cfg.version >= 3; - message = "Only Raspberry Pi >= 3 supports aarch64."; - }; - - system.build.installBootLoader = builder; - system.boot.loader.id = "raspberrypi"; - system.boot.loader.kernelFile = pkgs.stdenv.hostPlatform.linux-kernel.target; - }) - ]; -} diff --git a/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix b/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix deleted file mode 100644 index a4352ab9a240..000000000000 --- a/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ pkgs, version, configTxt }: - -let - isAarch64 = pkgs.stdenv.hostPlatform.isAarch64; - - uboot = - if version == 0 then - pkgs.ubootRaspberryPiZero - else if version == 1 then - pkgs.ubootRaspberryPi - else if version == 2 then - pkgs.ubootRaspberryPi2 - else if version == 3 then - if isAarch64 then - pkgs.ubootRaspberryPi3_64bit - else - pkgs.ubootRaspberryPi3_32bit - else - throw "U-Boot is not yet supported on the raspberry pi 4."; - - extlinuxConfBuilder = - import ../generic-extlinux-compatible/extlinux-conf-builder.nix { - pkgs = pkgs.buildPackages; - }; -in -pkgs.substituteAll { - src = ./uboot-builder.sh; - isExecutable = true; - inherit (pkgs) bash; - path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep]; - firmware = pkgs.raspberrypifw; - inherit uboot; - inherit configTxt; - inherit extlinuxConfBuilder; - inherit version; -} - diff --git a/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh b/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh deleted file mode 100644 index ea591427179f..000000000000 --- a/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh +++ /dev/null @@ -1,38 +0,0 @@ -#! @bash@/bin/sh -e - -target=/boot # Target directory - -while getopts "t:c:d:g:" opt; do - case "$opt" in - d) target="$OPTARG" ;; - *) ;; - esac -done - -copyForced() { - local src="$1" - local dst="$2" - cp $src $dst.tmp - mv $dst.tmp $dst -} - -# Call the extlinux builder -"@extlinuxConfBuilder@" "$@" - -# Add the firmware files -fwdir=@firmware@/share/raspberrypi/boot/ -copyForced $fwdir/bootcode.bin $target/bootcode.bin -copyForced $fwdir/fixup.dat $target/fixup.dat -copyForced $fwdir/fixup_cd.dat $target/fixup_cd.dat -copyForced $fwdir/fixup_db.dat $target/fixup_db.dat -copyForced $fwdir/fixup_x.dat $target/fixup_x.dat -copyForced $fwdir/start.elf $target/start.elf -copyForced $fwdir/start_cd.elf $target/start_cd.elf -copyForced $fwdir/start_db.elf $target/start_db.elf -copyForced $fwdir/start_x.elf $target/start_x.elf - -# Add the uboot file -copyForced @uboot@/u-boot.bin $target/u-boot-rpi.bin - -# Add the config.txt -copyForced @configTxt@ $target/config.txt