70 lines
2.7 KiB
Makefile
70 lines
2.7 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
|
|
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
|
|
|
|
PKG_NAME="u-boot"
|
|
PKG_ARCH="arm aarch64"
|
|
PKG_LICENSE="GPL"
|
|
PKG_SITE="https://github.com/rockchip-linux/u-boot"
|
|
PKG_DEPENDS_TARGET="toolchain swig:host rkbin"
|
|
PKG_LONGDESC="Rockchip U-Boot is a bootloader for embedded systems."
|
|
PKG_URL="https://github.com/JustEnoughLinuxOS/rockchip-uboot.git"
|
|
PKG_VERSION="543c8d3"
|
|
GET_HANDLER_SUPPORT="git"
|
|
PKG_GIT_CLONE_DEPTH="1"
|
|
|
|
if [[ "${DEVICE}" =~ RG351 ]]
|
|
then
|
|
PKG_VERSION="2b575e133fa1280dcf07f0bc5ebc4e6a48ea7132"
|
|
PKG_URL="https://github.com/351ELEC/uboot_rg351.git"
|
|
fi
|
|
|
|
PKG_IS_KERNEL_PKG="yes"
|
|
PKG_STAMP="$UBOOT_SYSTEM"
|
|
|
|
[ -n "$ATF_PLATFORM" ] && PKG_DEPENDS_TARGET+=" atf"
|
|
|
|
PKG_NEED_UNPACK="$PROJECT_DIR/$PROJECT/bootloader"
|
|
[ -n "$DEVICE" ] && PKG_NEED_UNPACK+=" $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader"
|
|
|
|
PKG_PATCH_DIRS="patches/${DEVICE}"
|
|
|
|
post_patch() {
|
|
if [ -n "$UBOOT_SYSTEM" ] && find_file_path bootloader/config; then
|
|
PKG_CONFIG_FILE="$PKG_BUILD/configs/$($ROOT/$SCRIPTS/uboot_helper $PROJECT $DEVICE $UBOOT_SYSTEM config)"
|
|
if [ -f "$PKG_CONFIG_FILE" ]; then
|
|
cat $FOUND_PATH >> "$PKG_CONFIG_FILE"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
make_target() {
|
|
if [ -z "$UBOOT_SYSTEM" ]; then
|
|
echo "UBOOT_SYSTEM must be set to build an image"
|
|
echo "see './scripts/uboot_helper' for more information"
|
|
else
|
|
[ "${BUILD_WITH_DEBUG}" = "yes" ] && PKG_DEBUG=1 || PKG_DEBUG=0
|
|
[ -n "${ATF_PLATFORM}" ] && cp -av $(get_build_dir atf)/bl31.bin .
|
|
DEBUG=${PKG_DEBUG} CROSS_COMPILE="$TARGET_KERNEL_PREFIX" LDFLAGS="" ARCH=arm make mrproper
|
|
DEBUG=${PKG_DEBUG} CROSS_COMPILE="$TARGET_KERNEL_PREFIX" LDFLAGS="" ARCH=arm make $($ROOT/$SCRIPTS/uboot_helper $PROJECT $DEVICE $UBOOT_SYSTEM config)
|
|
DEBUG=${PKG_DEBUG} CROSS_COMPILE="$TARGET_KERNEL_PREFIX" LDFLAGS="" ARCH=arm _python_sysroot="$TOOLCHAIN" _python_prefix=/ _python_exec_prefix=/ make HOSTCC="$HOST_CC" HOSTLDFLAGS="-L$TOOLCHAIN/lib" HOSTSTRIP="true" CONFIG_MKIMAGE_DTC_PATH="scripts/dtc/dtc"
|
|
fi
|
|
}
|
|
|
|
makeinstall_target() {
|
|
mkdir -p $INSTALL/usr/share/bootloader
|
|
# Only install u-boot.img et al when building a board specific image
|
|
if [ -n "${UBOOT_SYSTEM}" ]; then
|
|
find_file_path bootloader/install && . ${FOUND_PATH}
|
|
fi
|
|
|
|
# Always install the update script
|
|
find_file_path bootloader/update.sh && cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader
|
|
|
|
# Always install the canupdate script
|
|
if find_file_path bootloader/canupdate.sh; then
|
|
cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader
|
|
sed -e "s/@PROJECT@/${DEVICE:-$PROJECT}/g" \
|
|
-i $INSTALL/usr/share/bootloader/canupdate.sh
|
|
fi
|
|
}
|