Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

Various: Add support for raspberry pi 4.

+112 -29
+1 -1
nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix
··· 19 boot.loader.generic-extlinux-compatible.enable = true; 20 21 boot.consoleLogLevel = lib.mkDefault 7; 22 - boot.kernelPackages = pkgs.linuxPackages_rpi; 23 24 sdImage = { 25 populateFirmwareCommands = let
··· 19 boot.loader.generic-extlinux-compatible.enable = true; 20 21 boot.consoleLogLevel = lib.mkDefault 7; 22 + boot.kernelPackages = pkgs.linuxPackages_rpi1; 23 24 sdImage = { 25 populateFirmwareCommands = let
+31
nixos/modules/installer/cd-dvd/sd-image-raspberrypi4.nix
···
··· 1 + # To build, use: 2 + # nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-raspberrypi4.nix -A config.system.build.sdImage 3 + { config, lib, pkgs, ... }: 4 + 5 + { 6 + imports = [ 7 + ../../profiles/base.nix 8 + ../../profiles/installation-device.nix 9 + ./sd-image.nix 10 + ]; 11 + 12 + boot.loader.grub.enable = false; 13 + boot.loader.raspberryPi.enable = true; 14 + boot.loader.raspberryPi.version = 4; 15 + boot.kernelPackages = pkgs.linuxPackages_rpi4; 16 + 17 + boot.consoleLogLevel = lib.mkDefault 7; 18 + 19 + sdImage = { 20 + firmwareSize = 128; 21 + # This is a hack to avoid replicating config.txt from boot.loader.raspberryPi 22 + populateFirmwareCommands = 23 + "${config.system.build.installBootLoader} ${config.system.build.toplevel} -d ./firmware"; 24 + # As the boot process is done entirely in the firmware partition. 25 + populateRootCommands = ""; 26 + }; 27 + 28 + # the installation media is also the installation target, 29 + # so we don't want to provide the installation configuration.nix. 30 + installer.cloneConfig = false; 31 + }
+9 -1
nixos/modules/system/boot/loader/raspberrypi/raspberrypi-builder.sh
··· 71 72 local kernel=$(readlink -f $path/kernel) 73 local initrd=$(readlink -f $path/initrd) 74 - local dtb_path=$(readlink -f $path/kernel-modules/dtbs) 75 76 if test -n "@copyKernels@"; then 77 copyToKernelsDir $kernel; kernel=$result ··· 113 fwdir=@firmware@/share/raspberrypi/boot/ 114 copyForced $fwdir/bootcode.bin $target/bootcode.bin 115 copyForced $fwdir/fixup.dat $target/fixup.dat 116 copyForced $fwdir/fixup_cd.dat $target/fixup_cd.dat 117 copyForced $fwdir/fixup_db.dat $target/fixup_db.dat 118 copyForced $fwdir/fixup_x.dat $target/fixup_x.dat 119 copyForced $fwdir/start.elf $target/start.elf 120 copyForced $fwdir/start_cd.elf $target/start_cd.elf 121 copyForced $fwdir/start_db.elf $target/start_db.elf 122 copyForced $fwdir/start_x.elf $target/start_x.elf
··· 71 72 local kernel=$(readlink -f $path/kernel) 73 local initrd=$(readlink -f $path/initrd) 74 + local dtb_path=$(readlink -f $path/dtbs) 75 76 if test -n "@copyKernels@"; then 77 copyToKernelsDir $kernel; kernel=$result ··· 113 fwdir=@firmware@/share/raspberrypi/boot/ 114 copyForced $fwdir/bootcode.bin $target/bootcode.bin 115 copyForced $fwdir/fixup.dat $target/fixup.dat 116 + copyForced $fwdir/fixup4.dat $target/fixup4.dat 117 + copyForced $fwdir/fixup4cd.dat $target/fixup4cd.dat 118 + copyForced $fwdir/fixup4db.dat $target/fixup4db.dat 119 + copyForced $fwdir/fixup4x.dat $target/fixup4x.dat 120 copyForced $fwdir/fixup_cd.dat $target/fixup_cd.dat 121 copyForced $fwdir/fixup_db.dat $target/fixup_db.dat 122 copyForced $fwdir/fixup_x.dat $target/fixup_x.dat 123 copyForced $fwdir/start.elf $target/start.elf 124 + copyForced $fwdir/start4.elf $target/start4.elf 125 + copyForced $fwdir/start4cd.elf $target/start4cd.elf 126 + copyForced $fwdir/start4db.elf $target/start4db.elf 127 + copyForced $fwdir/start4x.elf $target/start4x.elf 128 copyForced $fwdir/start_cd.elf $target/start_cd.elf 129 copyForced $fwdir/start_db.elf $target/start_db.elf 130 copyForced $fwdir/start_x.elf $target/start_x.elf
+3 -3
nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
··· 59 60 version = mkOption { 61 default = 2; 62 - type = types.enum [ 0 1 2 3 ]; 63 description = '' 64 ''; 65 }; ··· 97 98 config = mkIf cfg.enable { 99 assertions = singleton { 100 - assertion = !pkgs.stdenv.hostPlatform.isAarch64 || cfg.version == 3; 101 - message = "Only Raspberry Pi 3 supports aarch64."; 102 }; 103 104 system.build.installBootLoader = builder;
··· 59 60 version = mkOption { 61 default = 2; 62 + type = types.enum [ 0 1 2 3 4 ]; 63 description = '' 64 ''; 65 }; ··· 97 98 config = mkIf cfg.enable { 99 assertions = singleton { 100 + assertion = !pkgs.stdenv.hostPlatform.isAarch64 || cfg.version >= 3; 101 + message = "Only Raspberry Pi >= 3 supports aarch64."; 102 }; 103 104 system.build.installBootLoader = builder;
+4 -2
nixos/modules/system/boot/loader/raspberrypi/uboot-builder.nix
··· 10 pkgs.ubootRaspberryPi 11 else if version == 2 then 12 pkgs.ubootRaspberryPi2 13 - else 14 if isAarch64 then 15 pkgs.ubootRaspberryPi3_64bit 16 else 17 - pkgs.ubootRaspberryPi3_32bit; 18 19 extlinuxConfBuilder = 20 import ../generic-extlinux-compatible/extlinux-conf-builder.nix {
··· 10 pkgs.ubootRaspberryPi 11 else if version == 2 then 12 pkgs.ubootRaspberryPi2 13 + else if version == 3 then 14 if isAarch64 then 15 pkgs.ubootRaspberryPi3_64bit 16 else 17 + pkgs.ubootRaspberryPi3_32bit 18 + else 19 + throw "U-Boot is not yet supported on the raspberry pi 4."; 20 21 extlinuxConfBuilder = 22 import ../generic-extlinux-compatible/extlinux-conf-builder.nix {
+5
nixos/release.nix
··· 180 inherit system; 181 }); 182 183 # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF). 184 ova = forMatchingSystems [ "x86_64-linux" ] (system: 185
··· 180 inherit system; 181 }); 182 183 + sd_image_raspberrypi4 = forMatchingSystems [ "aarch64-linux" ] (system: makeSdImage { 184 + module = ./modules/installer/cd-dvd/sd-image-raspberrypi4.nix; 185 + inherit system; 186 + }); 187 + 188 # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF). 189 ova = forMatchingSystems [ "x86_64-linux" ] (system: 190
+2 -1
pkgs/os-specific/linux/device-tree/raspberrypi.nix
··· 11 12 cp ${raspberrypifw}/share/raspberrypi/boot/bcm*.dtb . 13 14 - cp bcm2708-rpi-0-w.dtb bcm2835-rpi-zero-w.dtb 15 cp bcm2708-rpi-b.dtb bcm2835-rpi-a.dtb 16 cp bcm2708-rpi-b.dtb bcm2835-rpi-b.dtb 17 cp bcm2708-rpi-b.dtb bcm2835-rpi-b-rev2.dtb ··· 23 cp bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb 24 cp bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb 25 cp bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb 26 ''; 27 28 passthru = {
··· 11 12 cp ${raspberrypifw}/share/raspberrypi/boot/bcm*.dtb . 13 14 + cp bcm2708-rpi-zero-w.dtb bcm2835-rpi-zero-w.dtb 15 cp bcm2708-rpi-b.dtb bcm2835-rpi-a.dtb 16 cp bcm2708-rpi-b.dtb bcm2835-rpi-b.dtb 17 cp bcm2708-rpi-b.dtb bcm2835-rpi-b-rev2.dtb ··· 23 cp bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb 24 cp bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb 25 cp bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb 26 + cp bcm2711-rpi-4-b.dtb bcm2838-rpi-4-b.dtb 27 ''; 28 29 passthru = {
+6 -6
pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix
··· 2 3 stdenv.mkDerivation { 4 pname = "raspberrypi-wireless-firmware"; 5 - version = "2018-08-20"; 6 7 srcs = [ 8 (fetchFromGitHub { 9 name = "bluez-firmware"; 10 owner = "RPi-Distro"; 11 repo = "bluez-firmware"; 12 - rev = "ade2bae1aaaebede09abb8fb546f767a0e4c7804"; 13 - sha256 = "07gm76gxp5anv6paryvxcp34a86fkny8kdlzqhzcpfczzglkp6ag"; 14 }) 15 (fetchFromGitHub { 16 name = "firmware-nonfree"; 17 owner = "RPi-Distro"; 18 repo = "firmware-nonfree"; 19 - rev = "b518de45ced519e8f7a499f4778100173402ae43"; 20 - sha256 = "1d5026ic9awji6c67irpwsxpxgsc0dhn11d3abkxi2vvra1pir4g"; 21 }) 22 ]; 23 ··· 41 42 outputHashMode = "recursive"; 43 outputHashAlgo = "sha256"; 44 - outputHash = "1s5gb00v42s5izbaw8irs1fwvhh7z9wl07czc0nkw6p91871ivb7"; 45 46 meta = with stdenv.lib; { 47 description = "Firmware for builtin Wifi/Bluetooth devices in the Raspberry Pi 3 and Zero W";
··· 2 3 stdenv.mkDerivation { 4 pname = "raspberrypi-wireless-firmware"; 5 + version = "2019-08-16"; 6 7 srcs = [ 8 (fetchFromGitHub { 9 name = "bluez-firmware"; 10 owner = "RPi-Distro"; 11 repo = "bluez-firmware"; 12 + rev = "96eefffcccc725425fd83be5e0704a5c32b79e54"; 13 + sha256 = "05h57gcxhb2c84h99cyxxx4mzi6kd5fm8pjqkz3nq5vs3nv8cqhr"; 14 }) 15 (fetchFromGitHub { 16 name = "firmware-nonfree"; 17 owner = "RPi-Distro"; 18 repo = "firmware-nonfree"; 19 + rev = "130cb86fa30cafbd575d38865fa546350d4c5f9c"; 20 + sha256 = "0jmhgbpldzz8n8lncpzwfl5ym8zgss05y952rfpwcf9v5c7vgabx"; 21 }) 22 ]; 23 ··· 41 42 outputHashMode = "recursive"; 43 outputHashAlgo = "sha256"; 44 + outputHash = "1r4alf1fbj6vkkf54d0anm47ymb6gn2ykl4a2hhd34b0hnf1dnhn"; 45 46 meta = with stdenv.lib; { 47 description = "Firmware for builtin Wifi/Bluetooth devices in the Raspberry Pi 3 and Zero W";
+2 -2
pkgs/os-specific/linux/firmware/raspberrypi/default.nix
··· 2 3 stdenv.mkDerivation rec { 4 pname = "raspberrypi-firmware"; 5 - version = "1.20190620+1"; 6 7 src = fetchFromGitHub { 8 owner = "raspberrypi"; 9 repo = "firmware"; 10 rev = version; 11 - sha256 = "0gbqlkr50qlmbpwr0n61pb58w0k3sfjfirh2y683rlkp5rlq7mrf"; 12 }; 13 14 installPhase = ''
··· 2 3 stdenv.mkDerivation rec { 4 pname = "raspberrypi-firmware"; 5 + version = "1.20190819"; 6 7 src = fetchFromGitHub { 8 owner = "raspberrypi"; 9 repo = "firmware"; 10 rev = version; 11 + sha256 = "0qzpc092qg748i5s23xa1jk6qpga9wn0441r2awsz0apkysqx5fj"; 12 }; 13 14 installPhase = ''
+20 -11
pkgs/os-specific/linux/kernel/linux-rpi.nix
··· 1 - { stdenv, lib, buildPackages, fetchFromGitHub, perl, buildLinux, ... } @ args: 2 3 let 4 - modDirVersion = "4.14.98"; 5 - tag = "1.20190215"; 6 in 7 lib.overrideDerivation (buildLinux (args // { 8 version = "${modDirVersion}-${tag}"; ··· 11 src = fetchFromGitHub { 12 owner = "raspberrypi"; 13 repo = "linux"; 14 - rev = "raspberrypi-kernel_${tag}-1"; 15 - sha256 = "1gc4x7p82m2v1jhahhyl7qfdkflj71ly6p0fpc1vf9sk13hbwgj2"; 16 }; 17 18 defconfig = { 19 - armv6l-linux = "bcmrpi_defconfig"; 20 - armv7l-linux = "bcm2709_defconfig"; 21 - aarch64-linux = "bcmrpi3_defconfig"; 22 - }.${stdenv.hostPlatform.system} or (throw "linux_rpi not supported on '${stdenv.hostPlatform.system}'"); 23 24 features = { 25 efiBootStub = false; 26 } // (args.features or {}); 27 28 - extraMeta.hydraPlatforms = [ "aarch64-linux" ]; 29 - } // (args.argsOverride or {}))) (oldAttrs: { 30 postConfigure = '' 31 # The v7 defconfig has this set to '-v7' which screws up our modDirVersion. 32 sed -i $buildRoot/.config -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/' 33 ''; 34 35 # Make copies of the DTBs named after the upstream names so that U-Boot finds them. ··· 56 copyDTB bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb 57 copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb 58 copyDTB bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb 59 ''; 60 })
··· 1 + { stdenv, lib, buildPackages, fetchFromGitHub, perl, buildLinux, rpiVersion, ... } @ args: 2 3 let 4 + modDirVersion = "4.19.71"; 5 + tag = "1.20190906"; 6 in 7 lib.overrideDerivation (buildLinux (args // { 8 version = "${modDirVersion}-${tag}"; ··· 11 src = fetchFromGitHub { 12 owner = "raspberrypi"; 13 repo = "linux"; 14 + rev = "9532eb3c84d8d952ef28da3d135683ac01adc9b8"; 15 + sha256 = "0168wz8kkdzbyha41iqlgn1z1kcy4smg89rgxkgadzq78y7fglpl"; 16 }; 17 18 defconfig = { 19 + "1" = "bcmrpi_defconfig"; 20 + "2" = "bcm2709_defconfig"; 21 + "3" = "bcmrpi3_defconfig"; 22 + "4" = "bcm2711_defconfig"; 23 + }.${toString rpiVersion}; 24 25 features = { 26 efiBootStub = false; 27 } // (args.features or {}); 28 29 + extraMeta = if (rpiVersion < 3) then { 30 + platforms = with lib.platforms; [ arm ]; 31 + hydraPlatforms = []; 32 + } else { 33 + platforms = with lib.platforms; [ arm aarch64 ]; 34 + hydraPlatforms = [ "aarch64-linux" ]; 35 + }; 36 + })) (oldAttrs: { 37 postConfigure = '' 38 # The v7 defconfig has this set to '-v7' which screws up our modDirVersion. 39 sed -i $buildRoot/.config -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/' 40 + sed -i $buildRoot/include/config/auto.conf -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/' 41 ''; 42 43 # Make copies of the DTBs named after the upstream names so that U-Boot finds them. ··· 64 copyDTB bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb 65 copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb 66 copyDTB bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb 67 + copyDTB bcm2711-rpi-4-b.dtb bcm2838-rpi-4-b.dtb 68 ''; 69 })
+2
pkgs/top-level/aliases.nix
··· 194 libtidy = html-tidy; # added 2014-12-21 195 libudev = udev; # added 2018-04-25 196 links = links2; # added 2016-01-31 197 lttngTools = lttng-tools; # added 2014-07-31 198 lttngUst = lttng-ust; # added 2014-07-31 199 lua5_1_sockets = lua51Packages.luasocket; # added 2017-05-02
··· 194 libtidy = html-tidy; # added 2014-12-21 195 libudev = udev; # added 2018-04-25 196 links = links2; # added 2016-01-31 197 + linux_rpi0 = linux_rpi1; 198 + linuxPackages_rpi0 = linuxPackages_rpi1; 199 lttngTools = lttng-tools; # added 2014-07-31 200 lttngUst = lttng-ust; # added 2014-07-31 201 lua5_1_sockets = lua51Packages.luasocket; # added 2017-05-02
+27 -2
pkgs/top-level/all-packages.nix
··· 15692 kernelPatches = linux_4_19.kernelPatches; 15693 }; 15694 15695 - linux_rpi = callPackage ../os-specific/linux/kernel/linux-rpi.nix { 15696 kernelPatches = with kernelPatches; [ 15697 bridge_stp_helper 15698 ]; 15699 }; 15700 15701 linux_4_4 = callPackage ../os-specific/linux/kernel/linux-4.4.nix { ··· 15945 15946 # Build the kernel modules for the some of the kernels. 15947 linuxPackages_mptcp = linuxPackagesFor pkgs.linux_mptcp; 15948 - linuxPackages_rpi = linuxPackagesFor pkgs.linux_rpi; 15949 linuxPackages_4_4 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_4); 15950 linuxPackages_4_9 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_9); 15951 linuxPackages_4_14 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_14);
··· 15692 kernelPatches = linux_4_19.kernelPatches; 15693 }; 15694 15695 + linux_rpi1 = callPackage ../os-specific/linux/kernel/linux-rpi.nix { 15696 kernelPatches = with kernelPatches; [ 15697 bridge_stp_helper 15698 ]; 15699 + rpiVersion = 1; 15700 + }; 15701 + 15702 + linux_rpi2 = callPackage ../os-specific/linux/kernel/linux-rpi.nix { 15703 + kernelPatches = with kernelPatches; [ 15704 + bridge_stp_helper 15705 + ]; 15706 + rpiVersion = 2; 15707 + }; 15708 + 15709 + linux_rpi3 = callPackage ../os-specific/linux/kernel/linux-rpi.nix { 15710 + kernelPatches = with kernelPatches; [ 15711 + bridge_stp_helper 15712 + ]; 15713 + rpiVersion = 3; 15714 + }; 15715 + 15716 + linux_rpi4 = callPackage ../os-specific/linux/kernel/linux-rpi.nix { 15717 + kernelPatches = with kernelPatches; [ 15718 + bridge_stp_helper 15719 + ]; 15720 + rpiVersion = 4; 15721 }; 15722 15723 linux_4_4 = callPackage ../os-specific/linux/kernel/linux-4.4.nix { ··· 15967 15968 # Build the kernel modules for the some of the kernels. 15969 linuxPackages_mptcp = linuxPackagesFor pkgs.linux_mptcp; 15970 + linuxPackages_rpi1 = linuxPackagesFor pkgs.linux_rpi1; 15971 + linuxPackages_rpi2 = linuxPackagesFor pkgs.linux_rpi2; 15972 + linuxPackages_rpi3 = linuxPackagesFor pkgs.linux_rpi3; 15973 + linuxPackages_rpi4 = linuxPackagesFor pkgs.linux_rpi4; 15974 linuxPackages_4_4 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_4); 15975 linuxPackages_4_9 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_9); 15976 linuxPackages_4_14 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_14);