# Match scripts/bootloader/uboot.sh's linux-hekatf fork; never use distro U-Boot. %global commit 12d7116345200d8b8bcdb42690256286e73a6e37 %global debug_package %{nil} %global _lto_cflags %{nil} Name: switch-uboot Version: 2025.2b Release: 5%{?dist} Summary: Linux 4 Switch U-Boot BL33 payload License: GPL-2.0-or-later URL: https://gitlab.com/l4t-community/bootstack/u-boot ExclusiveArch: aarch64 Source0: %{url}/-/archive/%{commit}/u-boot-%{commit}.tar.gz BuildRequires: gcc BuildRequires: make BuildRequires: bison BuildRequires: flex BuildRequires: dtc BuildRequires: bc BuildRequires: openssl-devel BuildRequires: python3-devel BuildRequires: swig %description Pinned L4S U-Boot built with nintendo-switch_defconfig. This package provides BL33 to bootstack assembly; it does not install a host bootloader or firmware. %prep %autosetup -n u-boot-%{commit} # BL33 relocates itself. Preserve its PIE text relocations with modern binutils. sed -i 's/LDFLAGS_u-boot += -pie$/LDFLAGS_u-boot += -pie -z notext/' arch/arm/config.mk # GNU make 4.4 preserves the old escaped hash; printf emits the preprocessor # directive portably without relying on make's historical hash unescaping. python3 - <<'PYCODE' from pathlib import Path p = Path('scripts/Makefile.lib') s = p.read_text() old = "echo '" + chr(92) + '#include ' + chr(34) + '$(u_boot_dtsi)' + chr(34) + "'" new = "printf '" + chr(92) + '043include "%%s"' + chr(92) + "n' " + '"$(u_boot_dtsi)"' assert old in s s = s.replace(old, new) p.write_text(s) PYCODE %build make nintendo-switch_defconfig # The old Python libfdt binding is a host utility, not part of BL33. It needs # removed distutils; no enabled Switch image target consumes it. %make_build PYTHON=python3 CONFIG_PYLIBFDT=n %check test -s u-boot.bin readelf -h u-boot | grep -q 'Machine:.*AArch64' %install install -Dpm0644 u-boot.bin %{buildroot}%{_datadir}/l4s-boot/bl33.bin printf '%%s\n' '%{commit}' > %{buildroot}%{_datadir}/l4s-boot/uboot.commit %files %license Licenses/README %{_datadir}/l4s-boot/