aboutsummaryrefslogtreecommitdiffstats
path: root/sys-boot/u-boot/u-boot-2024.01.ebuild
diff options
context:
space:
mode:
authorPA4WDH2024-07-06 11:15:10 +0200
committerPA4WDH2024-07-06 11:15:10 +0200
commit25dee51c26924e4c6d8e6e0467b942d51e2a5f84 (patch)
tree503860c1d1b8b4db57ef3d3c9ed0046ea7b59a95 /sys-boot/u-boot/u-boot-2024.01.ebuild
parentAdd sys-apps/sysvinit-3.08 (diff)
downloadunmatched-patchwork-master.tar.gz
unmatched-patchwork-master.tar.bz2
unmatched-patchwork-master.zip
Add sys-boot/opensbi-1.4 and sys-boot/u-boot-2024.01HEADmaster
Diffstat (limited to 'sys-boot/u-boot/u-boot-2024.01.ebuild')
-rw-r--r--sys-boot/u-boot/u-boot-2024.01.ebuild89
1 files changed, 89 insertions, 0 deletions
diff --git a/sys-boot/u-boot/u-boot-2024.01.ebuild b/sys-boot/u-boot/u-boot-2024.01.ebuild
new file mode 100644
index 0000000..46dd001
--- /dev/null
+++ b/sys-boot/u-boot/u-boot-2024.01.ebuild
@@ -0,0 +1,89 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+META_SIFIVE="2024.03"
+UBOOT_COMMIT="866ca972d6c3cabeaf6dbac431e8e08bb30b3c8e"
+
+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=<partition with type \"HiFive Unleashed FSBL\">"
+ einfo "dd if=/usr/share/${P}/u-boot.itb of=<partition with type \"HiFive Unleashed BBL\">"
+}