%global debug_package %{nil} %global __strip /bin/true %define _build_id_links none %global gitdate 20240721 %global commit 5024a96db8ea6ff2e814f4599af9e5faf09296b7 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global version 2024.07 %global release 6 # set this to "1" if building a git/beta/rc release %global beta_or_rc 1 #============================================================================= # general #----------------------------------------------------------------------------- Name: u-boot-rockchip Version: %{version} %if %{beta_or_rc} Release: 0.%{release}.%{gitdate}.git%{shortcommit}%{?dist} %else Release: %{release}%{?dist} %endif Summary: U-Boot-Rockchip with patches for the Odroid M1/RK3568 License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: https://source.denx.de/u-boot/u-boot Source0: u-boot-%{version}-git%{shortcommit}.tar.gz # alternatively, if is has newer fixes, use: # git repo from Kwiboo/Jonas Karlman # use branch rk35xx-2024.01 #URL: https://github.com/Kwiboo/u-boot-rockchip #Source0: u-boot-rockchip-%%{version}-git%%{shortcommit}.tar.gz # https://github.com/rockchip-linux/rkbin Source1: rkbin.tar.gz # https://github.com/Kwiboo/u-boot-build Source2: README-u-boot-build.md # from the Fedora spec # https://src.fedoraproject.org/rpms/uboot-tools/blob/rawhide/f/uboot-tools.spec # This is now legacy, most devices use bootflow, we keep this for the laggards Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch # Identify VFAT partitions as ESP, allows EFI setvar on our images Patch2: uefi-Add-all-options-for-EFI-System-Partitions.patch # New function to find fdt for loading from disk Patch3: uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch # Fedora patches to enable/disable features Patch4: disable-VBE-by-default.patch Patch5: enable-bootmenu-by-default.patch # Should be upstream but it's taking time Patch6: Add-video-damage-tracking.patch # Rockchips improvements Patch10: rockchip-Enable-preboot-start-for-pci-usb.patch # BuildRequires: bc BuildRequires: bison BuildRequires: dtc BuildRequires: flex BuildRequires: gcc BuildRequires: gnutls-devel BuildRequires: libuuid-devel BuildRequires: make BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: perl-interpreter BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-libfdt BuildRequires: SDL2-devel BuildRequires: swig # for cross compile BuildRequires: gcc-aarch64-linux-gnu BuildRequires: python3-pyelftools # for BL31 #BuildRequires: arm-trusted-firmware-armv8 # for creating rk356x_spl_loader_*.bin BuildRequires: rkdeveloptool Requires: rkdeveloptool %description u-boot rockchip rk3568-%{version} firmware pre-release binaries for the Odroid M1/RK3568. #============================================================================= # prep #----------------------------------------------------------------------------- %prep %if %{beta_or_rc} %autosetup -p1 -n u-boot %else %autosetup -p1 -n u-boot-%{version} %endif # unpack latest rkbin from https://github.com/rockchip-linux/rkbin tar -xvzf %{SOURCE1} cp -av %{SOURCE2} . # enable some options in configs/odroid-m1-rk3568_defconfig echo "CONFIG_CMD_BOOTMENU=y" >> configs/odroid-m1-rk3568_defconfig echo "CONFIG_AUTOBOOT_KEYED=y" >> configs/odroid-m1-rk3568_defconfig echo "CONFIG_BOOTDELAY=5" >> configs/odroid-m1-rk3568_defconfig echo "CONFIG_AUTOBOOT_MENU_SHOW=y" >> configs/odroid-m1-rk3568_defconfig echo "CONFIG_CMD_BOOTEFI_BOOTMGR=y" >> configs/odroid-m1-rk3568_defconfig echo "CONFIG_USE_PREBOOT=y" >> configs/odroid-m1-rk3568_defconfig echo 'CONFIG_PREBOOT="pci enum; usb start; scsi scan; nvme scan;"' >> configs/odroid-m1-rk3568_defconfig #============================================================================= # build #----------------------------------------------------------------------------- %build mkdir builds # see https://github.com/Kwiboo/u-boot-build/blob/main/.github/workflows/rk356x.yml # see https://github.com/rockchip-linux/rkbin DDRBIN='bin/rk35/rk3568_ddr_1560MHz_v1.21.bin' sed -i 's/uart baudrate=/uart baudrate=1500000/' rkbin/tools/ddrbin_param.txt sed -i 's/dis_train_print=/dis_train_print=1/' rkbin/tools/ddrbin_param.txt rkbin/tools/ddrbin_tool rk3568 rkbin/tools/ddrbin_param.txt rkbin/$DDRBIN export ROCKCHIP_TPL=rkbin/$DDRBIN export BL31=rkbin/bin/rk35/rk3568_bl31_v1.44.elf # from arm-trusted-firmware-arm8 #export BL31=/usr/share/arm-trusted-firmware/rk3568/bl31.elf # for the 'odroid-m1-rk3568' config name see: # https://source.denx.de/u-boot/u-boot/-/tree/master/configs %make_build mrproper %make_build CROSS_COMPILE=aarch64-linux-gnu- odroid-m1-rk3568_defconfig O=builds/ V=1 %make_build CROSS_COMPILE=aarch64-linux-gnu- -j8 O=builds/ V=1 # https://gitlab.collabora.com/hardware-enablement/rockchip-3588/notes-for-rockchip-3588/-/blob/main/upstream_uboot.md?ref_type=heads#building-the-rockchip-loader-binaries pushd rkbin # create the SPL loader with both boot_merger and rkdeveloptool ./tools/boot_merger RKBOOT/RK3568MINIALL.ini cp -av RKBOOT/RK3568MINIALL.ini config.ini # rename the loader by adding rkdeveloptool to the filename sed -i -e's|^PATH=rk356x_spl_loader_v1.21.113.bin|PATH=rk356x_spl_loader_v1.21.113_rkdeveloptool.bin|' config.ini # remove incompatible sections sed -i -e'21,25d' config.ini # generate the SPL loader rkdeveloptool pack ls -lia rk356x_spl_loader*.bin popd #============================================================================= # install #----------------------------------------------------------------------------- %install mkdir -p %{buildroot}%{_datadir}/%{name}/Odroid-M1 cp -av builds/u-boot* %{buildroot}%{_datadir}/%{name}/Odroid-M1/ cp -av builds/idbloader* %{buildroot}%{_datadir}/%{name}/Odroid-M1/ # see rkbin/RKBOOT/RK3568MINIALL.ini cp -av rkbin/rk356x_spl_loader_*.bin %{buildroot}%{_datadir}/%{name}/Odroid-M1/ #============================================================================= # files #----------------------------------------------------------------------------- %files %doc README README-u-boot-build.md %{_datadir}/%{name}/Odroid-M1 #============================================================================= # changelog #----------------------------------------------------------------------------- %changelog * Wed Jul 24 2024 Patrick Laimbock - 2024.07-0.6 - disable arm-trusted BL31 again, hangs at boot * Wed Jul 24 2024 Patrick Laimbock - 2024.07-0.5 - build against RK3568 BL31 from arm-trusted-firmware-armv8 * Wed Jul 24 2024 Patrick Laimbock - 2024.07-0.4 - also use rkdeveloptool to create the SPL loader (it's open source) * Tue Jul 23 2024 Patrick Laimbock - 2024.07-0.3 - add the SPL loader rk356x_spl_loader_*.bin * Sun Jul 21 2024 Patrick Laimbock - 2024.07-0.2 - enable the bootmenu and preboot scans * Sun Jul 21 2024 Patrick Laimbock - 2024.07-0.1 - update to git rev 5024a96db8ea6ff2e814f4599af9e5faf09296b7 * Fri Jan 19 2024 Patrick Laimbock - 2024.01-2 - remove debian patch * Wed Jan 17 2024 Patrick Laimbock - 2024.01-1 - switch to rk35xx-2024.01 branch - update to git rev 583d37d192d92c5e92efa68b1d97f8ecdef71c47 - add rockchip-inno-usb.patch from debian - add Fedora patches * Tue Aug 22 2023 Patrick Laimbock - 2023.10-0.3 - update to git rev 84bcf08a3e2b9a67abfb7c980d7d606d0334cc5d * Tue Aug 08 2023 Patrick Laimbock - 2023.10-0.2 - add README-u-boot-build.md from https://github.com/Kwiboo/u-boot-build * Tue Aug 08 2023 Patrick Laimbock - 2023.10-0.1 - build Kwiboo's u-boot 2023.10 for the Odroid M1 - git rev 16cb31d42768767cfc1e274655e9bd1689c0de6d - rkbin git rev b4558da0860ca48bf1a571dd33ccba580b9abe23