Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 886 lines 26 kB view raw
1{ 2 stdenv, 3 lib, 4 bc, 5 bison, 6 dtc, 7 fetchFromGitHub, 8 fetchpatch, 9 fetchurl, 10 flex, 11 gnutls, 12 installShellFiles, 13 libuuid, 14 meson-tools, 15 ncurses, 16 openssl, 17 rkbin, 18 swig, 19 which, 20 python3, 21 perl, 22 armTrustedFirmwareAllwinner, 23 armTrustedFirmwareAllwinnerH6, 24 armTrustedFirmwareAllwinnerH616, 25 armTrustedFirmwareRK3328, 26 armTrustedFirmwareRK3399, 27 armTrustedFirmwareRK3568, 28 armTrustedFirmwareRK3588, 29 armTrustedFirmwareS905, 30 opensbi, 31 buildPackages, 32 darwin, 33}@pkgs: 34 35let 36 defaultVersion = "2025.07"; 37 defaultSrc = fetchurl { 38 url = "https://ftp.denx.de/pub/u-boot/u-boot-${defaultVersion}.tar.bz2"; 39 hash = "sha256-D5M/bFpCaJW/MG6T5qxTxghw5LVM2lbZUhG+yZ5jvsc="; 40 }; 41 42 # Dependencies for the tools need to be included as either native or cross, 43 # depending on which we're building 44 toolsDeps = [ 45 ncurses # tools/kwboot 46 libuuid # tools/mkeficapsule 47 gnutls # tools/mkeficapsule 48 openssl # tools/mkimage and tools/env/fw_printenv 49 ]; 50 51 buildUBoot = lib.makeOverridable ( 52 { 53 version ? null, 54 src ? null, 55 filesToInstall, 56 pythonScriptsToInstall ? { }, 57 installDir ? "$out", 58 defconfig, 59 extraConfig ? "", 60 extraPatches ? [ ], 61 extraMakeFlags ? [ ], 62 extraMeta ? { }, 63 crossTools ? false, 64 stdenv ? pkgs.stdenv, 65 ... 66 }@args: 67 stdenv.mkDerivation ( 68 { 69 pname = "uboot-${defconfig}"; 70 71 version = if src == null then defaultVersion else version; 72 73 src = if src == null then defaultSrc else src; 74 75 patches = extraPatches; 76 77 postPatch = '' 78 ${lib.concatMapStrings (script: '' 79 substituteInPlace ${script} \ 80 --replace "#!/usr/bin/env python3" "#!${pythonScriptsToInstall.${script}}/bin/python3" 81 '') (builtins.attrNames pythonScriptsToInstall)} 82 patchShebangs tools 83 patchShebangs scripts 84 ''; 85 86 nativeBuildInputs = [ 87 ncurses # tools/kwboot 88 bc 89 bison 90 flex 91 installShellFiles 92 (buildPackages.python3.withPackages (p: [ 93 p.libfdt 94 p.setuptools # for pkg_resources 95 p.pyelftools 96 ])) 97 swig 98 which # for scripts/dtc-version.sh 99 perl # for oid build (secureboot) 100 ] 101 ++ lib.optionals (!crossTools) toolsDeps 102 ++ lib.optionals stdenv.buildPlatform.isDarwin [ darwin.DarwinTools ]; # sw_vers command is needed on darwin 103 depsBuildBuild = [ buildPackages.gccStdenv.cc ]; # gccStdenv is needed for Darwin buildPlatform 104 buildInputs = lib.optionals crossTools toolsDeps; 105 106 hardeningDisable = [ "all" ]; 107 108 enableParallelBuilding = true; 109 110 makeFlags = [ 111 "DTC=${lib.getExe buildPackages.dtc}" 112 "CROSS_COMPILE=${stdenv.cc.targetPrefix}" 113 "HOSTCFLAGS=-fcommon" 114 ] 115 ++ extraMakeFlags; 116 117 passAsFile = [ "extraConfig" ]; 118 119 configurePhase = '' 120 runHook preConfigure 121 122 make -j$NIX_BUILD_CORES ${defconfig} 123 124 cat $extraConfigPath >> .config 125 126 runHook postConfigure 127 ''; 128 129 installPhase = '' 130 runHook preInstall 131 132 mkdir -p ${installDir} 133 cp ${ 134 lib.concatStringsSep " " (filesToInstall ++ builtins.attrNames pythonScriptsToInstall) 135 } ${installDir} 136 137 mkdir -p "$out/nix-support" 138 ${lib.concatMapStrings (file: '' 139 echo "file binary-dist ${installDir}/${builtins.baseNameOf file}" >> "$out/nix-support/hydra-build-products" 140 '') (filesToInstall ++ builtins.attrNames pythonScriptsToInstall)} 141 142 runHook postInstall 143 ''; 144 145 dontStrip = true; 146 147 meta = 148 with lib; 149 { 150 homepage = "https://www.denx.de/wiki/U-Boot/"; 151 description = "Boot loader for embedded systems"; 152 license = licenses.gpl2Plus; 153 maintainers = with maintainers; [ 154 dezgeg 155 lopsided98 156 ]; 157 } 158 // extraMeta; 159 } 160 // removeAttrs args [ 161 "extraMeta" 162 "pythonScriptsToInstall" 163 ] 164 ) 165 ); 166in 167{ 168 inherit buildUBoot; 169 170 ubootTools = buildUBoot { 171 defconfig = "tools-only_defconfig"; 172 installDir = "$out/bin"; 173 hardeningDisable = [ ]; 174 dontStrip = false; 175 extraMeta.platforms = lib.platforms.linux; 176 177 crossTools = true; 178 extraMakeFlags = [ 179 "HOST_TOOLS_ALL=y" 180 "NO_SDL=1" 181 "cross_tools" 182 "envtools" 183 ]; 184 185 outputs = [ 186 "out" 187 "man" 188 ]; 189 190 postInstall = '' 191 installManPage doc/*.1 192 193 # from u-boot's tools/env/README: 194 # "You should then create a symlink from fw_setenv to fw_printenv. They 195 # use the same program and its function depends on its basename." 196 ln -s $out/bin/fw_printenv $out/bin/fw_setenv 197 ''; 198 199 filesToInstall = [ 200 "tools/dumpimage" 201 "tools/fdtgrep" 202 "tools/kwboot" 203 "tools/mkenvimage" 204 "tools/mkimage" 205 "tools/env/fw_printenv" 206 ]; 207 208 pythonScriptsToInstall = { 209 "tools/efivar.py" = (python3.withPackages (ps: [ ps.pyopenssl ])); 210 }; 211 }; 212 213 ubootA20OlinuxinoLime = buildUBoot { 214 defconfig = "A20-OLinuXino-Lime_defconfig"; 215 extraMeta.platforms = [ "armv7l-linux" ]; 216 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 217 }; 218 219 ubootA20OlinuxinoLime2EMMC = buildUBoot { 220 defconfig = "A20-OLinuXino-Lime2-eMMC_defconfig"; 221 extraMeta.platforms = [ "armv7l-linux" ]; 222 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 223 }; 224 225 ubootAmx335xEVM = buildUBoot { 226 defconfig = "am335x_evm_defconfig"; 227 extraMeta = { 228 platforms = [ "armv7l-linux" ]; 229 broken = true; # too big, exceeds memory size 230 }; 231 filesToInstall = [ 232 "MLO" 233 "u-boot.img" 234 ]; 235 }; 236 237 ubootBananaPi = buildUBoot { 238 defconfig = "Bananapi_defconfig"; 239 extraMeta.platforms = [ "armv7l-linux" ]; 240 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 241 }; 242 243 ubootBananaPim3 = buildUBoot { 244 defconfig = "Sinovoip_BPI_M3_defconfig"; 245 extraMeta.platforms = [ "armv7l-linux" ]; 246 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 247 }; 248 249 ubootBananaPim64 = buildUBoot { 250 defconfig = "bananapi_m64_defconfig"; 251 extraMeta.platforms = [ "aarch64-linux" ]; 252 BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin"; 253 SCP = "/dev/null"; 254 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 255 }; 256 257 # http://git.denx.de/?p=u-boot.git;a=blob;f=board/solidrun/clearfog/README;hb=refs/heads/master 258 ubootClearfog = buildUBoot { 259 defconfig = "clearfog_defconfig"; 260 extraMeta.platforms = [ "armv7l-linux" ]; 261 filesToInstall = [ "u-boot-with-spl.kwb" ]; 262 }; 263 264 ubootCM3588NAS = buildUBoot { 265 defconfig = "cm3588-nas-rk3588_defconfig"; 266 extraMeta.platforms = [ "aarch64-linux" ]; 267 BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 268 ROCKCHIP_TPL = rkbin.TPL_RK3588; 269 filesToInstall = [ 270 "u-boot.itb" 271 "idbloader.img" 272 "u-boot-rockchip.bin" 273 ]; 274 }; 275 276 ubootCubieboard2 = buildUBoot { 277 defconfig = "Cubieboard2_defconfig"; 278 extraMeta.platforms = [ "armv7l-linux" ]; 279 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 280 }; 281 282 ubootGuruplug = buildUBoot { 283 defconfig = "guruplug_defconfig"; 284 extraMeta.platforms = [ "armv5tel-linux" ]; 285 filesToInstall = [ "u-boot.bin" ]; 286 }; 287 288 ubootJetsonTK1 = buildUBoot { 289 defconfig = "jetson-tk1_defconfig"; 290 extraMeta.platforms = [ "armv7l-linux" ]; 291 filesToInstall = [ 292 "u-boot" 293 "u-boot.dtb" 294 "u-boot-dtb-tegra.bin" 295 "u-boot-nodtb-tegra.bin" 296 ]; 297 # tegra-uboot-flasher expects this exact directory layout, sigh... 298 postInstall = '' 299 mkdir -p $out/spl 300 cp spl/u-boot-spl $out/spl/ 301 ''; 302 }; 303 304 # Flashing instructions: 305 # dd if=u-boot.gxl.sd.bin of=<sdcard> conv=fsync,notrunc bs=512 skip=1 seek=1 306 # dd if=u-boot.gxl.sd.bin of=<sdcard> conv=fsync,notrunc bs=1 count=444 307 ubootLibreTechCC = 308 let 309 firmwareImagePkg = fetchFromGitHub { 310 owner = "LibreELEC"; 311 repo = "amlogic-boot-fip"; 312 rev = "4369a138ca24c5ab932b8cbd1af4504570b709df"; 313 sha256 = "sha256-mGRUwdh3nW4gBwWIYHJGjzkezHxABwcwk/1gVRis7Tc="; 314 meta.license = lib.licenses.unfreeRedistributableFirmware; 315 }; 316 in 317 buildUBoot { 318 defconfig = "libretech-cc_defconfig"; 319 extraMeta = { 320 broken = stdenv.buildPlatform.system != "x86_64-linux"; # aml_encrypt_gxl is a x86_64 binary 321 platforms = [ "aarch64-linux" ]; 322 }; 323 filesToInstall = [ "u-boot.bin" ]; 324 postBuild = '' 325 # Copy binary files & tools from LibreELEC/amlogic-boot-fip, and u-boot build to working dir 326 mkdir $out tmp 327 cp ${firmwareImagePkg}/lepotato/{acs.bin,bl2.bin,bl21.bin,bl30.bin,bl301.bin,bl31.img} \ 328 ${firmwareImagePkg}/lepotato/{acs_tool.py,aml_encrypt_gxl,blx_fix.sh} \ 329 u-boot.bin tmp/ 330 cd tmp 331 python3 acs_tool.py bl2.bin bl2_acs.bin acs.bin 0 332 333 bash -e blx_fix.sh bl2_acs.bin zero bl2_zero.bin bl21.bin bl21_zero.bin bl2_new.bin bl2 334 [ -f zero ] && rm zero 335 336 bash -e blx_fix.sh bl30.bin zero bl30_zero.bin bl301.bin bl301_zero.bin bl30_new.bin bl30 337 [ -f zero ] && rm zero 338 339 ./aml_encrypt_gxl --bl2sig --input bl2_new.bin --output bl2.n.bin.sig 340 ./aml_encrypt_gxl --bl3enc --input bl30_new.bin --output bl30_new.bin.enc 341 ./aml_encrypt_gxl --bl3enc --input bl31.img --output bl31.img.enc 342 ./aml_encrypt_gxl --bl3enc --input u-boot.bin --output bl33.bin.enc 343 ./aml_encrypt_gxl --bootmk --output $out/u-boot.gxl \ 344 --bl2 bl2.n.bin.sig --bl30 bl30_new.bin.enc --bl31 bl31.img.enc --bl33 bl33.bin.enc 345 ''; 346 }; 347 348 ubootNanoPCT4 = buildUBoot rec { 349 rkbin = fetchFromGitHub { 350 owner = "armbian"; 351 repo = "rkbin"; 352 rev = "3bd0321cae5ef881a6005fb470009ad5a5d1462d"; 353 sha256 = "09r4dzxsbs3pff4sh70qnyp30s3rc7pkc46v1m3152s7jqjasp31"; 354 }; 355 356 defconfig = "nanopc-t4-rk3399_defconfig"; 357 358 extraMeta = { 359 platforms = [ "aarch64-linux" ]; 360 license = lib.licenses.unfreeRedistributableFirmware; 361 }; 362 BL31 = "${armTrustedFirmwareRK3399}/bl31.elf"; 363 filesToInstall = [ 364 "u-boot.itb" 365 "idbloader.img" 366 ]; 367 postBuild = '' 368 ./tools/mkimage -n rk3399 -T rksd -d ${rkbin}/rk33/rk3399_ddr_800MHz_v1.24.bin idbloader.img 369 cat ${rkbin}/rk33/rk3399_miniloader_v1.19.bin >> idbloader.img 370 ''; 371 }; 372 373 ubootNanoPCT6 = buildUBoot { 374 defconfig = "nanopc-t6-rk3588_defconfig"; 375 extraMeta.platforms = [ "aarch64-linux" ]; 376 BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 377 ROCKCHIP_TPL = rkbin.TPL_RK3588; 378 filesToInstall = [ 379 "u-boot.itb" 380 "idbloader.img" 381 "u-boot-rockchip.bin" 382 "u-boot-rockchip-spi.bin" 383 ]; 384 }; 385 386 ubootNovena = buildUBoot { 387 defconfig = "novena_defconfig"; 388 extraMeta.platforms = [ "armv7l-linux" ]; 389 filesToInstall = [ 390 "u-boot-dtb.img" 391 "SPL" 392 ]; 393 }; 394 395 # Flashing instructions: 396 # dd if=bl1.bin.hardkernel of=<device> conv=fsync bs=1 count=442 397 # dd if=bl1.bin.hardkernel of=<device> conv=fsync bs=512 skip=1 seek=1 398 # dd if=u-boot.gxbb of=<device> conv=fsync bs=512 seek=97 399 ubootOdroidC2 = 400 let 401 firmwareBlobs = fetchFromGitHub { 402 owner = "armbian"; 403 repo = "odroidc2-blobs"; 404 rev = "47c5aac4bcac6f067cebe76e41fb9924d45b429c"; 405 sha256 = "1ns0a130yxnxysia8c3q2fgyjp9k0nkr689dxk88qh2vnibgchnp"; 406 meta.license = lib.licenses.unfreeRedistributableFirmware; 407 }; 408 in 409 buildUBoot { 410 defconfig = "odroid-c2_defconfig"; 411 extraMeta.platforms = [ "aarch64-linux" ]; 412 filesToInstall = [ 413 "u-boot.bin" 414 "u-boot.gxbb" 415 "${firmwareBlobs}/bl1.bin.hardkernel" 416 ]; 417 postBuild = '' 418 # BL301 image needs at least 64 bytes of padding after it to place 419 # signing headers (with amlbootsig) 420 truncate -s 64 bl301.padding.bin 421 cat '${firmwareBlobs}/gxb/bl301.bin' bl301.padding.bin > bl301.padded.bin 422 # The downstream fip_create tool adds a custom TOC entry with UUID 423 # AABBCCDD-ABCD-EFEF-ABCD-12345678ABCD for the BL301 image. It turns out 424 # that the firmware blob does not actually care about UUIDs, only the 425 # order the images appear in the file. Because fiptool does not know 426 # about the BL301 UUID, we would have to use the --blob option, which adds 427 # the image to the end of the file, causing the boot to fail. Instead, we 428 # take advantage of the fact that UUIDs are ignored and just put the 429 # images in the right order with the wrong UUIDs. In the command below, 430 # --tb-fw is really --scp-fw and --scp-fw is the BL301 image. 431 # 432 # See https://github.com/afaerber/meson-tools/issues/3 for more 433 # information. 434 '${buildPackages.armTrustedFirmwareTools}/bin/fiptool' create \ 435 --align 0x4000 \ 436 --tb-fw '${firmwareBlobs}/gxb/bl30.bin' \ 437 --scp-fw bl301.padded.bin \ 438 --soc-fw '${armTrustedFirmwareS905}/bl31.bin' \ 439 --nt-fw u-boot.bin \ 440 fip.bin 441 cat '${firmwareBlobs}/gxb/bl2.package' fip.bin > boot_new.bin 442 '${buildPackages.meson-tools}/bin/amlbootsig' boot_new.bin u-boot.img 443 dd if=u-boot.img of=u-boot.gxbb bs=512 skip=96 444 ''; 445 }; 446 447 ubootOdroidXU3 = buildUBoot { 448 defconfig = "odroid-xu3_defconfig"; 449 extraMeta.platforms = [ "armv7l-linux" ]; 450 filesToInstall = [ "u-boot-dtb.bin" ]; 451 }; 452 453 ubootOlimexA64Olinuxino = buildUBoot { 454 defconfig = "a64-olinuxino-emmc_defconfig"; 455 extraMeta.platforms = [ "aarch64-linux" ]; 456 BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin"; 457 SCP = "/dev/null"; 458 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 459 }; 460 461 ubootOlimexA64Teres1 = buildUBoot { 462 defconfig = "teres_i_defconfig"; 463 extraMeta.platforms = [ "aarch64-linux" ]; 464 BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin"; 465 # Using /dev/null here is upstream-specified way that disables the inclusion of crust-firmware as it's not yet packaged and without which the build will fail -- https://docs.u-boot.org/en/latest/board/allwinner/sunxi.html#building-the-crust-management-processor-firmware 466 SCP = "/dev/null"; 467 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 468 }; 469 470 ubootOrangePi5 = buildUBoot { 471 defconfig = "orangepi-5-rk3588s_defconfig"; 472 extraMeta.platforms = [ "aarch64-linux" ]; 473 BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 474 ROCKCHIP_TPL = rkbin.TPL_RK3588; 475 filesToInstall = [ 476 "u-boot.itb" 477 "idbloader.img" 478 "u-boot-rockchip.bin" 479 "u-boot-rockchip-spi.bin" 480 ]; 481 }; 482 483 ubootOrangePi5Max = buildUBoot { 484 defconfig = "orangepi-5-max-rk3588_defconfig"; 485 extraMeta.platforms = [ "aarch64-linux" ]; 486 BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 487 ROCKCHIP_TPL = rkbin.TPL_RK3588; 488 filesToInstall = [ 489 "u-boot.itb" 490 "idbloader.img" 491 "u-boot-rockchip.bin" 492 "u-boot-rockchip-spi.bin" 493 ]; 494 }; 495 496 ubootOrangePi5Plus = buildUBoot { 497 defconfig = "orangepi-5-plus-rk3588_defconfig"; 498 extraMeta.platforms = [ "aarch64-linux" ]; 499 BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 500 ROCKCHIP_TPL = rkbin.TPL_RK3588; 501 filesToInstall = [ 502 "u-boot.itb" 503 "idbloader.img" 504 "u-boot-rockchip.bin" 505 "u-boot-rockchip-spi.bin" 506 ]; 507 }; 508 509 ubootOrangePiPc = buildUBoot { 510 defconfig = "orangepi_pc_defconfig"; 511 extraMeta.platforms = [ "armv7l-linux" ]; 512 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 513 }; 514 515 ubootOrangePiZeroPlus2H5 = buildUBoot { 516 defconfig = "orangepi_zero_plus2_defconfig"; 517 extraMeta.platforms = [ "aarch64-linux" ]; 518 BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin"; 519 SCP = "/dev/null"; 520 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 521 }; 522 523 ubootOrangePiZero = buildUBoot { 524 defconfig = "orangepi_zero_defconfig"; 525 extraMeta.platforms = [ "armv7l-linux" ]; 526 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 527 }; 528 529 ubootOrangePiZero2 = buildUBoot { 530 defconfig = "orangepi_zero2_defconfig"; 531 extraMeta.platforms = [ "aarch64-linux" ]; 532 BL31 = "${armTrustedFirmwareAllwinnerH616}/bl31.bin"; 533 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 534 }; 535 536 ubootOrangePiZero3 = buildUBoot { 537 defconfig = "orangepi_zero3_defconfig"; 538 extraMeta.platforms = [ "aarch64-linux" ]; 539 # According to https://linux-sunxi.org/H616 the H618 "is a minor update with a larger (1MB) L2 cache" (compared to the H616) 540 # but "does require extra support in U-Boot, TF-A and sunxi-fel. Support for that has been merged in mainline releases." 541 # But no extra support seems to be in TF-A. 542 BL31 = "${armTrustedFirmwareAllwinnerH616}/bl31.bin"; 543 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 544 }; 545 546 ubootOrangePi3 = buildUBoot { 547 defconfig = "orangepi_3_defconfig"; 548 extraMeta.platforms = [ "aarch64-linux" ]; 549 BL31 = "${armTrustedFirmwareAllwinnerH6}/bl31.bin"; 550 SCP = "/dev/null"; 551 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 552 }; 553 554 ubootOrangePi3B = buildUBoot { 555 defconfig = "orangepi-3b-rk3566_defconfig"; 556 extraMeta.platforms = [ "aarch64-linux" ]; 557 ROCKCHIP_TPL = rkbin.TPL_RK3568; 558 BL31 = rkbin.BL31_RK3568; 559 filesToInstall = [ 560 "u-boot.itb" 561 "idbloader.img" 562 "u-boot-rockchip.bin" 563 "u-boot-rockchip-spi.bin" 564 ]; 565 }; 566 567 ubootPcduino3Nano = buildUBoot { 568 defconfig = "Linksprite_pcDuino3_Nano_defconfig"; 569 extraMeta.platforms = [ "armv7l-linux" ]; 570 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 571 }; 572 573 ubootPine64 = buildUBoot { 574 defconfig = "pine64_plus_defconfig"; 575 extraMeta.platforms = [ "aarch64-linux" ]; 576 BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin"; 577 SCP = "/dev/null"; 578 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 579 }; 580 581 ubootPine64LTS = buildUBoot { 582 defconfig = "pine64-lts_defconfig"; 583 extraMeta.platforms = [ "aarch64-linux" ]; 584 BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin"; 585 SCP = "/dev/null"; 586 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 587 }; 588 589 ubootPinebook = buildUBoot { 590 defconfig = "pinebook_defconfig"; 591 extraMeta.platforms = [ "aarch64-linux" ]; 592 BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin"; 593 SCP = "/dev/null"; 594 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 595 }; 596 597 ubootPinebookPro = buildUBoot { 598 defconfig = "pinebook-pro-rk3399_defconfig"; 599 extraMeta.platforms = [ "aarch64-linux" ]; 600 BL31 = "${armTrustedFirmwareRK3399}/bl31.elf"; 601 filesToInstall = [ 602 "u-boot.itb" 603 "idbloader.img" 604 ]; 605 }; 606 607 ubootQemuAarch64 = buildUBoot { 608 defconfig = "qemu_arm64_defconfig"; 609 extraMeta.platforms = [ "aarch64-linux" ]; 610 filesToInstall = [ "u-boot.bin" ]; 611 }; 612 613 ubootQemuArm = buildUBoot { 614 defconfig = "qemu_arm_defconfig"; 615 extraMeta.platforms = [ "armv7l-linux" ]; 616 filesToInstall = [ "u-boot.bin" ]; 617 }; 618 619 ubootQemuRiscv64Smode = buildUBoot { 620 defconfig = "qemu-riscv64_smode_defconfig"; 621 extraMeta.platforms = [ "riscv64-linux" ]; 622 filesToInstall = [ "u-boot.bin" ]; 623 }; 624 625 ubootQemuX86 = buildUBoot { 626 defconfig = "qemu-x86_defconfig"; 627 extraConfig = '' 628 CONFIG_USB_UHCI_HCD=y 629 CONFIG_USB_EHCI_HCD=y 630 CONFIG_USB_EHCI_GENERIC=y 631 CONFIG_USB_XHCI_HCD=y 632 ''; 633 extraMeta.platforms = [ 634 "i686-linux" 635 "x86_64-linux" 636 ]; 637 filesToInstall = [ "u-boot.rom" ]; 638 }; 639 640 ubootQemuX86_64 = buildUBoot { 641 defconfig = "qemu-x86_64_defconfig"; 642 extraConfig = '' 643 CONFIG_USB_UHCI_HCD=y 644 CONFIG_USB_EHCI_HCD=y 645 CONFIG_USB_EHCI_GENERIC=y 646 CONFIG_USB_XHCI_HCD=y 647 ''; 648 extraMeta.platforms = [ "x86_64-linux" ]; 649 filesToInstall = [ "u-boot.rom" ]; 650 }; 651 652 ubootQuartz64B = buildUBoot { 653 defconfig = "quartz64-b-rk3566_defconfig"; 654 extraMeta.platforms = [ "aarch64-linux" ]; 655 BL31 = "${armTrustedFirmwareRK3568}/bl31.elf"; 656 ROCKCHIP_TPL = rkbin.TPL_RK3566; 657 filesToInstall = [ 658 "idbloader.img" 659 "idbloader-spi.img" 660 "u-boot.itb" 661 "u-boot-rockchip.bin" 662 "u-boot-rockchip-spi.bin" 663 ]; 664 }; 665 666 ubootRadxaZero3W = buildUBoot { 667 defconfig = "radxa-zero-3-rk3566_defconfig"; 668 extraMeta.platforms = [ "aarch64-linux" ]; 669 BL31 = "${armTrustedFirmwareRK3568}/bl31.elf"; 670 ROCKCHIP_TPL = rkbin.TPL_RK3566; 671 filesToInstall = [ 672 "idbloader.img" 673 "u-boot.itb" 674 "u-boot-rockchip.bin" 675 ]; 676 }; 677 678 ubootRaspberryPi = buildUBoot { 679 defconfig = "rpi_defconfig"; 680 extraMeta.platforms = [ "armv6l-linux" ]; 681 filesToInstall = [ "u-boot.bin" ]; 682 }; 683 684 ubootRaspberryPi2 = buildUBoot { 685 defconfig = "rpi_2_defconfig"; 686 extraMeta.platforms = [ "armv7l-linux" ]; 687 filesToInstall = [ "u-boot.bin" ]; 688 }; 689 690 ubootRaspberryPi3_32bit = buildUBoot { 691 defconfig = "rpi_3_32b_defconfig"; 692 extraMeta.platforms = [ "armv7l-linux" ]; 693 filesToInstall = [ "u-boot.bin" ]; 694 }; 695 696 ubootRaspberryPi3_64bit = buildUBoot { 697 defconfig = "rpi_3_defconfig"; 698 extraMeta.platforms = [ "aarch64-linux" ]; 699 filesToInstall = [ "u-boot.bin" ]; 700 }; 701 702 ubootRaspberryPi4_32bit = buildUBoot { 703 defconfig = "rpi_4_32b_defconfig"; 704 extraMeta.platforms = [ "armv7l-linux" ]; 705 filesToInstall = [ "u-boot.bin" ]; 706 }; 707 708 ubootRaspberryPi4_64bit = buildUBoot { 709 defconfig = "rpi_4_defconfig"; 710 extraMeta.platforms = [ "aarch64-linux" ]; 711 filesToInstall = [ "u-boot.bin" ]; 712 }; 713 714 ubootRaspberryPiZero = buildUBoot { 715 defconfig = "rpi_0_w_defconfig"; 716 extraMeta.platforms = [ "armv6l-linux" ]; 717 filesToInstall = [ "u-boot.bin" ]; 718 }; 719 720 ubootRock4CPlus = buildUBoot { 721 defconfig = "rock-4c-plus-rk3399_defconfig"; 722 extraMeta.platforms = [ "aarch64-linux" ]; 723 BL31 = "${armTrustedFirmwareRK3399}/bl31.elf"; 724 filesToInstall = [ 725 "u-boot.itb" 726 "idbloader.img" 727 ]; 728 }; 729 730 ubootRock5ModelB = buildUBoot { 731 defconfig = "rock5b-rk3588_defconfig"; 732 extraMeta.platforms = [ "aarch64-linux" ]; 733 BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 734 ROCKCHIP_TPL = rkbin.TPL_RK3588; 735 filesToInstall = [ 736 "u-boot.itb" 737 "idbloader.img" 738 "u-boot-rockchip.bin" 739 "u-boot-rockchip-spi.bin" 740 ]; 741 }; 742 743 ubootRock64 = buildUBoot { 744 defconfig = "rock64-rk3328_defconfig"; 745 extraMeta.platforms = [ "aarch64-linux" ]; 746 BL31 = "${armTrustedFirmwareRK3328}/bl31.elf"; 747 filesToInstall = [ 748 "u-boot.itb" 749 "idbloader.img" 750 "u-boot-rockchip.bin" 751 ]; 752 }; 753 754 # A special build with much lower memory frequency (666 vs 1600 MT/s) which 755 # makes ROCK64 V2 boards stable. This is necessary because the DDR3 routing 756 # on that revision is marginal and not unconditionally stable at the specified 757 # frequency. If your ROCK64 is unstable you can try this u-boot variant to 758 # see if it works better for you. The only disadvantage is lowered memory 759 # bandwidth. 760 ubootRock64v2 = buildUBoot { 761 prePatch = '' 762 substituteInPlace arch/arm/dts/rk3328-rock64-u-boot.dtsi \ 763 --replace rk3328-sdram-lpddr3-1600.dtsi rk3328-sdram-lpddr3-666.dtsi 764 ''; 765 defconfig = "rock64-rk3328_defconfig"; 766 extraMeta.platforms = [ "aarch64-linux" ]; 767 BL31 = "${armTrustedFirmwareRK3328}/bl31.elf"; 768 filesToInstall = [ 769 "u-boot.itb" 770 "idbloader.img" 771 "u-boot-rockchip.bin" 772 ]; 773 }; 774 775 ubootRockPiE = buildUBoot { 776 defconfig = "rock-pi-e-rk3328_defconfig"; 777 extraMeta.platforms = [ "aarch64-linux" ]; 778 BL31 = "${armTrustedFirmwareRK3328}/bl31.elf"; 779 filesToInstall = [ 780 "u-boot.itb" 781 "idbloader.img" 782 "u-boot-rockchip.bin" 783 ]; 784 }; 785 786 ubootRockPro64 = buildUBoot { 787 defconfig = "rockpro64-rk3399_defconfig"; 788 extraMeta.platforms = [ "aarch64-linux" ]; 789 BL31 = "${armTrustedFirmwareRK3399}/bl31.elf"; 790 filesToInstall = [ 791 "u-boot.itb" 792 "idbloader.img" 793 ]; 794 }; 795 796 ubootROCPCRK3399 = buildUBoot { 797 defconfig = "roc-pc-rk3399_defconfig"; 798 extraMeta.platforms = [ "aarch64-linux" ]; 799 filesToInstall = [ 800 "spl/u-boot-spl.bin" 801 "u-boot.itb" 802 "idbloader.img" 803 ]; 804 BL31 = "${armTrustedFirmwareRK3399}/bl31.elf"; 805 }; 806 807 ubootSheevaplug = buildUBoot { 808 defconfig = "sheevaplug_defconfig"; 809 extraMeta = { 810 platforms = [ "armv5tel-linux" ]; 811 broken = true; # too big, exceeds partition size 812 }; 813 filesToInstall = [ "u-boot.kwb" ]; 814 }; 815 816 ubootSopine = buildUBoot { 817 defconfig = "sopine_baseboard_defconfig"; 818 extraMeta.platforms = [ "aarch64-linux" ]; 819 BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin"; 820 SCP = "/dev/null"; 821 filesToInstall = [ "u-boot-sunxi-with-spl.bin" ]; 822 }; 823 824 ubootTuringRK1 = buildUBoot { 825 defconfig = "turing-rk1-rk3588_defconfig"; 826 extraMeta.platforms = [ "aarch64-linux" ]; 827 BL31 = "${armTrustedFirmwareRK3588}/bl31.elf"; 828 ROCKCHIP_TPL = rkbin.TPL_RK3588; 829 filesToInstall = [ 830 "u-boot.itb" 831 "idbloader.img" 832 "u-boot-rockchip.bin" 833 ]; 834 }; 835 836 ubootUtilite = buildUBoot { 837 defconfig = "cm_fx6_defconfig"; 838 extraMeta.platforms = [ "armv7l-linux" ]; 839 filesToInstall = [ "u-boot-with-nand-spl.imx" ]; 840 buildFlags = [ "u-boot-with-nand-spl.imx" ]; 841 extraConfig = '' 842 CONFIG_CMD_SETEXPR=y 843 ''; 844 # sata init; load sata 0 $loadaddr u-boot-with-nand-spl.imx 845 # sf probe; sf update $loadaddr 0 80000 846 }; 847 848 ubootVisionFive2 = 849 let 850 opensbi_vf2 = opensbi.overrideAttrs (attrs: { 851 makeFlags = attrs.makeFlags ++ [ 852 # Matches u-boot documentation: https://docs.u-boot.org/en/latest/board/starfive/visionfive2.html 853 "FW_TEXT_START=0x40000000" 854 "FW_OPTIONS=0" 855 ]; 856 }); 857 in 858 buildUBoot { 859 defconfig = "starfive_visionfive2_defconfig"; 860 extraMeta.platforms = [ "riscv64-linux" ]; 861 OPENSBI = "${opensbi_vf2}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin"; 862 filesToInstall = [ 863 "spl/u-boot-spl.bin.normal.out" 864 "u-boot.itb" 865 ]; 866 }; 867 868 ubootWandboard = buildUBoot { 869 defconfig = "wandboard_defconfig"; 870 extraMeta.platforms = [ "armv7l-linux" ]; 871 filesToInstall = [ 872 "u-boot.img" 873 "SPL" 874 ]; 875 }; 876 877 ubootRockPi4 = buildUBoot { 878 defconfig = "rock-pi-4-rk3399_defconfig"; 879 extraMeta.platforms = [ "aarch64-linux" ]; 880 BL31 = "${armTrustedFirmwareRK3399}/bl31.elf"; 881 filesToInstall = [ 882 "u-boot.itb" 883 "idbloader.img" 884 ]; 885 }; 886}