2023-01-08 22:49: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)
2023-10-24 16:00:57 +00:00
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
2023-01-08 22:49:32 +00:00
PKG_NAME = "u-boot"
PKG_ARCH = "arm aarch64"
2023-02-15 11:38:49 +00:00
PKG_SITE = "https://github.com/JustEnoughLinuxOS"
2023-02-16 22:40:39 +00:00
PKG_LICENSE = "GPL"
2024-01-09 23:30:50 +00:00
PKG_DEPENDS_TARGET = "toolchain swig:host rkbin glibc pyelftools:host"
2023-01-08 22:49:32 +00:00
PKG_LONGDESC = "Rockchip U-Boot is a bootloader for embedded systems."
PKG_PATCH_DIRS += " ${ DEVICE } "
c a s e $ { D E V I C E } i n
2023-04-25 22:54:13 +00:00
RK358*)
2023-02-15 11:38:49 +00:00
PKG_URL = " ${ PKG_SITE } /rk35xx-uboot.git "
2023-03-08 17:34:56 +00:00
PKG_VERSION = "d34ff0716"
2023-01-08 22:49:32 +00:00
PKG_GIT_CLONE_BRANCH = "v2017.09-rk3588"
; ;
2023-04-25 22:54:13 +00:00
RK356*)
2023-02-16 22:40:39 +00:00
PKG_URL = " ${ PKG_SITE } /rk356x-uboot.git "
2024-01-20 10:54:03 +00:00
PKG_VERSION = "97c658238f7ccd436fbdede451bfd7488514a5c8"
2023-02-16 22:40:39 +00:00
; ;
2023-06-23 03:14:11 +00:00
RK3399)
2024-01-15 21:27:31 +00:00
PKG_DEPENDS_TARGET += " atf openssl:host"
2024-01-09 23:30:50 +00:00
PKG_VERSION = "2024.01"
PKG_URL = " https://ftp.denx.de/pub/u-boot/ ${ PKG_NAME } - ${ PKG_VERSION } .tar.bz2 "
2023-06-23 03:14:11 +00:00
; ;
2024-01-09 23:30:50 +00:00
RK3326)
2023-05-11 19:11:56 +00:00
PKG_URL = "https://github.com/hardkernel/u-boot.git"
PKG_VERSION = "0e26e35cb18a80005b7de45c95858c86a2f7f41e"
PKG_GIT_CLONE_BRANCH = "odroidgoA-v2017.09"
2023-05-04 18:06:54 +00:00
; ;
2023-01-08 22:49:32 +00:00
e s a c
PKG_IS_KERNEL_PKG = "yes"
PKG_STAMP = " ${ UBOOT_CONFIG } "
[ - 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 "
p o s t _ p a t c h ( ) {
if [ -n " ${ UBOOT_CONFIG } " ] && find_file_path bootloader/config; then
PKG_CONFIG_FILE = " ${ UBOOT_CONFIG } "
if [ -f " ${ PKG_CONFIG_FILE } " ] ; then
cat ${ FOUND_PATH } >> " ${ PKG_CONFIG_FILE } "
fi
fi
}
m a k e _ t a r g e t ( ) {
2024-01-09 23:30:50 +00:00
s e t u p _ p k g _ c o n f i g _ h o s t
2023-01-08 22:49:32 +00:00
. ${ PROJECT_DIR } /${ PROJECT } /devices/${ DEVICE } /options
if [ -z " ${ UBOOT_CONFIG } " ] ; then
echo "UBOOT_CONFIG must be set to build an image"
else
2023-01-11 21:31:08 +00:00
if [ -e " ${ PROJECT_DIR } / ${ PROJECT } /devices/ ${ DEVICE } /u-boot/ ${ UBOOT_CONFIG } " ]
2023-01-08 22:49:32 +00:00
then
2023-01-11 21:31:08 +00:00
cp ${ PROJECT_DIR } /${ PROJECT } /devices/${ DEVICE } /u-boot/${ UBOOT_CONFIG } configs
2023-01-08 22:49:32 +00:00
fi
[ " ${ BUILD_WITH_DEBUG } " = "yes" ] && PKG_DEBUG = 1 || PKG_DEBUG = 0
2023-02-16 22:40:39 +00:00
if [ [ " ${ PKG_BL31 } " = ~ ^/bin ] ]
then
PKG_BL31 = " $( get_build_dir rkbin) / ${ PKG_BL31 } "
fi
if [ [ " ${ PKG_LOADER } " = ~ ^/bin ] ]
then
PKG_LOADER = " $( get_build_dir rkbin) / ${ PKG_LOADER } "
fi
2023-05-10 22:50:47 +00:00
if [ [ " ${ PKG_SOC } " = ~ "rk35" ] ]
2023-05-04 18:06:54 +00:00
then
2023-01-11 21:31:08 +00:00
DEBUG = ${ PKG_DEBUG } CROSS_COMPILE = " ${ TARGET_KERNEL_PREFIX } " LDFLAGS = "" ARCH = arm64 make mrproper
2023-09-17 15:56:29 +00:00
DEBUG = ${ PKG_DEBUG } CROSS_COMPILE = " ${ TARGET_KERNEL_PREFIX } " LDFLAGS = "" ARCH = arm64 make ${ UBOOT_CONFIG } BL31 = ${ PKG_BL31 } ${ PKG_LOADER } u-boot.dtb u-boot.itb CONFIG_MKIMAGE_DTC_PATH = "scripts/dtc/dtc"
2023-02-24 13:53:43 +00:00
DEBUG = ${ PKG_DEBUG } CROSS_COMPILE = " ${ TARGET_KERNEL_PREFIX } " LDFLAGS = "" ARCH = arm64 _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"
2023-05-04 18:06:54 +00:00
else
echo " Building for MBR ( ${ UBOOT_DTB } )... "
2024-01-09 23:30:50 +00:00
if [ [ " ${ ATF_PLATFORM } " = ~ "rk3399" ] ] ; then
export BL31 = " $( get_build_dir atf) /.install_pkg/usr/share/bootloader/bl31.elf "
fi
2023-05-04 18:06:54 +00:00
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 ${ UBOOT_CONFIG }
2024-01-15 21:27:31 +00:00
if [ [ " ${ PKG_SOC } " = ~ "rk3399" ] ] ; then
DEBUG = ${ PKG_DEBUG } CROSS_COMPILE = " ${ TARGET_KERNEL_PREFIX } " LDFLAGS = "" ARCH = arm _python_sysroot = " ${ TOOLCHAIN } " _python_prefix = / _python_exec_prefix = / make HOSTCC = " ${ HOST_CC } " HOSTCFLAGS = " -I ${ TOOLCHAIN } /include " HOSTLDFLAGS = " ${ HOST_LDFLAGS } " CONFIG_MKIMAGE_DTC_PATH = "scripts/dtc/dtc"
else
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
2023-05-04 18:06:54 +00:00
fi
2023-01-08 22:49:32 +00:00
fi
}
m a k e i n s t a l l _ t a r g e t ( ) {
mkdir -p ${ INSTALL } /usr/share/bootloader
# Only install u-boot.img et al when building a board specific image
if [ -n " ${ UBOOT_CONFIG } " ] ; 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
}