@@ -289,3 +289,142 @@ extract the FSBL and PMUFW from the complete boot image.
289289configuration:
290290 * path
291291
292+ ## For Rockchip devices
293+
294+ Current implementation of support for the Rockchip SoCs, RAMboot and
295+ SPL DFU are supported.
296+
297+ As there's no implementation for Rockchip USB protocol support, it is
298+ possible to push the DDR init files and SPL files from Rockchip but the next
299+ step will fail.
300+
301+ Mainline u-boot does not support boot from RAM and boot from SPL DFU,
302+ it has to be patched.
303+
304+ The patches have been sent to the u-boot mailing list by their authors
305+ and not yet merged. The patches can all be found inside this
306+ [ merge request] ( https://gitlab.collabora.com/hardware-enablement/rockchip-3588/u-boot/-/merge_requests/7 ) .
307+
308+ ### Using binary generated by Rockchip's `` boot_merger ``
309+
310+ [ example] ( ../src/snagrecover/templates/rockchip-merger.yaml )
311+
312+ Snagboot can upload the `` CODE471_OPTION `` and `` CODE472_OPTION `` of a binary
313+ generated with the `` boot_merger `` tool and configuration files from
314+ [ Rockchip rkbin] ( https://github.com/radxa/rkbin/tree/develop-v2024.03/ ) .
315+
316+ In case of u-boot, this would mean to upload the TPL, SPL and then use SPL DFU
317+ to boot u-boot proper (see later section for SPL DFU).
318+
319+ An example configuration for rk3399 would be:
320+ ```
321+ [CHIP_NAME]
322+ NAME=RK330C
323+ [VERSION]
324+ MAJOR=1
325+ MINOR=123
326+ [CODE471_OPTION]
327+ NUM=1
328+ Path1=tpl/u-boot-tpl-dtb.bin
329+ Sleep=1
330+ [CODE472_OPTION]
331+ NUM=1
332+ Path1=spl/u-boot-spl-dtb.bin
333+ Sleep=3000
334+ [LOADER_OPTION]
335+ NUM=2
336+ LOADER1=FlashData
337+ LOADER2=FlashBoot
338+ FlashData=spl/u-boot-spl-dtb.bin
339+ FlashBoot=u-boot.itb
340+ [OUTPUT]
341+ PATH=rk3399_uboot.bin
342+ [FLAG]
343+ 471_RC4_OFF=false
344+ ```
345+
346+ The `` tpl/u-boot-tpl-dtb.bin `` , `` spl/u-boot-spl-dtb.bin `` , `` u-boot.itb ``
347+ files are generated during u-boot's build. Please note has the `` LOADER_OPTION ``
348+ is not handled by snagboot.
349+
350+ The configuration parameters are:
351+
352+ ** xpl:** Binary blob generated with bootmerger. For instance, here, `` rk3399_uboot.bin `` .
353+ * path: path to the blob
354+
355+ ** u-boot-fit:** U-boot FIT image.
356+ * path: Path to the FIT image. Typically, `` u-boot.itb ``
357+
358+
359+ ### Boot from Ram
360+
361+ [ example] ( ../src/snagrecover/templates/rockchip-ramboot.yaml )
362+
363+ When building u-boot with the previously mentioned patches, u-boot will generate two files:
364+
365+ - `` u-boot-rockchip-usb471.bin ``
366+ - `` u-boot-rockchip-usb472.bin ``
367+
368+ These are the files needed to boot from RAM.
369+
370+ The configuration parameters are:
371+
372+ ** code471:** File to use for maskrom code 0x471.
373+
374+ configuration:
375+ * path: Path to the `` u-boot-rockchip-usb471.bin `` file
376+ * delay: Optional delay in milliseconds before loading next binary
377+
378+ ** code472:** File to use for maskrom code 0x472.
379+
380+ configuration:
381+ * path: Path to the `` u-boot-rockchip-usb472.bin `` file
382+
383+
384+ ### Boot from SPL DFU
385+
386+ [ example] ( ../src/snagrecover/templates/rockchip-spl-dfu.yaml )
387+
388+ To enable u-boot with SPL DFU support in the u-boot configuration, ensure that the
389+ following options are enabled:
390+
391+ ```
392+ CONFIG_SPL_DM_USB_GADGET=y
393+ CONFIG_SPL_USB_GADGET=y
394+ CONFIG_SPL_DFU=y
395+ ```
396+
397+ On some systems, rebooting the system won't reset the memory content. This means that
398+ booting over DFU after having done a boot from RAM will result in u-boot loading the
399+ u-boot version from the boot from RAM boot and won't try to load u-boot over DFU.
400+
401+ To solve this, disable boot from RAM with:
402+
403+ ```
404+ # CONFIG_SPL_RAM_DEVICE is not set
405+ ```
406+
407+ The (SPL) USB gadget driver needs to be enabled too.
408+
409+ At the end of the build, the following files will be needed:
410+
411+ - `` mkimage-in-simple-bin.mkimage-u-boot-tpl `` or `` mkimage-in-simple-bin.mkimage-rockchip-tpl ``
412+ - `` mkimage-in-simple-bin.mkimage-u-boot-spl ``
413+ - `` u-boot.itb ``
414+
415+ The configuration parameters are:
416+
417+ ** code471:** File to use for maskrom code 0x471.
418+
419+ configuration:
420+ * path: Path to the TPL file. For instance, `` mkimage-in-simple-bin.mkimage-rockchip-tpl `` .
421+ * delay: Optional delay in milliseconds before loading next binary
422+
423+ ** code472:** File to use for maskrom code 0x472.
424+
425+ configuration:
426+ * path: Path to the SPL. For instance, `` mkimage-in-simple-bin.mkimage-u-boot-spl `` .
427+ * delay: Optional delay in milliseconds before loading next binary
428+
429+ ** u-boot-fit:** U-boot FIT image.
430+ * path: Path to the FIT image. Typically, `` u-boot.itb ``
0 commit comments