at master 106 lines 3.4 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 buildLinux, 6 rpiVersion, 7 ... 8}@args: 9 10let 11 # NOTE: raspberrypifw & raspberryPiWirelessFirmware should be updated with this 12 modDirVersion = "6.12.34"; 13 tag = "stable_20250702"; 14 hash = "sha256-lK0esjFhLvtBbyddMfa1H7ZcBbcOm2ygor338ZT5VpI="; 15in 16lib.overrideDerivation 17 (buildLinux ( 18 args 19 // { 20 version = "${modDirVersion}-${tag}"; 21 inherit modDirVersion; 22 pname = "linux-rpi"; 23 24 src = fetchFromGitHub { 25 owner = "raspberrypi"; 26 repo = "linux"; 27 inherit tag hash; 28 }; 29 30 defconfig = 31 { 32 "1" = "bcmrpi_defconfig"; 33 "2" = "bcm2709_defconfig"; 34 "3" = if stdenv.hostPlatform.isAarch64 then "bcm2711_defconfig" else "bcm2709_defconfig"; 35 "4" = "bcm2711_defconfig"; 36 } 37 .${toString rpiVersion}; 38 39 features = { 40 efiBootStub = false; 41 } 42 // (args.features or { }); 43 44 isLTS = true; 45 46 extraMeta = 47 if (rpiVersion < 3) then 48 { 49 platforms = with lib.platforms; lib.intersectLists arm linux; 50 hydraPlatforms = [ ]; 51 } 52 else 53 { 54 platforms = with lib.platforms; lib.intersectLists (arm ++ aarch64) linux; 55 hydraPlatforms = [ "aarch64-linux" ]; 56 }; 57 ignoreConfigErrors = true; 58 } 59 // (args.argsOverride or { }) 60 )) 61 (oldAttrs: { 62 postConfigure = '' 63 # The v7 defconfig has this set to '-v7' which screws up our modDirVersion. 64 sed -i $buildRoot/.config -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/' 65 sed -i $buildRoot/include/config/auto.conf -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/' 66 ''; 67 68 # Make copies of the DTBs named after the upstream names so that U-Boot finds them. 69 # This is ugly as heck, but I don't know a better solution so far. 70 postFixup = '' 71 dtbDir=${if stdenv.hostPlatform.isAarch64 then "$out/dtbs/broadcom" else "$out/dtbs"} 72 rm $dtbDir/bcm283*.dtb 73 copyDTB() { 74 cp -v "$dtbDir/$1" "$dtbDir/$2" 75 } 76 '' 77 + lib.optionalString (lib.elem stdenv.hostPlatform.system [ "armv6l-linux" ]) '' 78 copyDTB bcm2708-rpi-zero-w.dtb bcm2835-rpi-zero.dtb 79 copyDTB bcm2708-rpi-zero-w.dtb bcm2835-rpi-zero-w.dtb 80 copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-a.dtb 81 copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b.dtb 82 copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b-rev2.dtb 83 copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-a-plus.dtb 84 copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-b-plus.dtb 85 copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-zero.dtb 86 copyDTB bcm2708-rpi-cm.dtb bcm2835-rpi-cm.dtb 87 '' 88 + lib.optionalString (lib.elem stdenv.hostPlatform.system [ "armv7l-linux" ]) '' 89 copyDTB bcm2709-rpi-2-b.dtb bcm2836-rpi-2-b.dtb 90 '' 91 + 92 lib.optionalString 93 (lib.elem stdenv.hostPlatform.system [ 94 "armv7l-linux" 95 "aarch64-linux" 96 ]) 97 '' 98 copyDTB bcm2710-rpi-zero-2.dtb bcm2837-rpi-zero-2.dtb 99 copyDTB bcm2710-rpi-zero-2-w.dtb bcm2837-rpi-zero-2-w.dtb 100 copyDTB bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb 101 copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-a-plus.dtb 102 copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb 103 copyDTB bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb 104 copyDTB bcm2711-rpi-4-b.dtb bcm2838-rpi-4-b.dtb 105 ''; 106 })