distribution/projects/Amlogic/packages/u-boot/package.mk

70 lines
2.6 KiB
Makefile
Raw Normal View History

2023-03-22 21:56:33 +00:00
# SPDX-License-Identifier: GPL-2.0-or-later
2023-03-29 12:50:23 +00:00
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
# Copyright (C) 2022-present Fewtarius
2023-03-22 21:56:33 +00:00
PKG_NAME="u-boot"
PKG_ARCH="arm aarch64"
PKG_LICENSE="GPL"
PKG_SITE="https://www.denx.de/wiki/U-Boot"
PKG_DEPENDS_TARGET="toolchain swig:host amlogic-boot-fip"
PKG_LONGDESC="Das U-Boot is a cross-platform bootloader for embedded systems."
PKG_STAMP="${UBOOT_CONFIG}"
2023-03-29 12:50:23 +00:00
PKG_PATCH_DIRS+="${DEVICE}"
2023-03-22 21:56:33 +00:00
2023-03-29 12:50:23 +00:00
case ${DEVICE} in
2023-04-02 20:16:01 +00:00
S922X)
2023-03-30 01:19:03 +00:00
PKG_VERSION="9235942906216dc529c1e96f67dd2364a94d0738"
PKG_URL="https://github.com/hardkernel/${PKG_NAME}/archive/${PKG_VERSION}.tar.gz"
2023-03-29 12:50:23 +00:00
;;
2023-04-29 13:32:09 +00:00
*)
PKG_VERSION="10f8eec3e0f948005b208869a9ec26b1bf896f86"
PKG_URL="https://github.com/${PKG_NAME}/${PKG_NAME}/archive/${PKG_VERSION}.tar.gz"
2023-04-29 13:32:09 +00:00
;;
2023-03-29 12:50:23 +00:00
esac
PKG_NEED_UNPACK="${PROJECT_DIR}/${PROJECT}/bootloader"
[ -n "${DEVICE}" ] && PKG_NEED_UNPACK+=" ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/bootloader"
2023-03-22 21:56:33 +00:00
post_patch() {
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
}
make_target() {
. ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options
if [ -z "${UBOOT_CONFIG}" ]; then
echo "UBOOT_CONFIG must be set to build an image"
else
[ "${BUILD_WITH_DEBUG}" = "yes" ] && PKG_DEBUG=1 || PKG_DEBUG=0
2023-03-29 12:50:23 +00:00
echo "Building for MBR (${UBOOT_DTB})..."
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}
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"
2023-03-22 21:56:33 +00:00
fi
}
makeinstall_target() {
mkdir -p ${INSTALL}/usr/share/bootloader
2023-03-30 15:19:43 +00:00
mkdir -p ${INSTALL}/usr/share/bootloader/fip
2023-03-22 21:56:33 +00:00
# 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
}