# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)

if [ -n "${UBOOT_SYSTEM}" ]; then
  BOOTLOADER_PATH="${RELEASE_DIR}/3rdparty/bootloader/u-boot-rockchip.bin"
  if [ -f "${BOOTLOADER_PATH}" ]; then
    echo "image: burn bootloader to image..."
    dd if="${BOOTLOADER_PATH}" of="${DISK}" bs=32k seek=1 conv=fsync,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
  else
    echo "image: bootloader ${BOOTLOADER_PATH} does not exist.";
    exit 1
  fi
fi
