diff --git a/uboot-tools.spec b/uboot-tools.spec index 3e1a5f3834f92cb6ae66ed47c7de35a8a81cc291..218d585990c78b6ada112756a20de11a1454025d 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,41 +1,38 @@ -%define anolis_release 1 +%define anolis_release 2 + %bcond_without toolsonly Name: uboot-tools +Summary: U-Boot utilities Version: 2022.04 Release: %{anolis_release}%{?dist} -Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot - -ExcludeArch: s390x Source0: https://ftp.denx.de/pub/u-boot/u-boot-%{version}%{?candidate:-%{candidate}}.tar.bz2 Source1: aarch64-boards +ExcludeArch: s390x + +BuildRequires: gnutls-devel libuuid-devel ncurses-devel openssl-devel perl-interpreter +BuildRequires: python3-devel python3-setuptools python3-libfdt +BuildRequires: dtc bc flex SDL-devel swig +BuildRequires: bison gcc make -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: SDL-devel -BuildRequires: swig %ifarch aarch64 BuildRequires: arm-trusted-firmware-armv8 %endif + Requires: dtc %description -This package contains a few U-Boot utilities - mkimage for creating boot images -and fw_printenv/fw_setenv for manipulating the boot environment variables. +U-Boot is a commonly used bootloader for embedded systems. +It is open-source software that allows loading and executing firmware +images on a variety of hardware platforms. U-Boot tools, on the other hand, +are a collection of command-line utilities that help manage and manipulate +U-Boot images. These tools include utilities for creating, modifying, and +inspecting U-Boot images, as well as for flashing images to hardware devices. +The tools are widely used by developers and engineers working on embedded +systems, particularly in the automotive, networking, and industrial +automation industries. %if %{with toolsonly} %ifarch aarch64 @@ -46,72 +43,78 @@ BuildArch: noarch %description -n uboot-images-armv8 U-Boot firmware binaries for aarch64 boards %endif - %endif +%package doc +Summary: A doc pkg for %{name} +Requires: %{name} = %{EVR} +BuildArch: noarch + +%description doc +The document package provices documentation files for %{name}. +Including the Changes file and the README file, etc. + %prep -%autosetup -p1 -n u-boot-%{version}%{?candidate:-%{candidate}} +%autosetup -n u-boot-%{version}%{?candidate:-%{candidate}} -p1 cp %SOURCE1 . %build mkdir builds -%make_build HOSTCC="gcc $RPM_OPT_FLAGS" CROSS_COMPILE="" tools-only_defconfig O=builds/ -%make_build HOSTCC="gcc $RPM_OPT_FLAGS" CROSS_COMPILE="" tools-all O=builds/ +%make_build HOSTCC="gcc $RPM_OPT_FLAGS" \ + CROSS_COMPILE="" tools-only_defconfig O=builds/ + +%make_build HOSTCC="gcc $RPM_OPT_FLAGS" \ + CROSS_COMPILE="" tools-all O=builds/ %if %{with toolsonly} -# U-Boot device firmwares don't currently support LTO %define _lto_cflags %{nil} %ifarch aarch64 -for board in $(cat %{_arch}-boards) +for brd in $(cat %{_arch}-boards) do - echo "Building board: $board" - mkdir builds/$(echo $board)/ + echo "Building board: $brd" + mkdir builds/$(echo $brd)/ - # ATF selection, needs improving, suggestions of ATF SoC to Board matrix welcome sun50i=(a64-olinuxino amarula_a64_relic bananapi_m2_plus_h5 bananapi_m64 libretech_all_h3_cc_h5 nanopi_a64 nanopi_neo2 nanopi_neo_plus2 orangepi_pc2 orangepi_prime orangepi_win orangepi_zero_plus orangepi_zero_plus2 pine64-lts pine64_plus pinebook pinephone pinetab sopine_baseboard teres_i) - if [[ " ${sun50i[*]} " == *" $board "* ]]; then - echo "Board: $board using sun50i_a64" - cp /usr/share/arm-trusted-firmware/sun50i_a64/* builds/$(echo $board)/ + if [[ " ${sun50i[*]} " == *" $brd "* ]]; then + echo "Board: $brd using sun50i_a64" + cp /usr/share/arm-trusted-firmware/sun50i_a64/* builds/$(echo $brd)/ fi sun50h6=(beelink_gs1 orangepi_3 orangepi_lite2 orangepi_one_plus orangepi_zero2 pine_h64 tanix_tx6) - if [[ " ${sun50h6[*]} " == *" $board "* ]]; then - echo "Board: $board using sun50i_h6" - cp /usr/share/arm-trusted-firmware/sun50i_h6/* builds/$(echo $board)/ + if [[ " ${sun50h6[*]} " == *" $brd "* ]]; then + echo "Board: $brd using sun50i_h6" + cp /usr/share/arm-trusted-firmware/sun50i_h6/* builds/$(echo $brd)/ fi rk3328=(evb-rk3328 nanopi-r2s-rk3328 rock64-rk3328 rock-pi-e-rk3328 roc-cc-rk3328) - if [[ " ${rk3328[*]} " == *" $board "* ]]; then - echo "Board: $board using rk3328" - cp /usr/share/arm-trusted-firmware/rk3328/* builds/$(echo $board)/ + if [[ " ${rk3328[*]} " == *" $brd "* ]]; then + echo "Board: $brd using rk3328" + cp /usr/share/arm-trusted-firmware/rk3328/* builds/$(echo $brd)/ fi rk3399=(evb-rk3399 ficus-rk3399 firefly-rk3399 khadas-edge-captain-rk3399 khadas-edge-rk3399 khadas-edge-v-rk3399 leez-rk3399 nanopc-t4-rk3399 nanopi-m4-2gb-rk3399 nanopi-m4b-rk3399 nanopi-m4-rk3399 nanopi-neo4-rk3399 nanopi-r4s-rk3399 orangepi-rk3399 pinebook-pro-rk3399 puma-rk3399 rock960-rk3399 rock-pi-4c-rk3399 rock-pi-4-rk3399 rock-pi-n10-rk3399pro rockpro64-rk3399 roc-pc-mezzanine-rk3399 roc-pc-rk3399) - if [[ " ${rk3399[*]} " == *" $board "* ]]; then - echo "Board: $board using rk3399" - cp /usr/share/arm-trusted-firmware/rk3399/* builds/$(echo $board)/ + if [[ " ${rk3399[*]} " == *" $brd "* ]]; then + echo "Board: $brd using rk3399" + cp /usr/share/arm-trusted-firmware/rk3399/* builds/$(echo $brd)/ fi # End ATF - make $(echo $board)_defconfig O=builds/$(echo $board)/ - %make_build HOSTCC="gcc $RPM_OPT_FLAGS" CROSS_COMPILE="" O=builds/$(echo $board)/ + make $(echo $brd)_defconfig O=builds/$(echo $brd)/ + %make_build HOSTCC="gcc $RPM_OPT_FLAGS" CROSS_COMPILE="" O=builds/$(echo $brd)/ - # build spi images for rockchip boards with SPI flash rkspi=(evb-rk3399 khadas-edge-captain-rk3399 khadas-edge-rk3399 khadas-edge-v-rk3399 nanopc-t4-rk3399 pinebook-pro-rk3399 rockpro64-rk3399 roc-pc-mezzanine-rk3399 roc-pc-rk3399) - if [[ " ${rkspi[*]} " == *" $board "* ]]; then - echo "Board: $board with SPI flash" - builds/$(echo $board)/tools/mkimage -n rk3399 -T rkspi -d builds/$(echo $board)/tpl/u-boot-tpl.bin:builds/$(echo $board)/spl/u-boot-spl.bin builds/$(echo $board)/idbloader.spi + if [[ " ${rkspi[*]} " == *" $brd "* ]]; then + echo "Board: $brd with SPI flash" + builds/$(echo $brd)/tools/mkimage -n rk3399 -T rkspi -d builds/$(echo $brd)/tpl/u-boot-tpl.bin:builds/$(echo $brd)/spl/u-boot-spl.bin builds/$(echo $brd)/idbloader.spi fi - # build spi, and uart images for mvebu boards - # mvebu=(clearfog helios4 turris_omnia) - if [[ " ${mvebu[*]} " == *" $board "* ]]; then + if [[ " ${mvebu[*]} " == *" $brd "* ]]; then for target in spi uart do - echo "Board: $board Target: $target" - sed -i -e '/CONFIG_MVEBU_SPL_BOOT_DEVICE_/d' configs/$(echo $board)_defconfig - echo CONFIG_MVEBU_SPL_BOOT_DEVICE_${target^^}=y >> configs/$(echo $board)_defconfig - make $(echo $board)_defconfig O=builds/$(echo $board-$target)/ - %make_build HOSTCC="gcc $RPM_OPT_FLAGS" CROSS_COMPILE="" O=builds/$(echo $board-$target)/ + echo "Board: $brd Target: $target" + sed -i -e '/CONFIG_MVEBU_SPL_BOOT_DEVICE_/d' configs/$(echo $brd)_defconfig + echo CONFIG_MVEBU_SPL_BOOT_DEVICE_${target^^}=y >> configs/$(echo $brd)_defconfig + make $(echo $brd)_defconfig O=builds/$(echo $brd-$target)/ + %make_build HOSTCC="gcc $RPM_OPT_FLAGS" CROSS_COMPILE="" O=builds/$(echo $brd-$target)/ done fi done @@ -126,42 +129,41 @@ mkdir -p %{buildroot}%{_datadir}/uboot/ %if %{with toolsonly} %ifarch aarch64 -for board in $(ls builds) +for brd in $(ls builds) do - mkdir -p %{buildroot}%{_datadir}/uboot/$(echo $board)/ + mkdir -p %{buildroot}%{_datadir}/uboot/$(echo $brd)/ for file in u-boot.bin u-boot.dtb u-boot.img u-boot-dtb.img u-boot.itb u-boot-sunxi-with-spl.bin u-boot-rockchip.bin idbloader.img idbloader.spi spl/boot.bin spl/sunxi-spl.bin do - if [ -f builds/$(echo $board)/$(echo $file) ]; then - install -p -m 0644 builds/$(echo $board)/$(echo $file) %{buildroot}%{_datadir}/uboot/$(echo $board)/ + if [ -f builds/$(echo $brd)/$(echo $file) ]; then + install -p -m 0644 builds/$(echo $brd)/$(echo $file) %{buildroot}%{_datadir}/uboot/$(echo $brd)/ fi done done %endif -# Bit of a hack to remove binaries we don't use as they're large %ifarch aarch64 -for board in $(ls builds) +for brd in $(ls builds) do - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.dtb - if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot-sunxi-with-spl.bin ]; then - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot{,-dtb}.* + rm -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot.dtb + if [ -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot-sunxi-with-spl.bin ]; then + rm -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot{,-dtb}.* fi - if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/MLO ]; then - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.bin + if [ -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/MLO ]; then + rm -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot.bin fi - if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/SPL ]; then - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.bin + if [ -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/SPL ]; then + rm -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot.bin fi - if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.imx ]; then - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.bin + if [ -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot.imx ]; then + rm -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot.bin fi - if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot-spl.kwb ]; then - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.* - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot-spl.bin + if [ -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot-spl.kwb ]; then + rm -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot.* + rm -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot-spl.bin fi - if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/idbloader.img ]; then - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.bin - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot{,-dtb}.img + if [ -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/idbloader.img ]; then + rm -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot.bin + rm -f %{buildroot}%{_datadir}/uboot/$(echo $brd)/u-boot{,-dtb}.img fi done %endif @@ -169,35 +171,31 @@ done for tool in bmp_logo dumpimage env/fw_printenv fit_check_sign fit_info gdb/gdbcont gdb/gdbsend gen_eth_addr gen_ethaddr_crc img2srec mkenvimage mkimage mksunxiboot ncb proftool sunxi-spl-image-builder ubsha1 xway-swap-bytes kwboot do -install -p -m 0755 builds/tools/$tool %{buildroot}%{_bindir} +install -pm0755 builds/tools/$tool %{buildroot}%{_bindir} done -install -p -m 0644 doc/mkimage.1 %{buildroot}%{_mandir}/man1 +install -pm0644 doc/mkimage.1 %{buildroot}%{_mandir}/man1 -install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} +install -pm0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} ( cd %{buildroot}%{_bindir}; ln -sf fw_printenv fw_setenv ) -# Copy some useful docs over mkdir -p builds/docs -cp -p board/hisilicon/hikey/README builds/docs/README.hikey -cp -p board/Marvell/db-88f6820-gp/README builds/docs/README.mvebu-db-88f6820 cp -p board/rockchip/evb_rk3399/README builds/docs/README.evb_rk3399 -cp -p board/solidrun/clearfog/README builds/docs/README.clearfog -cp -p board/solidrun/mx6cuboxi/README builds/docs/README.mx6cuboxi -cp -p board/sunxi/README.sunxi64 builds/docs/README.sunxi64 -cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand cp -p board/ti/omap5_uevm/README builds/docs/README.omap5_uevm -cp -p board/udoo/README builds/docs/README.udoo cp -p board/wandboard/README builds/docs/README.wandboard cp -p board/warp/README builds/docs/README.warp +cp -p board/solidrun/mx6cuboxi/README builds/docs/README.mx6cuboxi cp -p board/warp7/README builds/docs/README.warp7 +cp -p board/hisilicon/hikey/README builds/docs/README.hikey +cp -p board/udoo/README builds/docs/README.udoo +cp -p board/Marvell/db-88f6820-gp/README builds/docs/README.mvebu-db-88f6820 +cp -p board/solidrun/clearfog/README builds/docs/README.clearfog +cp -p board/sunxi/README.sunxi64 builds/docs/README.sunxi64 +cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %files -%doc README doc/README.kwbimage doc/develop/distro.rst doc/README.gpt -%doc doc/README.odroid doc/README.rockchip doc/develop/uefi doc/uImage.FIT doc/arch/arm64.rst -%doc builds/docs/* doc/board/amlogic/ doc/board/rockchip/ doc/board/ti/am335x_evm.rst +%dir %{_datadir}/uboot/ %{_bindir}/* %{_mandir}/man1/mkimage.1* -%dir %{_datadir}/uboot/ %if %{with toolsonly} %ifarch aarch64 @@ -206,7 +204,15 @@ cp -p board/warp7/README builds/docs/README.warp7 %endif %endif +%files doc +%doc doc/develop/distro.rst README doc/README.kwbimage doc/README.gpt +%doc builds/docs/* doc/board/amlogic/ doc/board/rockchip/ doc/board/ti/am335x_evm.rst +%doc doc/README.odroid doc/README.rockchip doc/develop/uefi doc/uImage.FIT doc/arch/arm64.rst + %changelog +* Thu Apr 13 2023 Heng Qi - 2022.04-2 +- Refactot the spec file + * Wed Apr 13 2022 Chunmei Xu - 2022.04-1 - init from upstream - remove unsupported pinephone-pro-rk3399