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