kernel-source/dtb-armv6l.spec

118 lines
3.0 KiB
RPMSpec

#
# spec file for package dtb-armv6l
#
# 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.10.3
%define vanilla_only 0
%include %_sourcedir/kernel-spec-macros
Name: dtb-armv6l
Version: 4.10.3
%if 0%{?is_kotd}
Release: <RELEASE>.g338f856
%else
Release: 0
%endif
Summary: Device Tree files for $MACHINES
License: GPL-2.0
Group: System/Boot
Url: http://www.kernel.org/
%if %vanilla_only
BuildRequires: kernel-source-vanilla
%else
BuildRequires: kernel-source
%endif
ExclusiveArch: armv6l armv6hl
BuildRequires: cpp
BuildRequires: dtc >= 1.4.0
BuildRequires: xz
Requires: kernel = %version
%description
Device Tree files for $MACHINES.
%package -n dtb-bcm2835
Summary: Raspberry Pi 1 (A+, B, B+)
Group: System/Boot
Provides: multiversion(dtb)
Requires(post): coreutils
%description -n dtb-bcm2835
Device Tree files for Raspberry Pi 1 (A+, B, B+).
%prep
%build
source=/usr/src/linux-%kernelrelease
%if %vanilla_only
source=$source-vanilla
%endif
cp $source/COPYING .
mkdir pp
PPDIR=`pwd`/pp
export DTC_FLAGS="-R 4 -p 0x1000"
cd $source/arch/arm/boot/dts
for dts in bcm2835*.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 bcm2835*.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-bcm2835
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-bcm2835 -f dtb-bcm2835.list
%else
%files -n dtb-bcm2835
%endif
%defattr(-,root,root)
%doc COPYING
%ghost /boot/dtb
%dir %{dtbdir}
%{dtbdir}/bcm2835*.dtb
%changelog