kernel-source-longterm/dtb.spec.in.in

108 lines
2.8 KiB
Plaintext

#
# spec file for package $NAME
#
# Copyright (c) @YEAR@ SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%define srcversion @SRCVERSION@
%define patchversion @PATCHVERSION@
%define variant @VARIANT@%{nil}
%include %_sourcedir/kernel-spec-macros
%(chmod +x %_sourcedir/{@SCRIPTS@})
Name: $NAME
Version: @RPMVERSION@
%if 0%{?is_kotd}
Release: <RELEASE>.g@COMMIT@
%else
Release: @RELEASE@
%endif
Summary: Device Tree files for $MACHINES
License: GPL-2.0-only
Group: System/Boot
URL: https://www.kernel.org/
%if ! 0%{?is_kotd} || ! %{?is_kotd_qa}%{!?is_kotd_qa:0}
$ARCH_RESTRICTIONS
%else
ExclusiveArch: do_not_build
%endif
BuildRequires: cpp
BuildRequires: dtc >= 1.4.3
BuildRequires: xz
Requires: kernel = %version
@SOURCES@
%description
Device Tree files for $MACHINES.
$SUBPKG_DESC
%prep
# Unpack all sources and patches
%setup -q -c -T -a 0 @UNPACK_PATCHES@
cd linux-%srcversion
%_sourcedir/apply-patches %_sourcedir/series.conf ..
%build
source=linux-%srcversion
cp $source/COPYING .
SRCDIR=$PWD/$source
mkdir pp
PPDIR=$PWD/pp
export DTC_FLAGS="-R 4 -p 0x1000"
DTC_FLAGS="$DTC_FLAGS -@"
cd $source/$DTS_folder
for dts in $ALL_SUPPORTED_DTB; do
target=${dts%*.dts}
mkdir -p $PPDIR/$(dirname $target)
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
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 $ALL_SUPPORTED_DTB; do
target=${dts%*.dts}
install -m 755 -d %{buildroot}%{dtbdir}/$(dirname $target)
# install -m 644 COPYING %{buildroot}%{dtbdir}/$(dirname $target)
install -m 644 $target.dtb %{buildroot}%{dtbdir}/$(dirname $target)
%ifarch %arm aarch64 riscv64
# HACK: work around U-Boot ignoring vendor dir
baselink=%{dtbdir}/$(basename $target).dtb
ln -s $target.dtb %{buildroot}$baselink
%ifarch %arm
case $dts in
$SUBPKG_CASE
esac
echo $baselink >> ../$pkgname.list
%else
vendordir=$(basename $(dirname $target))
echo $baselink >> ../dtb-$vendordir.list
%endif
%endif
done
cd -
$SUBPKG_POST
$SUBPKG_FILES
%changelog