Skip to content

Commit 944f2f9

Browse files
mingzhangqunigorpecovnik
authored andcommitted
uboot: add board/extension hooks for SPL blobs and SPI image postprocess
Allow boards/extensions to take over SPL loader generation via a new board_uboot_spl_blobs_postprocess() hook (checked before the upstream BOOT_SOC branches in uboot_custom_postprocess). Falls through to the existing rk3576/rk3588 branches when the hook is not defined. Also add a board_uboot_spi_image_postprocess() hook invoked after the rkspi_loader.img is finalized, so boards can copy the SPI image out for Maskrom recovery use cases.
1 parent 65f88a0 commit 944f2f9

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

config/sources/families/include/rockchip64_common.inc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,12 @@ uboot_custom_postprocess() {
262262
display_alert "boot_merger for '${BOOT_SOC}'" "using vendor SPL ${VENDOR_SPL_PATH##*/}" "info"
263263
fi
264264

265-
if [[ "$BOOT_SOC" == "rk3576" ]]; then
265+
if declare -F board_uboot_spl_blobs_postprocess >/dev/null; then
266+
# Board/extension hook: take over SPL loader generation for this BOOT_SOC
267+
# (e.g. boot_merger with custom usbplug, idbloader via mkimage, maskrom
268+
# spl_loader save). Falls through to the upstream branches below otherwise.
269+
board_uboot_spl_blobs_postprocess "$BOOT_SOC" "$SPL_BIN_PATH" "$FLASH_BOOT_BIN"
270+
elif [[ "$BOOT_SOC" == "rk3576" ]]; then
266271
display_alert "boot_merger for '${BOOT_SOC}' for scenario ${BOOT_SCENARIO}" "SPL_BIN_PATH: ${SPL_BIN_PATH}" "debug"
267272
RKBOOT_INI_FILE=rk3576.ini
268273
cp $RKBIN_DIR/rk35/RK3576MINIALL.ini $RKBOOT_INI_FILE
@@ -308,6 +313,9 @@ uboot_custom_postprocess() {
308313
run_host_command_logged /sbin/parted -s rkspi_loader.img unit s mkpart uboot 16384 32734
309314
run_host_command_logged dd if=idbloader.img of=rkspi_loader.img seek=64 conv=notrunc
310315
run_host_command_logged dd if=u-boot.itb of=rkspi_loader.img seek=16384 conv=notrunc
316+
# Hook: allow board/extension to copy out the SPI image (e.g. for Maskrom recovery)
317+
declare -F board_uboot_spi_image_postprocess >/dev/null && \
318+
board_uboot_spi_image_postprocess
311319
else
312320
display_alert "uboot_custom_postprocess (mkimage) for BOOT_SUPPORT_SPI:${BOOT_SUPPORT_SPI:-"no"} and BOOT_SPI_RKSPI_LOADER=${BOOT_SPI_RKSPI_LOADER:-"no"}" "SPI rkspi_loader.img" "info"
313321
run_host_command_logged tools/mkimage -n "${BOOT_SOC_MKIMAGE}" -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin rkspi_tpl_spl.img

0 commit comments

Comments
 (0)