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