File dtb-armv6l.spec of Package dtb-source

#
# spec file for package dtb-armv6l
#
# Copyright (c) 2015 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/
#


Name:           dtb-armv6l
BuildRequires:  kernel-source
%define kernel_version %(rpm -q --qf "%{VERSION}" kernel-source | grep -v "is not")
Version:        %kernel_version
Release:        0
Summary:        Device Tree files for $MACHINES
License:        GPL-2.0
Group:          System/Boot
Url:            http://www.kernel.org/
%if "dtb-armv6l" == "dtb-source"
Source99:       pre_checkin.pl
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       kernel = %kernel_version
BuildRequires:  cpp
BuildRequires:  dtc >= 1.4.0
BuildRequires:  xz
ExclusiveArch:  armv6l armv6hl

%description
Device Tree files for $MACHINES.

%package -n dtb-bcm2835
Summary:        Raspberry PI B
Group:          System/Boot

%description -n dtb-bcm2835
Device Tree Files for Raspberry PI B.



%prep

%build
cp /usr/src/linux/COPYING .
cp -r /usr/src/linux/ .
chmod -R ug+rw linux

%install
%if "dtb-armv6l" != "dtb-source"
export DTC_FLAGS="-R 4 -p 0x1000"
mkdir -p %{buildroot}/boot/dtb

cd linux/arch/arm/boot/dts
for dts in bcm2835*.dts ; do
	target=${dts%*.dts}
	cpp -x assembler-with-cpp -undef -D__DTS__ -nostdinc -I. -I./include/ -P $target.dts -o $target.dts.tmp
	install -m 700 -d %{buildroot}/boot/dtb/$(dirname $target)
	dtc $DTC_FLAGS -I dts -O dtb -o %{buildroot}/boot/dtb/$target.dtb $target.dts.tmp
done
cd -

%files -n dtb-bcm2835
%defattr(-,root,root)
%doc COPYING
%dir /boot/dtb/
/boot/dtb/bcm2835*.dtb

%endif

%changelog
openSUSE Build Service is sponsored by