File dtb-aarch64.spec of Package kernel-default

#
# spec file for package dtb-aarch64
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define patchversion 4.9.59

%include %_sourcedir/kernel-spec-macros

Name:           dtb-aarch64
Version:        4.9.59
%if 0%{?is_kotd}
Release:        <RELEASE>.g947a2a3
%else
Release:        0
%endif
Summary:        Device Tree files for $MACHINES
License:        GPL-2.0
Group:          System/Boot
Url:            http://www.kernel.org/
BuildRequires:  kernel-source
ExclusiveArch:  aarch64
BuildRequires:  cpp
BuildRequires:  dtc >= 1.4.0
BuildRequires:  xz
Requires:       kernel = %version

%description
Device Tree files for $MACHINES.

%package -n dtb-al
Summary:        Alpine Labs based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-al
Device Tree files for Alpine Labs based arm64 systems.

%package -n dtb-altera
Summary:        Altera based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-altera
Device Tree files for Altera based arm64 systems.

%package -n dtb-amd
Summary:        AMD based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-amd
Device Tree files for AMD based arm64 systems.

%package -n dtb-amlogic
Summary:        Amlogic based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-amlogic
Device Tree files for Amlogic based arm64 systems.

%package -n dtb-apm
Summary:        AppliedMicro based arm64 systems
Group:          System/Boot
Provides:       dtb-apm-mustang = %version
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-apm
Device Tree files for AppliedMicro based arm64 systems.

%package -n dtb-arm
Summary:        ARM Ltd. based arm64 systems
Group:          System/Boot
Provides:       dtb-foundation-v8 = %version
Provides:       dtb-rtsm_ve-aemv8a = %version
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-arm
Device Tree files for ARM Ltd. based arm64 systems.

%package -n dtb-broadcom
Summary:        Broadcom based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-broadcom
Device Tree files for Broadcom based arm64 systems.

%package -n dtb-cavium
Summary:        Cavium based arm64 systems
Group:          System/Boot
Provides:       dtb-thunder-88xx = %version
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-cavium
Device Tree files for Cavium based arm64 systems.

%package -n dtb-exynos
Summary:        Samsung Exynos based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-exynos
Device Tree files for Samsung Exynos based arm64 systems.

%package -n dtb-freescale
Summary:        NXP (Freescale) based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-freescale
Device Tree files for NXP (Freescale) based arm64 systems.

%package -n dtb-hisilicon
Summary:        HiSilicon based arm64 systems
Group:          System/Boot
Provides:       dtb-hisilicon64 = %version
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-hisilicon
Device Tree files for HiSilicon based arm64 systems.

%package -n dtb-lg
Summary:        LG based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-lg
Device Tree files for LG based arm64 systems.

%package -n dtb-marvell
Summary:        Marvell based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-marvell
Device Tree files for Marvell based arm64 systems.

%package -n dtb-mediatek
Summary:        MediaTek based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-mediatek
Device Tree files for MediaTek based arm64 systems.

%package -n dtb-nvidia
Summary:        Nvidia based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-nvidia
Device Tree files for Nvidia based arm64 systems.

%package -n dtb-qcom
Summary:        Qualcomm based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-qcom
Device Tree files for Qualcomm based arm64 systems.

%package -n dtb-renesas
Summary:        Renesas based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-renesas
Device Tree files for Renesas based arm64 systems.

%package -n dtb-rockchip
Summary:        Rockchip based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-rockchip
Device Tree files for Rockchip based arm64 systems.

%package -n dtb-socionext
Summary:        Socionext based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-socionext
Device Tree files for Socionext based arm64 systems.

%package -n dtb-sprd
Summary:        Spreadtrum based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-sprd
Device Tree files for Spreadtrum based arm64 systems.

%package -n dtb-xilinx
Summary:        Xilinx based arm64 systems
Group:          System/Boot
Provides:       multiversion(dtb)
Requires(post): coreutils

%description -n dtb-xilinx
Device Tree files for Xilinx based arm64 systems.



%prep

%build
cp %{_prefix}/src/linux/COPYING .
mkdir pp
PPDIR=`pwd`/pp
export DTC_FLAGS="-R 4 -p 0x1000"

