File odroidc2-firmware.spec of Package odroidc2-firmware

# spec file for package odroidc2-firmware
# 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

Name:           odroidc2-firmware
Version:        20170419
Release:        0
Summary:        Firmware for ODROID-C2 board
License:        GPL-2.0 AND GPL-3.0 AND SUSE-Firmware
Group:          System/Boot
Source10:       LICENSE.bl1
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%ifarch aarch64
BuildRequires:  cross-arm-binutils
BuildRequires:  cross-arm-gcc%{gcc_version}
BuildRequires:  meson-tools
%ifarch aarch64
BuildRequires:  u-boot-odroid-c2

Bootloader firmware for Hardkernel ODROID-C2 board

%package tools
Summary:        Tools for ODROID-C2 firmware
Group:          System/Boot

%description tools
Utilities for building Hardkernel ODROID-C2 firmware

%setup -q -c -T -a 0 -a 1
pushd u-boot-odroidc2-v2015.01
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%ifarch aarch64
cp -R u-boot_firmware-odroidc2-bl301/{arch,board} u-boot-odroidc2-v2015.01/
%ifarch aarch64
cp %SOURCE10 .

pushd ${HDIR}
make %{?_smp_mflags} -C tools/fip_create/ HOSTCFLAGS="%{optflags}"
%ifarch aarch64
make %{?_smp_mflags} odroidc2_defconfig
make %{?_smp_mflags} prepare
# bl301.bin
make %{?_smp_mflags} V=1 -C arch/arm/cpu/armv8/gxb/firmware/scp_task/ buildsrc=$(pwd) buildtree=$(pwd)/build KBUILD_SRC=$(pwd) \
     CROSS_COMPILE=arm-suse-linux-gnueabi- CC=arm-suse-linux-gnueabi-gcc-%{gcc_version} CPP=arm-suse-linux-gnueabi-cpp-%{gcc_version}
%ifarch aarch64
${HDIR}/tools/fip_create/fip_create \
  --bl30  ${HDIR}/fip/gxb/bl30.bin \
  --bl301 ${HDIR}/fip/gxb/bl301.bin \
  --bl31  ${HDIR}/fip/gxb/bl31.bin \
  --bl33  /boot/u-boot.bin \
  --dump \
cat ${HDIR}/fip/gxb/bl2.package fip.bin > boot_new.bin
amlbootsig boot_new.bin u-boot.img
dd if=u-boot.img of=u-boot.odroidc2 bs=512 skip=96

pushd u-boot-odroidc2-v2015.01
install -D -m 755 tools/fip_create/fip_create %{buildroot}%{_bindir}/odroidc2-fip_create
%ifarch aarch64
install -D -m 644 sd_fuse/bl1.bin.hardkernel %{buildroot}/boot/bl1.bin.hardkernel
install -D -m 644 fip/gxb/bl2.package %{buildroot}/boot/bl2.package
install -D -m 644 fip/gxb/bl30.bin %{buildroot}/boot/bl30.bin
install -D -m 644 fip/gxb/bl301.bin %{buildroot}/boot/bl301.bin
install -D -m 644 fip/gxb/bl31.bin %{buildroot}/boot/bl31.bin
%ifarch aarch64
install -D -m 644 u-boot.odroidc2 %{buildroot}/boot/u-boot.odroidc2

%ifarch aarch64
%doc LICENSE.bl1

%files tools