diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh index 0fb07de10c044..c5435f8ef746a 100644 --- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh +++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh @@ -113,10 +113,18 @@ done 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 diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix index 7db60daa60b8f..ddac69f3950c7 100644 --- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix +++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix @@ -10,7 +10,7 @@ let builderUboot = import ./uboot-builder.nix { inherit pkgs configTxt; inherit (cfg) version; }; builderGeneric = import ./raspberrypi-builder.nix { inherit pkgs configTxt; }; - builder = + builder = if cfg.uboot.enable then "${builderUboot} -g ${toString cfg.uboot.configurationLimit} -t ${timeoutStr} -c" else @@ -59,7 +59,7 @@ in version = mkOption { default = 2; - type = types.enum [ 0 1 2 3 ]; + type = types.enum [ 0 1 2 3 4 ]; description = '' ''; }; @@ -97,8 +97,8 @@ in config = mkIf cfg.enable { assertions = singleton { - assertion = !pkgs.stdenv.hostPlatform.isAarch64 || cfg.version == 3; - message = "Only Raspberry Pi 3 supports aarch64."; + assertion = !pkgs.stdenv.hostPlatform.isAarch64 || cfg.version >= 3; + message = "Only Raspberry Pi >= 3 supports aarch64."; }; system.build.installBootLoader = builder; diff --git a/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix b/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix index 9d4f8a93d282c..a683204e75150 100644 --- a/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix +++ b/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix @@ -10,11 +10,13 @@ let pkgs.ubootRaspberryPi else if version == 2 then pkgs.ubootRaspberryPi2 - else + 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 { diff --git a/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix b/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix index e64c4c09ebd91..ab4033dcd9103 100644 --- a/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix +++ b/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix @@ -2,22 +2,22 @@ stdenv.mkDerivation rec { name = "raspberrypi-wireless-firmware-${version}"; - version = "2018-08-20"; + version = "2019-08-16"; srcs = [ (fetchFromGitHub { name = "bluez-firmware"; owner = "RPi-Distro"; repo = "bluez-firmware"; - rev = "ade2bae1aaaebede09abb8fb546f767a0e4c7804"; - sha256 = "07gm76gxp5anv6paryvxcp34a86fkny8kdlzqhzcpfczzglkp6ag"; + rev = "96eefffcccc725425fd83be5e0704a5c32b79e54"; + sha256 = "05h57gcxhb2c84h99cyxxx4mzi6kd5fm8pjqkz3nq5vs3nv8cqhr"; }) (fetchFromGitHub { name = "firmware-nonfree"; owner = "RPi-Distro"; repo = "firmware-nonfree"; - rev = "b518de45ced519e8f7a499f4778100173402ae43"; - sha256 = "1d5026ic9awji6c67irpwsxpxgsc0dhn11d3abkxi2vvra1pir4g"; + rev = "130cb86fa30cafbd575d38865fa546350d4c5f9c"; + sha256 = "0jmhgbpldzz8n8lncpzwfl5ym8zgss05y952rfpwcf9v5c7vgabx"; }) ]; @@ -41,7 +41,7 @@ stdenv.mkDerivation rec { outputHashMode = "recursive"; outputHashAlgo = "sha256"; - outputHash = "1s5gb00v42s5izbaw8irs1fwvhh7z9wl07czc0nkw6p91871ivb7"; + outputHash = "1r4alf1fbj6vkkf54d0anm47ymb6gn2ykl4a2hhd34b0hnf1dnhn"; meta = with stdenv.lib; { description = "Firmware for builtin Wifi/Bluetooth devices in the Raspberry Pi 3 and Zero W"; diff --git a/pkgs/os-specific/linux/firmware/raspberrypi/default.nix b/pkgs/os-specific/linux/firmware/raspberrypi/default.nix index ebd69d1fe12b3..b0db070fd2b8c 100644 --- a/pkgs/os-specific/linux/firmware/raspberrypi/default.nix +++ b/pkgs/os-specific/linux/firmware/raspberrypi/default.nix @@ -2,13 +2,13 @@ stdenv.mkDerivation rec { pname = "raspberrypi-firmware"; - version = "1.20190620+1"; + version = "1.20190718"; src = fetchFromGitHub { owner = "raspberrypi"; repo = "firmware"; rev = version; - sha256 = "0gbqlkr50qlmbpwr0n61pb58w0k3sfjfirh2y683rlkp5rlq7mrf"; + sha256 = "1ip478igvc4y9ffgd6gaw3qln3y1y2lhwzqfz0y2srwxfpniwma4"; }; installPhase = '' diff --git a/pkgs/os-specific/linux/kernel/linux-rpi.nix b/pkgs/os-specific/linux/kernel/linux-rpi.nix index d2e1a35cb2e69..e7f8c9acc261b 100644 --- a/pkgs/os-specific/linux/kernel/linux-rpi.nix +++ b/pkgs/os-specific/linux/kernel/linux-rpi.nix @@ -1,35 +1,46 @@ -{ stdenv, lib, buildPackages, fetchFromGitHub, perl, buildLinux, ... } @ args: +{ stdenv, lib, buildPackages, fetchFromGitHub, perl, buildLinux, rpiVersion, ... } @ args: let - modDirVersion = "4.14.98"; - tag = "1.20190215"; + modDirVersion = "4.19.66"; in -lib.overrideDerivation (buildLinux (args // rec { - version = "${modDirVersion}-${tag}"; +lib.overrideDerivation (buildLinux (args // { + version = "${modDirVersion}-20190817"; inherit modDirVersion; - + # It seems like the sed below should fix this, and does something similar for + # -v7. I can't figure out why it doesn't. This works, though. + #modDirVersion = version + lib.optionalString + # (stdenv.hostPlatform.system == "aarch64-linux") "-v8"; src = fetchFromGitHub { - owner = "raspberrypi"; + owner = "yaroslavros"; repo = "linux"; - rev = "raspberrypi-kernel_${tag}-1"; - sha256 = "1gc4x7p82m2v1jhahhyl7qfdkflj71ly6p0fpc1vf9sk13hbwgj2"; + rev = "5adf84b5522b0cf14f6d1832379105c4482cad7d"; + sha256 = "0phv96krc8l1wd1lb5qkfq8bmmy7baypxlqsb9slqwm00b6s2lrr"; }; defconfig = { - "armv6l-linux" = "bcmrpi_defconfig"; - "armv7l-linux" = "bcm2709_defconfig"; - "aarch64-linux" = "bcmrpi3_defconfig"; - }.${stdenv.hostPlatform.system} or (throw "linux_rpi not supported on '${stdenv.hostPlatform.system}'"); + "0" = "bcmrpi_defconfig"; + "1" = "bcmrpi_defconfig"; + "2" = "bcm2709_defconfig"; + "3" = "bcmrpi3_defconfig"; + "4" = "bcm2711_defconfig"; + }.${toString rpiVersion}; features = { efiBootStub = false; } // (args.features or {}); - extraMeta.hydraPlatforms = [ "aarch64-linux" ]; -} // (args.argsOverride or {}))) (oldAttrs: { + extraMeta = if (rpiVersion < 3) then { + platforms = with lib.platforms; [ arm ]; + hydraPlatforms = []; + } else { + platforms = with lib.platforms; [ arm aarch64 ]; + hydraPlatforms = [ "aarch64-linux" ]; + }; +})) (oldAttrs: { postConfigure = '' # The v7 defconfig has this set to '-v7' which screws up our modDirVersion. sed -i $buildRoot/.config -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/' + sed -i $buildRoot/include/config/auto.conf -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/' ''; # Make copies of the DTBs named after the upstream names so that U-Boot finds them. @@ -56,5 +67,6 @@ lib.overrideDerivation (buildLinux (args // rec { copyDTB bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb copyDTB bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb + copyDTB bcm2711-rpi-4-b.dtb bcm2838-rpi-4-b.dtb ''; }) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c1a97f5ea1d4c..aa80d9eea7964 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15569,10 +15569,39 @@ in kernelPatches = linux_4_19.kernelPatches; }; - linux_rpi = callPackage ../os-specific/linux/kernel/linux-rpi.nix { + linux_rpi0 = callPackage ../os-specific/linux/kernel/linux-rpi.nix { kernelPatches = with kernelPatches; [ bridge_stp_helper ]; + rpiVersion = 0; + }; + + linux_rpi1 = callPackage ../os-specific/linux/kernel/linux-rpi.nix { + kernelPatches = with kernelPatches; [ + bridge_stp_helper + ]; + rpiVersion = 1; + }; + + linux_rpi2 = callPackage ../os-specific/linux/kernel/linux-rpi.nix { + kernelPatches = with kernelPatches; [ + bridge_stp_helper + ]; + rpiVersion = 2; + }; + + linux_rpi3 = callPackage ../os-specific/linux/kernel/linux-rpi.nix { + kernelPatches = with kernelPatches; [ + bridge_stp_helper + ]; + rpiVersion = 3; + }; + + linux_rpi4 = callPackage ../os-specific/linux/kernel/linux-rpi.nix { + kernelPatches = with kernelPatches; [ + bridge_stp_helper + ]; + rpiVersion = 4; }; linux_4_4 = callPackage ../os-specific/linux/kernel/linux-4.4.nix { @@ -15827,7 +15856,11 @@ in # Build the kernel modules for the some of the kernels. linuxPackages_mptcp = linuxPackagesFor pkgs.linux_mptcp; - linuxPackages_rpi = linuxPackagesFor pkgs.linux_rpi; + linuxPackages_rpi0 = linuxPackagesFor pkgs.linux_rpi0; + linuxPackages_rpi1 = linuxPackagesFor pkgs.linux_rpi1; + linuxPackages_rpi2 = linuxPackagesFor pkgs.linux_rpi2; + linuxPackages_rpi3 = linuxPackagesFor pkgs.linux_rpi3; + linuxPackages_rpi4 = linuxPackagesFor pkgs.linux_rpi4; linuxPackages_4_4 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_4); linuxPackages_4_9 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_9); linuxPackages_4_14 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_14);