cd %{_prefix}/src/linux/arch/arm64/boot/dts
for dts in al/*.dts altera/*.dts amd/*.dts amlogic/*.dts apm/*.dts arm/*.dts broadcom/*.dts cavium/*.dts exynos/*.dts freescale/*.dts hisilicon/*.dts lg/*.dts marvell/*.dts mediatek/*.dts nvidia/*.dts qcom/*.dts renesas/*.dts rockchip/*.dts socionext/*.dts sprd/*.dts xilinx/*.dts ; do
    target=${dts%*.dts}
    mkdir -p $PPDIR/$(dirname $target)
    cpp -x assembler-with-cpp -undef -D__DTS__ -nostdinc -I. -I./include/ -P $target.dts -o $PPDIR/$target.dts
    dtc $DTC_FLAGS -I dts -O dtb -i ./$(dirname $target) -o $PPDIR/$target.dtb $PPDIR/$target.dts
done

%define dtbdir /boot/dtb-%kernelrelease

%install

cd pp
for dts in al/*.dts altera/*.dts amd/*.dts amlogic/*.dts apm/*.dts arm/*.dts broadcom/*.dts cavium/*.dts exynos/*.dts freescale/*.dts hisilicon/*.dts lg/*.dts marvell/*.dts mediatek/*.dts nvidia/*.dts qcom/*.dts renesas/*.dts rockchip/*.dts socionext/*.dts sprd/*.dts xilinx/*.dts ; do
    target=${dts%*.dts}
    install -m 700 -d %{buildroot}%{dtbdir}/$(dirname $target)
    install -m 644 $target.dtb %{buildroot}%{dtbdir}/$(dirname $target)
%ifarch aarch64
    # HACK: work around U-Boot ignoring vendor dir
    baselink=%{dtbdir}/$(basename $target).dtb
    vendordir=$(basename $(dirname $target))
    ln -s $target.dtb %{buildroot}$baselink
    echo $baselink >> ../dtb-$vendordir.list
%endif
done
cd -

%post -n dtb-al
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-altera
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-amd
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-amlogic
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-apm
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-arm
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-broadcom
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-cavium
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-exynos
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-freescale
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-hisilicon
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-lg
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-marvell
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-mediatek
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-nvidia
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-qcom
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-renesas
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-rockchip
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-socionext
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-sprd
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%post -n dtb-xilinx
cd /boot
# If /boot/dtb is a symlink, remove it, so that we can replace it.
[ -d dtb ] && [ -L dtb ] && rm -f dtb
# Unless /boot/dtb exists as real directory, create a symlink.
[ -d dtb ] || ln -sf dtb-%kernelrelease dtb

%ifarch aarch64
%files -n dtb-al -f dtb-al.list
%else
%files -n dtb-al
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/al
%{dtbdir}/al/*.dtb

%ifarch aarch64
%files -n dtb-altera -f dtb-altera.list
%else
%files -n dtb-altera
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/altera
%{dtbdir}/altera/*.dtb

%ifarch aarch64
%files -n dtb-amd -f dtb-amd.list
%else
%files -n dtb-amd
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/amd
%{dtbdir}/amd/*.dtb

%ifarch aarch64
%files -n dtb-amlogic -f dtb-amlogic.list
%else
%files -n dtb-amlogic
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/amlogic
%{dtbdir}/amlogic/*.dtb

%ifarch aarch64
%files -n dtb-apm -f dtb-apm.list
%else
%files -n dtb-apm
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/apm
%{dtbdir}/apm/*.dtb

%ifarch aarch64
%files -n dtb-arm -f dtb-arm.list
%else
%files -n dtb-arm
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/arm
%{dtbdir}/arm/*.dtb

%ifarch aarch64
%files -n dtb-broadcom -f dtb-broadcom.list
%else
%files -n dtb-broadcom
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/broadcom
%{dtbdir}/broadcom/*.dtb

%ifarch aarch64
%files -n dtb-cavium -f dtb-cavium.list
%else
%files -n dtb-cavium
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/cavium
%{dtbdir}/cavium/*.dtb

%ifarch aarch64
%files -n dtb-exynos -f dtb-exynos.list
%else
%files -n dtb-exynos
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/exynos
%{dtbdir}/exynos/*.dtb

%ifarch aarch64
%files -n dtb-freescale -f dtb-freescale.list
%else
%files -n dtb-freescale
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/freescale
%{dtbdir}/freescale/*.dtb

%ifarch aarch64
%files -n dtb-hisilicon -f dtb-hisilicon.list
%else
%files -n dtb-hisilicon
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/hisilicon
%{dtbdir}/hisilicon/*.dtb

%ifarch aarch64
%files -n dtb-lg -f dtb-lg.list
%else
%files -n dtb-lg
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/lg
%{dtbdir}/lg/*.dtb

%ifarch aarch64
%files -n dtb-marvell -f dtb-marvell.list
%else
%files -n dtb-marvell
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/marvell
%{dtbdir}/marvell/*.dtb

%ifarch aarch64
%files -n dtb-mediatek -f dtb-mediatek.list
%else
%files -n dtb-mediatek
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/mediatek
%{dtbdir}/mediatek/*.dtb

%ifarch aarch64
%files -n dtb-nvidia -f dtb-nvidia.list
%else
%files -n dtb-nvidia
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/nvidia
%{dtbdir}/nvidia/*.dtb

%ifarch aarch64
%files -n dtb-qcom -f dtb-qcom.list
%else
%files -n dtb-qcom
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/qcom
%{dtbdir}/qcom/*.dtb

%ifarch aarch64
%files -n dtb-renesas -f dtb-renesas.list
%else
%files -n dtb-renesas
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/renesas
%{dtbdir}/renesas/*.dtb

%ifarch aarch64
%files -n dtb-rockchip -f dtb-rockchip.list
%else
%files -n dtb-rockchip
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/rockchip
%{dtbdir}/rockchip/*.dtb

%ifarch aarch64
%files -n dtb-socionext -f dtb-socionext.list
%else
%files -n dtb-socionext
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/socionext
%{dtbdir}/socionext/*.dtb

%ifarch aarch64
%files -n dtb-sprd -f dtb-sprd.list
%else
%files -n dtb-sprd
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/sprd
%{dtbdir}/sprd/*.dtb

%ifarch aarch64
%files -n dtb-xilinx -f dtb-xilinx.list
%else
%files -n dtb-xilinx
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%dir %{dtbdir}/xilinx
%{dtbdir}/xilinx/*.dtb

%changelog