Michal Marek 797591
#
Michal Marek cdcab9
# spec file for package $NAME
Michal Marek 797591
#
Takashi Iwai 39a1fc
# Copyright (c) @YEAR@ SUSE LLC
Michal Marek 797591
#
Michal Marek 797591
# All modifications and additions to the file contributed by third parties
Michal Marek 797591
# remain the property of their copyright owners, unless otherwise agreed
Michal Marek 797591
# upon. The license for this file, and modifications and additions to the
Michal Marek 797591
# file, is the same license as for the pristine package itself (unless the
Michal Marek 797591
# license for the pristine package is not an Open Source License, in which
Michal Marek 797591
# case the license is the MIT License). An "Open Source License" is a
Michal Marek 797591
# license that conforms to the Open Source Definition (Version 1.9)
Michal Marek 797591
# published by the Open Source Initiative.
Michal Marek 797591
77b5f8
# Please submit bugfixes or comments via https://bugs.opensuse.org/
Michal Marek 797591
#
Michal Marek 797591
Michal Marek cdcab9
Michal Marek 4e37db
%define srcversion @SRCVERSION@
Michal Marek 814c4e
%define patchversion @PATCHVERSION@
Michal Marek 4e37db
%define variant @VARIANT@%{nil}
Michal Marek 814c4e
Michal Marek 814c4e
%include %_sourcedir/kernel-spec-macros
Michal Marek 797591
Andreas Färber c94e64
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} >= 120300 )
Andreas Färber c94e64
%define dtc_symbols 1
Andreas Färber c94e64
%endif
Andreas Färber c94e64
Michal Marek 4e37db
%(chmod +x %_sourcedir/{@SCRIPTS@})
Michal Marek 4e37db
Michal Marek 797591
Name:           $NAME
Michal Marek 814c4e
Version:        @RPMVERSION@
Michal Marek 814c4e
%if 0%{?is_kotd}
Michal Marek 814c4e
Release:        <RELEASE>.g@COMMIT@
Michal Marek 814c4e
%else
Michal Marek 814c4e
Release:        @RELEASE@
Michal Marek 814c4e
%endif
Michal Marek 797591
Summary:        Device Tree files for $MACHINES
Michal Kubecek f888e0
License:        GPL-2.0-only
Michal Marek 797591
Group:          System/Boot
77b5f8
URL:            https://www.kernel.org/
Michal Marek 797591
$ARCH_RESTRICTIONS
Michal Marek 797591
BuildRequires:  cpp
Andreas Färber c94e64
%if 0%{?dtc_symbols}
Andreas Färber c94e64
BuildRequires:  dtc >= 1.4.3
Andreas Färber c94e64
%else
Michal Marek 797591
BuildRequires:  dtc >= 1.4.0
Andreas Färber c94e64
%endif
Michal Marek 797591
BuildRequires:  xz
Michal Marek 814c4e
Requires:       kernel = %version
Michal Marek 4e37db
@SOURCES@
Michal Marek 797591
Michal Marek 797591
%description
Michal Marek 797591
Device Tree files for $MACHINES.
Michal Marek 797591
Michal Marek 797591
$SUBPKG_DESC
Michal Marek 797591
Michal Marek 797591
%prep
Michal Marek 4e37db
# Unpack all sources and patches
Michal Marek 4e37db
%setup -q -c -T -a 0 @UNPACK_PATCHES@
Michal Marek 4e37db
cd linux-%srcversion
Michal Marek 4e37db
%_sourcedir/apply-patches %_sourcedir/series.conf ..
Michal Marek 4e37db
Michal Marek 797591
Michal Marek 797591
%build
Michal Marek 4e37db
source=linux-%srcversion
Michal Marek 4de517
cp $source/COPYING .
87ca1f
SRCDIR=$PWD/$source
Michal Marek 797591
mkdir pp
87ca1f
PPDIR=$PWD/pp
Michal Marek 797591
export DTC_FLAGS="-R 4 -p 0x1000"
Andreas Färber c94e64
%if 0%{?dtc_symbols}
Andreas Färber c94e64
DTC_FLAGS="$DTC_FLAGS -@"
Andreas Färber c94e64
%endif
Michal Marek 797591
Michal Marek 4de517
cd $source/$DTS_folder
Michal Marek 797591
for dts in $ALL_SUPPORTED_DTB; do
Michal Marek 797591
    target=${dts%*.dts}
Michal Marek 797591
    mkdir -p $PPDIR/$(dirname $target)
Andreas Färber c8d853
    cpp -x assembler-with-cpp -undef -D__DTS__ -nostdinc -I. -I$SRCDIR/include/ -I$SRCDIR/scripts/dtc/include-prefixes/ -P $target.dts -o $PPDIR/$target.dts
Michal Marek 797591
    dtc $DTC_FLAGS -I dts -O dtb -i ./$(dirname $target) -o $PPDIR/$target.dtb $PPDIR/$target.dts
Michal Marek 797591
done
Michal Marek 797591
Michal Marek 814c4e
%define dtbdir /boot/dtb-%kernelrelease
Michal Marek 797591
Michal Marek 797591
%install
Michal Marek 797591
Michal Marek 797591
cd pp
Michal Marek 797591
for dts in $ALL_SUPPORTED_DTB; do
Michal Marek 797591
    target=${dts%*.dts}
Andreas Schwab a69437
    install -m 755 -d %{buildroot}%{dtbdir}/$(dirname $target)
Michal Suchanek 0e5fcf
    # install -m 644 COPYING %{buildroot}%{dtbdir}/$(dirname $target)
Michal Marek 797591
    install -m 644 $target.dtb %{buildroot}%{dtbdir}/$(dirname $target)
Andreas Schwab c2885e
%ifarch aarch64 riscv64
Michal Marek 797591
    # HACK: work around U-Boot ignoring vendor dir
Michal Marek 797591
    baselink=%{dtbdir}/$(basename $target).dtb
Michal Marek 797591
    vendordir=$(basename $(dirname $target))
Michal Marek 797591
    ln -s $target.dtb %{buildroot}$baselink
Michal Marek 797591
    echo $baselink >> ../dtb-$vendordir.list
Michal Marek 797591
%endif
Michal Marek 797591
done
Michal Marek 797591
cd -
Michal Marek 797591
Michal Marek 797591
$SUBPKG_POST
Michal Marek 797591
$SUBPKG_FILES
Michal Marek 797591
%changelog