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