2022-02-05 14:23:32 +00:00
# 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"
2022-02-27 04:44:15 +00:00
PKG_SITE = "https://github.com/JustEnoughLinuxOS/rockchip-uboot"
2022-02-05 14:23:32 +00:00
PKG_DEPENDS_TARGET = "toolchain swig:host rkbin"
PKG_LONGDESC = "Rockchip U-Boot is a bootloader for embedded systems."
2022-02-27 04:44:15 +00:00
PKG_URL = " ${ PKG_SITE } .git "
PKG_VERSION = "23f4a5d"
2022-02-05 14:23:32 +00:00
GET_HANDLER_SUPPORT = "git"
2022-03-26 14:07:10 +00:00
i f [ [ "${DEVICE}" = ~ R G 3 5 1 ] ]
t h e n
2022-03-26 14:54:27 +00:00
PKG_URL = "https://github.com/JustEnoughLinuxOS/rg351x-uboot.git"
PKG_VERSION = "9f8c2e3936"
2022-03-26 14:07:10 +00:00
f i
2022-02-05 14:23:32 +00:00
PKG_IS_KERNEL_PKG = "yes"
2022-03-26 14:07:10 +00:00
PKG_STAMP = " ${ UBOOT_CONFIG } "
2022-02-05 14:23:32 +00:00
2022-03-26 10:22:01 +00:00
[ - n "${ATF_PLATFORM}" ] & & PKG_DEPENDS_TARGET += " atf"
2022-02-05 14:23:32 +00:00
2022-03-26 10:22:01 +00:00
PKG_NEED_UNPACK = " ${ PROJECT } _DIR/ ${ PROJECT } /bootloader "
[ - n "${DEVICE}" ] & & PKG_NEED_UNPACK += " ${ PROJECT } _DIR/ ${ PROJECT } /devices/ ${ DEVICE } /bootloader "
2022-02-05 14:23:32 +00:00
PKG_PATCH_DIRS = " patches/ ${ DEVICE } "
p o s t _ p a t c h ( ) {
2022-03-26 14:07:10 +00:00
if [ -n " ${ UBOOT_CONFIG } " ] && find_file_path bootloader/config; then
PKG_CONFIG_FILE = " ${ UBOOT_CONFIG } "
2022-02-05 14:23:32 +00:00
if [ -f " $PKG_CONFIG_FILE " ] ; then
cat $FOUND_PATH >> " $PKG_CONFIG_FILE "
fi
fi
}
m a k e _ t a r g e t ( ) {
2022-03-26 14:07:10 +00:00
if [ -z " ${ UBOOT_CONFIG } " ] ; then
echo "UBOOT_CONFIG must be set to build an image"
2022-02-05 14:23:32 +00:00
else
[ " ${ BUILD_WITH_DEBUG } " = "yes" ] && PKG_DEBUG = 1 || PKG_DEBUG = 0
[ -n " ${ ATF_PLATFORM } " ] && cp -av $( get_build_dir atf) /bl31.bin .
2022-03-26 10:22:01 +00:00
DEBUG = ${ PKG_DEBUG } CROSS_COMPILE = " ${ TARGET_KERNEL_PREFIX } " LDFLAGS = "" ARCH = arm make mrproper
2022-03-26 14:07:10 +00:00
DEBUG = ${ PKG_DEBUG } CROSS_COMPILE = " ${ TARGET_KERNEL_PREFIX } " LDFLAGS = "" ARCH = arm make ${ UBOOT_CONFIG }
2022-03-26 10:22:01 +00:00
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"
2022-02-05 14:23:32 +00:00
fi
}
m a k e i n s t a l l _ t a r g e t ( ) {
2022-03-26 10:22:01 +00:00
mkdir -p ${ INSTALL } /usr/share/bootloader
2022-02-05 14:23:32 +00:00
# Only install u-boot.img et al when building a board specific image
2022-03-26 14:07:10 +00:00
if [ -n " ${ UBOOT_CONFIG } " ] ; then
2022-03-26 14:22:57 +00:00
e c h o i n s t a l l
2022-02-05 14:23:32 +00:00
find_file_path bootloader/install && . ${ FOUND_PATH }
fi
# Always install the update script
2022-03-26 10:22:01 +00:00
find_file_path bootloader/update.sh && cp -av ${ FOUND_PATH } ${ INSTALL } /usr/share/bootloader
2022-02-05 14:23:32 +00:00
# Always install the canupdate script
if find_file_path bootloader/canupdate.sh; then
2022-03-26 10:22:01 +00:00
cp -av ${ FOUND_PATH } ${ INSTALL } /usr/share/bootloader
sed -e " s/@PROJECT@/ ${ DEVICE :- ${ PROJECT } } /g " \
-i ${ INSTALL } /usr/share/bootloader/canupdate.sh
2022-02-05 14:23:32 +00:00
fi
}