From 06112a1e7161aded8cdd4d81f1b3facd1d81ba1f Mon Sep 17 00:00:00 2001 From: PA4WDH Date: Fri, 3 Dec 2021 19:52:00 +0100 Subject: Add sys-boot/u-boot-2021.10 --- sys-boot/u-boot/u-boot-2021.10.ebuild | 89 +++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sys-boot/u-boot/u-boot-2021.10.ebuild (limited to 'sys-boot/u-boot/u-boot-2021.10.ebuild') diff --git a/sys-boot/u-boot/u-boot-2021.10.ebuild b/sys-boot/u-boot/u-boot-2021.10.ebuild new file mode 100644 index 0000000..a34b23c --- /dev/null +++ b/sys-boot/u-boot/u-boot-2021.10.ebuild @@ -0,0 +1,89 @@ +# Copyright 2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +META_SIFIVE="2021.11" +UBOOT_COMMIT="d80bb749fab53da72c4a0e09b8c2d2aaa3103c91" + +DESCRIPTION="U-Boot with meta-sifive-${META_SIFIVE} patches" +HOMEPAGE="https://source.denx.de/u-boot/u-boot" +SRC_URI="https://source.denx.de/u-boot/u-boot/-/archive/${UBOOT_COMMIT}/u-boot-${UBOOT_COMMIT}.tar.gz -> ${P}.tar.gz + https://github.com/sifive/meta-sifive/archive/refs/heads/${META_SIFIVE}.zip -> meta-sifive-${META_SIFIVE}.zip" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="~riscv" + +DEPEND="sys-boot/opensbi sys-apps/dtc dev-lang/swig" +RDEPEND="${DEPEND}" +BDEPEND="" + +IUSE="-1000 -1100 +1200 -1300 -1400 -1500 -1600 -1700 efi-priority" +REQUIRED_USE="^^ ( 1000 1100 1200 1300 1400 1500 1600 1700 )" + +src_unpack() { + unpack ${P}.tar.gz + unpack meta-sifive-${META_SIFIVE}.zip + mv "${WORKDIR}/u-boot-${UBOOT_COMMIT}" "${WORKDIR}/${P}" +} + +src_prepare() { + eapply "${WORKDIR}/meta-sifive-${META_SIFIVE}/recipes-bsp/u-boot/files/riscv64" + + # A default, just to be sure + CONFIG_SPEED=1200000000 + + # Check use flags + use 1000 && CONFIG_SPEED=1000000000 + use 1100 && CONFIG_SPEED=1100000000 + use 1200 && CONFIG_SPEED=1200000000 + use 1300 && CONFIG_SPEED=1300000000 + use 1400 && CONFIG_SPEED=1400000000 + use 1500 && CONFIG_SPEED=1500000000 + use 1600 && CONFIG_SPEED=1600000000 + use 1700 && CONFIG_SPEED=1700000000 + + # Actually modify the dtsi file + sed -i -E -e "/cpus/,/cpu0/ s/assigned-clock-rates = <[0-9]+>/assigned-clock-rates = <${CONFIG_SPEED}>/" "${WORKDIR}/${P}/arch/riscv/dts/fu740-c000-u-boot.dtsi" + elog "Set CPU frquency to $((CONFIG_SPEED/1000000)) Mhz" + + if use efi-priority; then + eapply "${FILESDIR}/efi-priority.patch" + fi + + eapply_user +} + +src_configure() +{ + # Apply Unmatched defconfig + emake sifive_unmatched_defconfig +} + +src_compile() { + # Find opensbi + export OPENSBI=`find /usr/share/opensbi-* -name fw_dynamic.bin | sort | tail -n 1` + if [ -z "$OPENSBI" ]; then + die "Can't find OpenSBI, is sys-boot/opensbi installed?" + fi + elog "Using OpenSBI at ${OPENSBI}" + + # Start the build + emake +} + +src_install() { + mkdir -p "${D}/usr/share/${P}" + cp "${WORKDIR}/${P}/u-boot.itb" "${D}/usr/share/${P}" + cp "${WORKDIR}/${P}/spl/u-boot-spl.bin" "${D}/usr/share/${P}" +} + +pkg_postinst() +{ + einfo "U-Boot files have been installed in /usr/share/${P}. In order" + einfo "to boot with this U-Boot you need to install it to the correct partitions" + einfo "with dd. For example:" + einfo "dd if=/usr/share/${P}/u-boot-spl.bin of=" + einfo "dd if=/usr/share/${P}/u-boot.itb of=" +} -- cgit v1.2.3